Fwd: Re: binary selectors ambiguity and space

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

Fwd: Re: binary selectors ambiguity and space

Nicolas Cellier-3
Hi

Le Lundi 15 Mai 2006 20:25, Stephan Rudlof a écrit :
> How often are cases like
>   x+-1
> while loading 'normal' packages?
> If I've understood correctly
>   x+-y
> (only variables) would not make problems.

You are perfectly right, my example was stupid, but look ago in this thread,
there are a lot of senders of 0@-25 for example in current 3.9.

Ralph also proposed to implement (Number>>@- y) as ^self @ y negated as a
workaround.

> > This is why i propose the notification to raise a popup dialog only if
> > Parser>>interactive answer true.
>
> An idea:
> Announcement of the strict behaviour some time ago: then package
> maintainers can fix there packages (shouldn't be too hard ;-) ).

In theory, this is fine, but look how many packages are compatible with 3.8
 on SqueakMap... We are all loading some older packages and cross fingers...

> On 13.05.2006 02:10, nicolas cellier wrote:
> nc>...
> nc> Funny, in current 3.9 spaces are ignored:
> nc> i have '1 +-   2' interpreted as (1) + (-2)
>
> At least, if there should be a change in the semantics - for e.g.
> allowing selector #+- in the case above -, it would be *much* better to
> fail loading a package instead of loading it silently: otherwise the
> code would just break at runtime!
>
> Regards,
> Stephan

You are right, the change i proposed would preserve compatibility by not
groking the last - when digit is not separated, but above case would
completely be broken...

Note that above implementation does not follow any Smalltalk-80 logic. it
means than - is a prefixed unary selector... (when no space used, it can be
considered a single literal token, it's not the same).

We can have it failing now if we want to (it is in
 Parser>>primaryExpression). But later, if - is accepted as second binary
 character, i cannot figure how...

Nicolas

-------------------------------------------------------