TriggerReactor

TriggerReactor

24.6k Downloads

Remove specialized end statements

gerzytet opened this issue · 5 comments

commented

I realize this is going to be controversial....

I believe that all of these:
ENDIF
ENDWHILE
ENDASYNC
...

Should be replaced with:
END

Benefits:

  • reduced code size
  • less syntax to remember, simpler

I consider endif to be an outdated construct. Please tell me why it should stay.

commented

The interpreter has to know where each statement ends.

In old languages (and also TR), they have used something like ENDXX to specify it. Shell script is one example.

In semi-modern languages, like C, C++, Java, the paradigm shifted, and compilers and interpreters started to use the curly bracket instead.

Now, the modern languages like Python use spaces and tab as the indicator, therefore it doesn't require the need of ENDXX or curly brackets. This is a smart move indeed since we tend to code in hierarchical manor to help us understand the structure of the code.

For our case, TR is based on the Plugin, VariableTrigger, which used the old language style. So it was an attempt to lure those user bases, yet it will be a huge change and will require re-code of almost entire code interpreter if we want to change it to different style. I don't believe that's ideal. TR is somewhere between the actual language, like Java, and the in-game functions, like Command Block, so the server administrators don't have to be expert coder to implement various easy functionalities, yet it can be less comfortable to the real coders who already know how to write Java. In fact, the rather group can write their own Plugin (or perhaps Skript) to avoid this caveat, and that's what I usually do myself.

But yes, we may introduce TriggerReactor2, which will be entirely different project than TriggerReactor, to provide new syntax, yet we will have to support both projects, like how Python2 is still maintained while Python3 is released long time ago.

commented

A much easier way to implement this would be to simply new syntax without changing the old one.
PHP is a good example; it supports both {} and endif.

commented

we use curly brackets for global variable though :/

commented

I was using that as an example of a language that has 2 different ways of ending if.
END will work though.

commented

Closing this since there’s been no recent discussion and wysohn has given his answer