SkriptLang / Skript

Skript is a Spigot plugin which allows server admins to customize their server easily, but without the hassle of programming a plugin or asking/paying someone to program a plugin for them.
https://docs.skriptlang.org
GNU General Public License v3.0
1.06k stars 367 forks source link

Conditions to Expressions #2981

Closed Mwexim closed 4 years ago

Mwexim commented 4 years ago

Description

We had it long enough: conditions. Why are they a separate syntax element? Why do conditions in Skript work like this? They are definitely limiting certain approaches that are easy to do in Java.

I don't know if it is suggested already, but I thought it was weird that this didn't change. Why do we have Conditions? Why aren't they integrated as Expressions that return a boolean? Why?

Just to give an example from the skript-parser project: click. It works like an Expression, but it uses a certain use case of it (ConditionalExpression). If you go to the ConditionalExpression class, it is actually just a sort of utility class that extends Expression\<Boolean>.

Apart from that, conditions work also different in that repository. Instead of the conditions being syntax, it works like if %boolean%; else if %boolean%; else. This is Java-like and much more convenient.

Pros:

Cons:

I literally cannot find anything aside from the massive work it will take. Not a difficult job, but a time-consuming one.

Please let me know if I overlooked something, because I'm not one of the contributors here, so I don't know how the structure of Skript works 100%. It can be impossible or maybe it is already integrated in some way I didn't see.

Moderocky commented 4 years ago

Already suggested nearly a year ago - https://github.com/SkriptLang/Skript/issues/2207

No idea what happened about it. 😦

Mwexim commented 4 years ago

Already suggested nearly a year ago - #2207

No idea what happened about it. 😦

Sorry, should've done my research. But I think it's good we can finally talk about this. It's something that was in my mind for a long time and especially since I began digging in the skript-parser repository, it came to my mind even more.

This needs to get done imo. Skript currently is such a mess and instead of adding syntax, it should get cleaned up as well. I think the next thing is to loosen the integration with BukkitAPI to enable easier integration with other plugins.

ShaneBeee commented 4 years ago

duplicate of #2207