pragma syntax

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

pragma syntax

Nicolai Hess-3-2
Hi,

is this valid pragma syntax:

foo
    <func: #operation arg: #+>
    ^ self

(note the closing angle and the +-symbol)

The above code is what the pretty printer creates if you pretty-print this code

foo
    <func: #operation arg: #+ >
    ^ self

(note the space between #+ and >

Or a bug in the parser ?

this pragma definition
    <func: #operation arg: #a>
seems to work.
Reply | Threaded
Open this post in threaded view
|

Re: pragma syntax

Eliot Miranda-2
Hi Nicolai,

On Tue, Jul 26, 2016 at 12:09 PM, Nicolai Hess <[hidden email]> wrote:
Hi,

is this valid pragma syntax:

foo
    <func: #operation arg: #+>
    ^ self

You could say it was ambiguous.  With the change to the syntax of binary selectors in recent years #+> is a binary selector, and so you need whitespace after the token to separate it from the closing >.


(note the closing angle and the +-symbol)

The above code is what the pretty printer creates if you pretty-print this code

IMO, the pretty printer is the thing that needs fixing.  If the last token in the pragma is a binary selector symbol literal then a space should be printed.
 

foo
    <func: #operation arg: #+ >
    ^ self

(note the space between #+ and >

Or a bug in the parser ?

this pragma definition
    <func: #operation arg: #a>
seems to work.


_,,,^..^,,,_
best, Eliot
Reply | Threaded
Open this post in threaded view
|

Re: pragma syntax

Nicolai Hess-3-2
Thanks Eliot,

2016-07-26 21:24 GMT+02:00 Eliot Miranda <[hidden email]>:
Hi Nicolai,

On Tue, Jul 26, 2016 at 12:09 PM, Nicolai Hess <[hidden email]> wrote:
Hi,

is this valid pragma syntax:

foo
    <func: #operation arg: #+>
    ^ self

You could say it was ambiguous.  With the change to the syntax of binary selectors in recent years #+> is a binary selector, and so you need whitespace after the token to separate it from the closing >.

I was a bit supprised, why '+>' would be a binary selector, as  for example greater-or-equal is ">=" and not "=>". But I like that we can define (any?) combination as binary selector and create new ones like
=>
==>
or
-->

 


(note the closing angle and the +-symbol)

The above code is what the pretty printer creates if you pretty-print this code

IMO, the pretty printer is the thing that needs fixing.  If the last token in the pragma is a binary selector symbol literal then a space should be printed.

:( yes, but I don't like that we need to insert spaces.
 
 

foo
    <func: #operation arg: #+ >
    ^ self

(note the space between #+ and >

Or a bug in the parser ?

this pragma definition
    <func: #operation arg: #a>
seems to work.


_,,,^..^,,,_
best, Eliot

Reply | Threaded
Open this post in threaded view
|

Re: pragma syntax

Peter Uhnak
So binary selector can be any non-alphanumeric symbol?

On Tue, Jul 26, 2016 at 9:35 PM, Nicolai Hess <[hidden email]> wrote:
Thanks Eliot,

2016-07-26 21:24 GMT+02:00 Eliot Miranda <[hidden email]>:
Hi Nicolai,

On Tue, Jul 26, 2016 at 12:09 PM, Nicolai Hess <[hidden email]> wrote:
Hi,

is this valid pragma syntax:

foo
    <func: #operation arg: #+>
    ^ self

You could say it was ambiguous.  With the change to the syntax of binary selectors in recent years #+> is a binary selector, and so you need whitespace after the token to separate it from the closing >.

I was a bit supprised, why '+>' would be a binary selector, as  for example greater-or-equal is ">=" and not "=>". But I like that we can define (any?) combination as binary selector and create new ones like
=>
==>
or
-->

 


(note the closing angle and the +-symbol)

The above code is what the pretty printer creates if you pretty-print this code

IMO, the pretty printer is the thing that needs fixing.  If the last token in the pragma is a binary selector symbol literal then a space should be printed.

:( yes, but I don't like that we need to insert spaces.
 
 

foo
    <func: #operation arg: #+ >
    ^ self

(note the space between #+ and >

Or a bug in the parser ?

this pragma definition
    <func: #operation arg: #a>
seems to work.


_,,,^..^,,,_
best, Eliot


cbc
Reply | Threaded
Open this post in threaded view
|

Re: pragma syntax

cbc
I would hope there are exceptions - at least $. and $; .  
Otherwise mass chaos would ensue.

Search for the method #initializeTypeTable.  That should steer you towards what can be in a binary method (everything not specifically called out as something besides #xBinary).

-cbc

On Tue, Jul 26, 2016 at 1:12 PM, Peter Uhnák <[hidden email]> wrote:
So binary selector can be any non-alphanumeric symbol?

On Tue, Jul 26, 2016 at 9:35 PM, Nicolai Hess <[hidden email]> wrote:
Thanks Eliot,

2016-07-26 21:24 GMT+02:00 Eliot Miranda <[hidden email]>:
Hi Nicolai,

On Tue, Jul 26, 2016 at 12:09 PM, Nicolai Hess <[hidden email]> wrote:
Hi,

is this valid pragma syntax:

foo
    <func: #operation arg: #+>
    ^ self

You could say it was ambiguous.  With the change to the syntax of binary selectors in recent years #+> is a binary selector, and so you need whitespace after the token to separate it from the closing >.

I was a bit supprised, why '+>' would be a binary selector, as  for example greater-or-equal is ">=" and not "=>". But I like that we can define (any?) combination as binary selector and create new ones like
=>
==>
or
-->

 


(note the closing angle and the +-symbol)

The above code is what the pretty printer creates if you pretty-print this code

IMO, the pretty printer is the thing that needs fixing.  If the last token in the pragma is a binary selector symbol literal then a space should be printed.

:( yes, but I don't like that we need to insert spaces.
 
 

foo
    <func: #operation arg: #+ >
    ^ self

(note the space between #+ and >

Or a bug in the parser ?

this pragma definition
    <func: #operation arg: #a>
seems to work.


_,,,^..^,,,_
best, Eliot