Re:Pony – High Performance Actor Programming
by k__ on Sunday May 03, 2015 @07:14PM
(#9483467)
I saw there are no ends in function and class definitions used, are they optional in if and for too?
[ Parent
| on HN ]
I don't think so. The language is (almost) whitespace insensitive so the only way to know where a certain control statement terminates is by having the `end` token.
It is unnecessary on the top-level though, since the top-level expression will end where the next one begins. Which means you probably can't have nested class/function definitions.
This technique is not new and is used in OCaml, for example.
Re:Pony – High Performance Actor Programming
by barrelrider on Sunday May 03, 2015 @07:56PM
(#9483588)
This is correct, classes and functions are not dependent on indentation, they just don't need an end. And yes, there are no nested classes and functions (other than in object literals).
Ah I see. Didn't no such a mix was common :)
Do you mean whether Pony requires/allows braces to delimit functions, or class definitions? If so, the answer is no, as they are superfluous.
I saw function and class definitions were delimited by their indentation but if and for used "end".
I wanted to know if these "end"s are optional (I can write it like Python) or strictly needed (I have to write it like Ruby).