Comment

Comment by isaachier

Here's an example of the distinct nature of Smalltalk's message passing:

Control structures

Control structures do not have special syntax in Smalltalk. They are instead implemented as messages sent to objects. For example, conditional execution is implemented by sending the message ifTrue: to a Boolean object, passing as an argument the block of code to be executed if and only if the Boolean receiver is true.

The following code demonstrates this:

result := a > b ifTrue:[ 'greater' ] ifFalse:[ 'less or equal' ]

https://en.wikipedia.org/wiki/Smalltalk

parent isaachier 7 years ago

Discussion

Live from the official Hacker News API

A modern reader for Hacker News · SvelteKit + Skeleton