Caper needs Self Help
Mike Austin
mike_ekim at yahoo.com
Tue Nov 18 23:48:26 UTC 2003
--- In self-interest at yahoogroups.com, Jecel Assumpcao Jr <jecel at m...>
wrote:
> On Tuesday 18 November 2003 11:35, Paul Chapman wrote:
> > My other message today reveals that I've still been unable to get
> > Self running under Cygwin.
>
> I have never tried it, so I can't help you there. Personally, I
would
> just boot some CD-based Linux (such as Knoppix) and use that to try
out
> Self (which could be on the Windows partition on the hd).
>
> > So here are a couple of questions about
> > Self the answers to which would help me with Caper's semantics.
> >
> > (1) Is there any use for an inline object-with-code? It seems to
me
> > that there isn't, because there is no selector associated with
such
> > an object, and therefore it's rather difficult to invoke the code.
>
> This was a feature in Self 1.0 that was replaced by a parser
> optimization in later versions. So it used to be that if you wrote
>
> 3 + (4 * 5)
>
> and looked at the bytecodes, you would see what you call an
> "object-with-code" as the argument for the '+' message. There is no
> selector, but just pushing it to the stack was enough to invoke it.
> Something like
>
> 3 + [4 * 5] value
>
> Since these were full method objects, you could write
>
> 3 + (|z| z: 4 * 5. 10 + z)
>
> which in a more recent version of Self will give you an "inner
methods
> are no longer supported" error.
>
> > (2) Conversely, what happens if a keyword slot contains an object-
> > without-code?
>
> That gives you a syntax error. "Empty objects" (even if they have
> slots!) can only live in unary slots.
>
> > I assume that accessing the object in such a slot by
> > sending a keyword message to its container would return (a copy
of)
> > the object itself with the parameter slots filled in. Is that
right?
>
> That is not how the current implementation works, but is a very
> reasonable thing to expect. In fact, there are good arguments for
both
> returning the object itself and for returning a copy of it.
>
> > I'm trying to work out what the deep meaning of Self's objects-
with-
> > and-without-code is (cf Smalltalk's separation of methods and
> > instance variables into two namespaces), in order to find the best
> > way for Caper to distinguish between "values" (evaled at
definition)
> > and "methods" (evaled at invocation) in fields.
>
> You might also find you need something like blocks, which are a
huge
> complication.
A huge complication? Aren't block closure's just anonymous methods
(which are objects) with their proto set to their enclosing
environment? I thought it was something like this in self.
-- Mike
More information about the Self-interest
mailing list