shop3 icon indicating copy to clipboard operation
shop3 copied to clipboard

Add alternative syntax for methods

Open rpgoldman opened this issue 3 years ago • 3 comments

(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.

rpgoldman avatar Jun 17 '21 16:06 rpgoldman

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.

gefjon avatar Jun 17 '21 16:06 gefjon

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

ko56 avatar Jul 25 '21 14:07 ko56

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?

ko56 avatar Apr 17 '22 22:04 ko56