[Grace-core] super in Grace

Andrew P. Black black at cs.pdx.edu
Thu Feb 3 01:05:55 PST 2011


By gads, Batman!

I han't thought about allowing an object constructor with multiple occurrences of the same method as legal /syntax/.  But: why not?
What about multiple occurrences of the same field?  Not a problem, because all fields have unique names, so it can't happen.

If we allow that syntax, then there should be some way of getting to the overridden method (i.e., the method in the (n-1)th  method declaration)  What about

	self.1.myMessage
	self.2.myMessage

to send to the (n-1)st and (n-2)nd method.  Ordinary message send is self.0.message.  And no, you can't omit the self in these special forms.

On 2 Feb 2011, at 16:48, James Noble wrote:

> 
> right - which turns out to be really useful, a "delegated perform" in Self, but we don't want that here. not just yet!
>> 

I'm actually very tempted by this!  It will make delegation first-class, something that I have long wanted.  If we don't' have assignable parent slots (and I don't think that we should), an object s can still explicitly delegate a message to an object other by writing

	other.0.someMessage

Here the .0 says: the final method for someMessage in the object other, but self remains the receiver. 

Well, maybe it's not quite first class.   Messages sent to self from other would go to s, but if s had no method, they would not be delegated to other; they would just fail.


>> It would be nice to come up with another syntax that represents the truth more clearly.  Call-next-method doesn't work because it has a different arity every time we call it.
> 
> well there are the two options - one with arity and one with no arguments that just calls with the same arguments.
> If that was all we really needed (it shouldn't be too hard to ask a Smalltalk image about this)

Let me see if I can do that.

> then we could just have a no-args syntax that did it.
> Open option for that would just be "super", or "callNextMethod" but without arguments...
> 
> Hmm, evidence based language design...



More information about the Grace-core mailing list