shop-planner / shop3

SHOP3 Git repository
https://shop-planner.github.io
144 stars 14 forks source link

Add alternative syntax for methods #72

Open rpgoldman opened 3 years ago

rpgoldman commented 3 years ago

(Based on discussion with @gefjon)

The current syntax for methods is quite hard to read, especially when there are multiple if-then-else branches.

Suggest we create an alternative syntax that's easy to read for the simple case and introduce :if :elsif and :else keywords for processing the more complex branching structure.

gefjon commented 3 years ago

I would use :elif rather than :elsif. The extra letter is no more clear (since it's still not complete like :elseif or :else-if), and Python's use of elif has cemented the 4-letter version as standard.

ko56 commented 3 years ago

Enhancing the method syntax would definitely be an improvement. But I would vote for :elseif, which is what Julia uses.

ko56 commented 2 years ago

A proposal: if the work to implement a/the new syntax is not too much, how about implementing something so that people can play with it, with the understanding that it is subject to change?