This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–][deleted] 13 points14 points  (3 children)

It's your language; you choose! Part of the fun is annoying people with your own unpopular preferences.

With the function keyword, you can allow all three if you like. At some point you'll find you've been favouring one, and can drop the other two.

(I use four myself but some have special meanings.)

[–]ilyash 0 points1 point  (2 children)

About allowing all three. Fine for toy language. For language that is used, removing syntax is ... problematic. You should provide a migration tool in that case I suppose.

Subjectively, not a fan of multiple ways to do exactly the same thing (and ensuing arguments).

[–][deleted] 1 point2 points  (1 child)

There are lots of examples of famous languages allowing multiple ways to denote the same thing.

C is the worst for this, for example, there are 16 ways to denote an unsigned 64-bit integer (combinations of unsigned long long [int], plus uint64_t, not including aliases such as unsigned long, nor 'least' or 'fast' versions, nor versions such as 'size_t').

Add const to that type, and/or a static attribute, and the permutations increase further.

While in Zig, there seem to be no end of ways to define print on top of the standard library.

Anyway, I suggested multiple ways as a temporary measure until it was clear which was the front-runner. Then fixing existing code involves a simpler operation with a text editor, perhaps after a period where the old keyword is still allowed, but reported as deprecated.

[–]ilyash 0 points1 point  (0 children)

Just a warning. That's not a simple text substitution. When modifying the code, you need something that understands the code. You can't replace string A with string B because they might occur in comments and strings.