Replies: 3 comments 3 replies
-
Another example (if I understood everything correctly):
|
Beta Was this translation helpful? Give feedback.
-
For some time, I was considering an idea of defining additional grammar which could then be even less compatible with the current one (modeled probably after Java instead of Ruby). That way users could rewrite their code for the new syntax if/when they would feel like it. The two grammars would support the same constructs, only would express them in different ways. There's a lot of problems with it. I would have to support the two grammars, meaning either twice as much work for very little gain, or letting the old grammar to become obsolete. And since I'd switch to the new grammar immediately, I wouldn't be able to spot problems with the older one unless someone reported it. Finally, neither the Mindcode project, nor the community around it seems large enough to afford such an extravaganza. |
Beta Was this translation helpful? Give feedback.
-
Thanks to all that have participated in the poll. Given the majority opinion, I've decided to make semicolons compulsory in the new syntax, which is being discussed in #142. Since the issue is resolved, I'm closing this thread - if you have anything to add, please use the new thread describing all the planned changes. |
Beta Was this translation helpful? Give feedback.
-
I'm planning some enhancement to Mindcode syntax in, hopefully, not so distant future. A rough scope of planned enhancements can be found in the roadmap. All the planned keywords will probably become reserved, although the planned functionality can take some time to materialize. In any case, it can be expected that the changes will break some existing Mindcode.
This would provide an opportunity to make one far-reaching change to Mindcode: to make semicolons compulsory as separators between expressions. Most of existing Mindcode doesn't utilize semicolons, so consequences of this change would be far reaching and would require a lot of updates.
Optional semicolons were inspired by Ruby, but unfortunately they allow a lot of ambiguities in source code. Some of the problematic constructs include:
set a = 10
: compiles as two expressions,set
anda = 10
.set
is an expression that evaluates the variable calledset
, but because it isn't used for anything, it is just silently ignored. It might lead users to believe thatset variable = expression
is a regular Mindcode syntax.printflush message1
: compiles as two expressions,printflush
andmessage1
. Similarly to the previous case, both of them are just silently ignored. Users might be baffled why it doesn't appear in the compiled code, reducing the confidence in the compiler.Lorem ipsum dolor sit amet consectetur adipiscing elit
: again, no error reported on this "source code", but nothing gets generated in the compiled code. Gives Mindcode a somewhat Dadaist touch.print(a)
: amazingly, the current syntax allows to interpret this construct as two expressions,print
and(a)
. ANTLR fortunately always prefers the correct interpretation, that is a call to aprint
function witha
as an argument. Compulsory semicolons would make the former interpretation impossible, which would be very desired.So, I'm addressing you, dear Mindcode users, with the following question:
14 votes ·
Beta Was this translation helpful? Give feedback.
All reactions