Pragma syntax

Andrew Tween amtween at hotmail.com
Sat Aug 19 18:01:57 UTC 2006


Hi Lukas,

----- Original Message ----- 
From: "Lukas Renggli" <renggli at gmail.com>
To: "The general-purpose Squeak developers list"
<squeak-dev at lists.squeakfoundation.org>
Sent: Saturday, August 19, 2006 4:28 PM
Subject: Re: Re: Re: Re: Pragma syntax


> Hi Andrew,
>
> > But, why is that the definition? Why not binary selectors? Is it...
> >     because VW doesn't allow binary selectors?
>
> No. I don't know if binary selectors are allowed in VW.
>
> >     because the grammar would become ambiguous?
>
> Yes. For example this would be ambigous to parse: <>1> (the pragma
> with the selector #> and the arguments #(1)) or <=#foo> (the pragma
> with the selector #= and the arguments #(foo)).

I see. The scanner will naturally group <=  and <> into single tokens.
So, if binary selectors were allowed I would need to write < > 1> and < = #foo>.
Which isn't so bad.

>
> >     the free stuff (searching for senders) wouldn't work with binaries?
>
> No.
>
> >     nobody suggested it?
>
> No.
>
> >     considered unnecessary?
>
> No, but frankly I can't think of an example where this would make
> sense. The pragmas I have in mind and those that I have seen in other
> people's code are not mathematical operators. Maybe you can provide an
> example where this would be useful?

No :) . But that doesn't mean that there aren't any.
I can't think of any good reason why I would want to create a method named
////\//\/\/\/\/\/\/\******&&&@@@@  , but the compiler doesn't stop me.
(Incidently, in Visual Smalltalk, and in VW, binary selectors are limited to 2
characters. I just don't get why).

>
> Note 1: I see the pragma selector as a message that can be sent to an
> object to configure it somehow, binary selectors usually have a
> slightly different meaning.

I don't get that.
Which object is #primitive: sent to, and how does it configure it?

>
> Note 2: It would be easy to allow pragmas like this <* 6>, <,
> 'world'>, basically one line of code that needs to be updated.

I would have thought that <* 6> would also need to be written < * 6> , in order
to parse correctly? Anyway. What you are saying is that it's easy to allow
binary selectors?

>
> > Excellent. I'll test it out once it's there.
>
> I published it to http://source.squeakfoundation.org/inbox, please
> have a look. The tests do all run, I only changed one method that does
> the parsing of the selector. The correction algorithm is the same as
> the one used to correct selectors of normal message sends in your
> code.

Thanks.
I've had a look, and it works great.

Cheers,
Andy

>
> -----------------------------------------------
>
> Name: Compiler-lr.54
> Author: lr
> Time: 19 August 2006, 5:09:02 pm
> UUID: 9ea70c0b-1ebc-4d35-b9f2-bfa1e5e57f8d
> Ancestors: Compiler-md.53
>
> - offer to correct pragma message selectors if they are unknown to the system
>
> -----------------------------------------------
>
> Cheers,
> Lukas
>
> -- 
> Lukas Renggli
> http://www.lukas-renggli.ch
>
>




More information about the Squeak-dev mailing list