[Self-interest] Block Question

Jecel Assumpcao Jr jecel at merlintec.com
Fri Nov 12 01:35:33 UTC 2021


Steve Dekorte wrote on Thu, 11 Nov 2021 13:55:22 -0800
> > On Nov 11, 2021, at 1:02 PM, Jecel Assumpcao Jr wrote:
> > But if we create an object like ( | a <- 3. b = 4 | ) it won't know any
> > globals. Passing it a message asking for "traits color" will fail, while
> > in Smalltalk all code can access the global Color. This is normally a
> > good thing which allows us to implement the POLA (principle of least
> > authority) security style in our code if we want
> 
> Do the number objects for "3" and "4" or symbol objects for  "a" and "b"
> have refs to those traits ancestors by which introspective code in the
> object could potentially find its way to access globals?

Yes, every object is really the root for a possibly complex tree. Unless
you really pay attention everything ends up connected to nearly
everything else. So this would work:

( | a <- 3. b = 4 | ) b traits color

because:

4 parent -> traits smallInteger
traits smallInteger parent -> traits number
traits number parent -> traits orderedOddball

and traits orderedOddball has 3 parents: mixins oddball, mixins ordered
and lobby. lobby has two parents: defaultBehavior and globals.

To get at the symbols used as slot names for the object you would need
to get a mirror for it since this is a reflective operation (about the
language) instead of a base operation (about the problem domain). If you
did get to the symbol 'a' from the object you would get to globals as
easily as you did from 4. But at that point you would have many other
paths to the bulk of the system.

Not having globals built into the language allows a more secure system
to be created, but that was not done for Self. The goal for Self was to
be "like Smalltalk, only more so" to quote Mario Wolczko. And Smalltalk
has globals.

-- Jecel


More information about the Self-interest mailing list