logoalt Hacker News

galaxyLogictoday at 9:02 AM0 repliesview on HN

Yes, and as you point out even conditional statements.

In Smalltalk constructs like

   b ifTrue: [ ... ] 
mean that the boolean value 'b' has its method (-function) ifTrue: called with the argument [...] which is a "closure" meaning it is a free-standing function (as opposed to bound functions which are the methods).

There are similarly library methods in class Boolean for whileTrue: etc. Functions all the way.

What would be the point of implementing conditional statements as methods/functions? It makes it posssible to extend the set of conditional statements to for instance 3-valued logic by adding a method #ifTrue:ifFalse:ifUnknown: . And of course it makes the syntax of the language very simple.