Slots (was Re: Test expectation language (was Re: [squeak-dev] The Inbox: CollectionsTests-dtl.209.mcz))

Frank Shearar frank.shearar at gmail.com
Sun Jan 19 11:46:27 UTC 2014


On 5 January 2014 22:28, Chris Muller <asqueaker at gmail.com> wrote:

> Colin Putney said at some point:

>> I much prefer the Smalltalk community's tendency to build layers of
>> abstraction, while sticking to idiomatic Smalltalk. DSLs have their uses,
>> ... snip...
>
> Yes.  I've always liked how everything we do in Smalltalk is built on
> an aggregation of just 3 or 4 concepts, and that's it.  THAT is pretty
> slick in itself.  Anything above that is "magic" and should pay
> _really_ good ROI to justify its existence (e.g., way more than simply
> aesthetics).  Another example I can think of are those new special
> inst-vars in Pharo (having trouble remembering the name, "slots?") to
> define all sorts of RDBMS-style checks, etc.  I would rather do that
> simply via the same few Smalltalk concepts as everything else.
> Instantiation, setting state, and message-sending..

Slots [1] are just ("just") instance variables promoted to first class
citizens. They do for instance variables what Metaclass does for Class
- they extend Smalltalk's metaobject protocol [2] to cover instance
variables. This lets you intercept reads and writes to the instance
variables, and all sorts of interesting stuff. It's still just
standard Smalltalk.

Seems like a perfectly sensible thing to do.

frank

[1] http://hal.inria.fr/docs/00/64/17/16/PDF/Verw11b-OOSPLA11-FlexibleObjectLayouts.pdf

[2] https://en.wikipedia.org/wiki/The_Art_of_the_Metaobject_Protocol,
praised by Alan Kay in his OOPSLA 1997 speech as (something like) "the
best book written in 10 years.. but why did they have to write it in
Lisp?"


More information about the Squeak-dev mailing list