lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


Rici Lake wrote:
[...]
> This is also considered a strength of Smalltalk / Squeak and 
> Objective-C, as I understand it.

Yes, this dates back from Smalltalk-80 and before.

Reasoning:

- make a subclass on Number called Distance. You can now make a Distance
  object representing five metres with 'Distance new: 5'.
- add a method to Number, 'metres', that calls 'Distance new: n'.
- add a method to Number, 'feet', that calls 'Distance new: (n * 0.304.8)'.

You may now say '5 metres' or '18 feet' to construct Distance objects. Natural
and intuitive. (There's a namespace mechanism in place to prevent namespace
pollution.)

I find it rather amusing that practically every shiny new language feature
that are in fashion today were, in fact, done 27 years ago by Smalltalk-80.
People don't learn from history...

-- 
┌── dg@cowlark.com ─── http://www.cowlark.com ─────────────────────
│ "Is Eris true?" "Everthing is true." "Even false things?" "Even false
│ things are true." "How can that be?" "I don't know, man. I didn't do it!"
│ --- _Prinicipa Discordia_

Attachment: signature.asc
Description: OpenPGP digital signature