3 ms·
Unless I misunderstand what you mean, don't a host of languages do this? io, ruby, javascript?
by Volpe 15y ago
Unless I misunderstand what you mean, don't a host of languages do this? io, ruby, javascript?
- draegtun 15y agoRuby & Javascript have syntax defined in their parsers for control structures. for eg: # Ruby if someThing() doThis() else doThisInstead() end # Javascript/Perl/etc if (someThing()) { doThis() } else { doThisInstead() } Whereas Io & Smalltalk requires no new syntax and uses objects & messages: # Io if(someThing, doThis, doThisInstead) # Io like Ruby,etc if(something) then(doThis) else(doThisInstead) # Io like Smalltalk someThing ifTrue(doThis) ifFalse(doThisInstead) # Smaltalk someThing ifTrue: [doThis] ifFalse: [doThisInstead].
- eru 15y agoAs an aside, Haskell wouldn't need syntax for something like `if', but has it as a convenience. There's no syntax for looping, you can do that with higher-order functions.