[bug] 0007770: cascading does ont work with super

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
10 messages Options
Reply | Threaded
Open this post in threaded view
|

[bug] 0007770: cascading does ont work with super

vaidasd
FYI, cascading does ont work with super. Compiler refuses to compile
super
    initialize;
    setListProperties

Vaidas

Reply | Threaded
Open this post in threaded view
|

Re: [bug] 0007770: cascading does ont work with super

Frank Shearar-3
On 19 June 2013 10:51, Vaidotas Didžbalis <[hidden email]> wrote:
> FYI, cascading does ont work with super. Compiler refuses to compile
> super
>     initialize;
>     setListProperties

I replied on the ticket, but I'll replicate it here:

Do you expect this to be equivalent to

  super initialize.
  self setListProperties.

or to

  super initialize.
  super setListProperties.

Given that ambiguity I'd say failing to compile is the right answer.

At the moment a super is the _only_ thing that can't cascade. Comments, Eliot?

frank

Reply | Threaded
Open this post in threaded view
|

Re: [bug] 0007770: cascading does ont work with super

vaidasd
2013/6/19 Frank Shearar <[hidden email]>:
...
> Do you expect this to be equivalent to
>
>   super initialize.
>   self setListProperties.
>
> or to
>
>   super initialize.
>   super setListProperties.
...
> Given that ambiguity I'd say failing to compile is the right answer.

I expected the latter. I think about super as an object. Anyway, the
error message "Cascading not expected ->" is confusing here.

Reply | Threaded
Open this post in threaded view
|

Re: [bug] 0007770: cascading does ont work with super

Frank Shearar-3
On 19 June 2013 11:26, Vaidotas Didžbalis <[hidden email]> wrote:

> 2013/6/19 Frank Shearar <[hidden email]>:
> ...
>> Do you expect this to be equivalent to
>>
>>   super initialize.
>>   self setListProperties.
>>
>> or to
>>
>>   super initialize.
>>   super setListProperties.
> ...
>> Given that ambiguity I'd say failing to compile is the right answer.
>
> I expected the latter. I think about super as an object. Anyway, the
> error message "Cascading not expected ->" is confusing here.

Right. Of course, super _isn't_ an object: it's more like "the next
token is a message; send that message to myself but start the method
lookup in my parent's method dictionary."

But, to my horror, "a := super" is valid syntax!

frank

Reply | Threaded
Open this post in threaded view
|

Re: [bug] 0007770: cascading does ont work with super

vaidasd
> But, to my horror, "a := super" is valid syntax!

from Wikipedia (https://en.wikipedia.org/wiki/Smalltalk): "...  true,
false, nil, self, super, and thisContext. These are actually called
pseudo-variables, identifiers that follow the rules for variable
identifiers but denote bindings that the programmer cannot change.".
My understanding that a := super is valid.

Reply | Threaded
Open this post in threaded view
|

Re: [bug] 0007770: cascading does ont work with super

Nicolas Cellier
As long as you don't write things like  (self send: #someMessage to: super), there's not much possible confusion ;)

Nicolas


2013/6/19 Vaidotas Didžbalis <[hidden email]>
> But, to my horror, "a := super" is valid syntax!

from Wikipedia (https://en.wikipedia.org/wiki/Smalltalk): "...  true,
false, nil, self, super, and thisContext. These are actually called
pseudo-variables, identifiers that follow the rules for variable
identifiers but denote bindings that the programmer cannot change.".
My understanding that a := super is valid.




Reply | Threaded
Open this post in threaded view
|

Re: [bug] 0007770: cascading does ont work with super

Frank Shearar-3
Well, I really really don't _ever_ want to see something like this:

    foo bar baz: super

But that's just me, maybe. Maybe I should imagine super as being a
transparent proxy for self, with custom lookup.

frank

On 19 June 2013 17:55, Nicolas Cellier
<[hidden email]> wrote:

> As long as you don't write things like  (self send: #someMessage to: super),
> there's not much possible confusion ;)
>
> Nicolas
>
>
> 2013/6/19 Vaidotas Didžbalis <[hidden email]>
>>
>> > But, to my horror, "a := super" is valid syntax!
>>
>> from Wikipedia (https://en.wikipedia.org/wiki/Smalltalk): "...  true,
>> false, nil, self, super, and thisContext. These are actually called
>> pseudo-variables, identifiers that follow the rules for variable
>> identifiers but denote bindings that the programmer cannot change.".
>> My understanding that a := super is valid.
>>
>
>
>
>

Reply | Threaded
Open this post in threaded view
|

Re: [bug] 0007770: cascading does ont work with super

David T. Lewis
On Wed, Jun 19, 2013 at 06:27:27PM +0100, Frank Shearar wrote:
> Well, I really really don't _ever_ want to see something like this:
>
>     foo bar baz: super
>
> But that's just me, maybe. Maybe I should imagine super as being a
> transparent proxy for self, with custom lookup.


Yes. From the blue book:

"An additional pseudo-variable named super is available for use in a
method's expressions. The pseudo-variable super refers to the receiver
of the message, just as self does. However, when a message is sent to
super, the search for a method does not begin in the receiver's class.
Instead, the search begins in the superclass of the class containing
the method."

So super is supposed to refer to the same object as self.

Dave

>
> frank
>
> On 19 June 2013 17:55, Nicolas Cellier
> <[hidden email]> wrote:
> > As long as you don't write things like  (self send: #someMessage to: super),
> > there's not much possible confusion ;)
> >
> > Nicolas
> >
> >
> > 2013/6/19 Vaidotas Did??balis <[hidden email]>
> >>
> >> > But, to my horror, "a := super" is valid syntax!
> >>
> >> from Wikipedia (https://en.wikipedia.org/wiki/Smalltalk): "...  true,
> >> false, nil, self, super, and thisContext. These are actually called
> >> pseudo-variables, identifiers that follow the rules for variable
> >> identifiers but denote bindings that the programmer cannot change.".
> >> My understanding that a := super is valid.
> >>
> >
> >
> >
> >

Reply | Threaded
Open this post in threaded view
|

Re: [bug] 0007770: cascading does ont work with super

Frank Shearar-3
On 19 June 2013 18:55, David T. Lewis <[hidden email]> wrote:

> On Wed, Jun 19, 2013 at 06:27:27PM +0100, Frank Shearar wrote:
>> Well, I really really don't _ever_ want to see something like this:
>>
>>     foo bar baz: super
>>
>> But that's just me, maybe. Maybe I should imagine super as being a
>> transparent proxy for self, with custom lookup.
>
>
> Yes. From the blue book:
>
> "An additional pseudo-variable named super is available for use in a
> method's expressions. The pseudo-variable super refers to the receiver
> of the message, just as self does. However, when a message is sent to
> super, the search for a method does not begin in the receiver's class.
> Instead, the search begins in the superclass of the class containing
> the method."
>
> So super is supposed to refer to the same object as self.

Yes. But does that mean this this:

    super foo;
       bar

is sensible and so should compile? Because the Compiler's quite clear
that you may not cascade on super. It's the _only_ thing on which you
can't cascade, in fact.

frank

> Dave
>
>>
>> frank
>>
>> On 19 June 2013 17:55, Nicolas Cellier
>> <[hidden email]> wrote:
>> > As long as you don't write things like  (self send: #someMessage to: super),
>> > there's not much possible confusion ;)
>> >
>> > Nicolas
>> >
>> >
>> > 2013/6/19 Vaidotas Did??balis <[hidden email]>
>> >>
>> >> > But, to my horror, "a := super" is valid syntax!
>> >>
>> >> from Wikipedia (https://en.wikipedia.org/wiki/Smalltalk): "...  true,
>> >> false, nil, self, super, and thisContext. These are actually called
>> >> pseudo-variables, identifiers that follow the rules for variable
>> >> identifiers but denote bindings that the programmer cannot change.".
>> >> My understanding that a := super is valid.

Reply | Threaded
Open this post in threaded view
|

Re: [bug] 0007770: cascading does ont work with super

David T. Lewis
On Wed, Jun 19, 2013 at 07:02:58PM +0100, Frank Shearar wrote:

> On 19 June 2013 18:55, David T. Lewis <[hidden email]> wrote:
> > On Wed, Jun 19, 2013 at 06:27:27PM +0100, Frank Shearar wrote:
> >> Well, I really really don't _ever_ want to see something like this:
> >>
> >>     foo bar baz: super
> >>
> >> But that's just me, maybe. Maybe I should imagine super as being a
> >> transparent proxy for self, with custom lookup.
> >
> >
> > Yes. From the blue book:
> >
> > "An additional pseudo-variable named super is available for use in a
> > method's expressions. The pseudo-variable super refers to the receiver
> > of the message, just as self does. However, when a message is sent to
> > super, the search for a method does not begin in the receiver's class.
> > Instead, the search begins in the superclass of the class containing
> > the method."
> >
> > So super is supposed to refer to the same object as self.
>
> Yes. But does that mean this this:
>
>     super foo;
>        bar
>
> is sensible and so should compile? Because the Compiler's quite clear
> that you may not cascade on super. It's the _only_ thing on which you
> can't cascade, in fact.
>

It does not mean that it is sensible, nor does it say anything about
whether or not it should compile.

It seems to me that it is sensible to say exactly what you mean,
either this:

  super foo.
  super bar.

or this:

  super foo.
  self bar.

Dave