Legitimate syntax for # ... foo

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

Legitimate syntax for # ... foo

Igor Stasenko
# "helllooo" foo

prints
#foo

is this correct?

--
Best regards,
Igor Stasenko AKA sig.

_______________________________________________
Pharo-project mailing list
[hidden email]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
Reply | Threaded
Open this post in threaded view
|

Re: Legitimate syntax for # ... foo

Lukas Renggli
> # "helllooo" foo
>
> prints
> #foo
>
> is this correct?

Probably not, but the standard compiler accepts it. So I had to patch
the parser of the refactoring engine to accept a whole series of
degraded constructs. Below a small collection of tests documenting
some of these strange things:

testSymbolLiteral
        | tree |
        #(('# foo' #foo) ('#"bar"foo' #foo) ('##foo' #foo) ('###foo' #foo)
('#foo:' #foo:) ('#foo::' #'foo::') ('#foo::bar' #'foo::bar')
('#foo::bar:' #'foo::bar:') ('#foo::bar::' #'foo::bar::')) do: [ :pair
|
                tree := RBParser parseExpression: pair first.
                self assert: tree value = pair second.
                self assert: tree start = 1.
                self assert: tree stop = pair first size ]

testStatements
        | tree |
        #(('' 0 0) ('.' 0 1) ('| bar |' 0 0) ('| bar | .' 0 1) ('| bar | ..'
0 2) ('foo. bar' 2 1) ('foo. bar.' 2 2) ('foo. bar. .' 2 3) ('. foo.
bar' 2 2)) do: [ :each |
                tree := RBParser parseExpression: each first.
                self assert: tree statements size = each second.
                self assert: tree periods size = each last ]

testNumberParsing
        | numbers node |
        numbers := #(('1' 1) ('-1' -1) ('123' 123) ('123' 123) ('-123' -123)
('1.1' 1.1) ('-1.1' -1.1) ('1.23' 1.23) ('-1.23' -1.23) ('1e3' 1e3)
('1d3' 1d3) ('1q3' 1q3) ('-1e3' -1e3) ('1e-3' 1e-3) ('-1e-3' -1e-3)
('2r1e8'  2r1e8) ('-2r1e8' -2r1e8) ('2r1e-8' 2r1e-8) ('-2r1e-8'
-2r1e-8) ('0.50s2' 0.50s2) ('0.500s3' 0.500s3) ('0.050s3' 0.050s3)).
        numbers do: [ :spec |
                node := RBParser parseExpression: spec first.
                self assert: node token source = spec first.
                self assert: node value = spec second ]

Lukas

--
Lukas Renggli
www.lukas-renggli.ch

_______________________________________________
Pharo-project mailing list
[hidden email]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
Reply | Threaded
Open this post in threaded view
|

Re: Legitimate syntax for # ... foo

Lukas Renggli
Actually I didn't have all the latest code loaded in the open image.
There is more, hold your breath:

testSymbolNumbers
        #(('#1' 1) ('#12' 12) ('#12.3' 12.3) ('# 1' 1) ('##1' 1) ('#"bar"1'
1)) do: [ :pair |
                tree := RBParser parseExpression: pair first.
                self assert: tree value = pair second.
                self assert: tree start > 1.
                self assert: tree stop = pair first size ]

On 29 April 2010 21:12, Lukas Renggli <[hidden email]> wrote:

>> # "helllooo" foo
>>
>> prints
>> #foo
>>
>> is this correct?
>
> Probably not, but the standard compiler accepts it. So I had to patch
> the parser of the refactoring engine to accept a whole series of
> degraded constructs. Below a small collection of tests documenting
> some of these strange things:
>
> testSymbolLiteral
>        | tree |
>        #(('# foo' #foo) ('#"bar"foo' #foo) ('##foo' #foo) ('###foo' #foo)
> ('#foo:' #foo:) ('#foo::' #'foo::') ('#foo::bar' #'foo::bar')
> ('#foo::bar:' #'foo::bar:') ('#foo::bar::' #'foo::bar::')) do: [ :pair
> |
>                tree := RBParser parseExpression: pair first.
>                self assert: tree value = pair second.
>                self assert: tree start = 1.
>                self assert: tree stop = pair first size ]
>
> testStatements
>        | tree |
>        #(('' 0 0) ('.' 0 1) ('| bar |' 0 0) ('| bar | .' 0 1) ('| bar | ..'
> 0 2) ('foo. bar' 2 1) ('foo. bar.' 2 2) ('foo. bar. .' 2 3) ('. foo.
> bar' 2 2)) do: [ :each |
>                tree := RBParser parseExpression: each first.
>                self assert: tree statements size = each second.
>                self assert: tree periods size = each last ]
>
> testNumberParsing
>        | numbers node |
>        numbers := #(('1' 1) ('-1' -1) ('123' 123) ('123' 123) ('-123' -123)
> ('1.1' 1.1) ('-1.1' -1.1) ('1.23' 1.23) ('-1.23' -1.23) ('1e3' 1e3)
> ('1d3' 1d3) ('1q3' 1q3) ('-1e3' -1e3) ('1e-3' 1e-3) ('-1e-3' -1e-3)
> ('2r1e8'  2r1e8) ('-2r1e8' -2r1e8) ('2r1e-8' 2r1e-8) ('-2r1e-8'
> -2r1e-8) ('0.50s2' 0.50s2) ('0.500s3' 0.500s3) ('0.050s3' 0.050s3)).
>        numbers do: [ :spec |
>                node := RBParser parseExpression: spec first.
>                self assert: node token source = spec first.
>                self assert: node value = spec second ]
>
> Lukas
>
> --
> Lukas Renggli
> www.lukas-renggli.ch
>



--
Lukas Renggli
www.lukas-renggli.ch

_______________________________________________
Pharo-project mailing list
[hidden email]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
Reply | Threaded
Open this post in threaded view
|

Re: Legitimate syntax for # ... foo

Stéphane Ducasse
In reply to this post by Lukas Renggli
arghhhhhhhhhhhhhhhhhhhhhhh
may be one day we should clean that too.

> testSymbolLiteral
> | tree |
> #(('# foo' #foo) ('#"bar"foo' #foo) ('##foo' #foo) ('###foo' #foo)
> ('#foo:' #foo:) ('#foo::' #'foo::') ('#foo::bar' #'foo::bar')
> ('#foo::bar:' #'foo::bar:') ('#foo::bar::' #'foo::bar::')) do: [ :pair
> |
> tree := RBParser parseExpression: pair first.
> self assert: tree value = pair second.
> self assert: tree start = 1.
> self assert: tree stop = pair first size ]

the string and symbols mixture is not good.
#'hkjh 3' is ok and all the rest looks ugly to me.


> testStatements
> | tree |
> #(('' 0 0) ('.' 0 1) ('| bar |' 0 0) ('| bar | .' 0 1) ('| bar | ..'
> 0 2) ('foo. bar' 2 1) ('foo. bar.' 2 2) ('foo. bar. .' 2 3) ('. foo.
> bar' 2 2)) do: [ :each |
> tree := RBParser parseExpression: each first.
> self assert: tree statements size = each second.
> self assert: tree periods size = each last ]
>
> testNumberParsing
> | numbers node |
> numbers := #(('1' 1) ('-1' -1) ('123' 123) ('123' 123) ('-123' -123)
> ('1.1' 1.1) ('-1.1' -1.1) ('1.23' 1.23) ('-1.23' -1.23) ('1e3' 1e3)
> ('1d3' 1d3) ('1q3' 1q3) ('-1e3' -1e3) ('1e-3' 1e-3) ('-1e-3' -1e-3)
> ('2r1e8'  2r1e8) ('-2r1e8' -2r1e8) ('2r1e-8' 2r1e-8) ('-2r1e-8'
> -2r1e-8) ('0.50s2' 0.50s2) ('0.500s3' 0.500s3) ('0.050s3' 0.050s3)).
> numbers do: [ :spec |
> node := RBParser parseExpression: spec first.
> self assert: node token source = spec first.
> self assert: node value = spec second ]
>
> Lukas
>
> --
> Lukas Renggli
> www.lukas-renggli.ch
>
> _______________________________________________
> Pharo-project mailing list
> [hidden email]
> http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project


_______________________________________________
Pharo-project mailing list
[hidden email]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
Reply | Threaded
Open this post in threaded view
|

Re: Legitimate syntax for # ... foo

Nicolas Cellier
In reply to this post by Lukas Renggli
I don't think any other st dialect would accept that syntax but Squeak.
It's just how the parser/scanner works now, but It wouldn't break much
code IMO if we stop supporting these weirdnesses.

Nicolas

2010/4/29 Lukas Renggli <[hidden email]>:

> Actually I didn't have all the latest code loaded in the open image.
> There is more, hold your breath:
>
> testSymbolNumbers
>        #(('#1' 1) ('#12' 12) ('#12.3' 12.3) ('# 1' 1) ('##1' 1) ('#"bar"1'
> 1)) do: [ :pair |
>                tree := RBParser parseExpression: pair first.
>                self assert: tree value = pair second.
>                self assert: tree start > 1.
>                self assert: tree stop = pair first size ]
>
> On 29 April 2010 21:12, Lukas Renggli <[hidden email]> wrote:
>>> # "helllooo" foo
>>>
>>> prints
>>> #foo
>>>
>>> is this correct?
>>
>> Probably not, but the standard compiler accepts it. So I had to patch
>> the parser of the refactoring engine to accept a whole series of
>> degraded constructs. Below a small collection of tests documenting
>> some of these strange things:
>>
>> testSymbolLiteral
>>        | tree |
>>        #(('# foo' #foo) ('#"bar"foo' #foo) ('##foo' #foo) ('###foo' #foo)
>> ('#foo:' #foo:) ('#foo::' #'foo::') ('#foo::bar' #'foo::bar')
>> ('#foo::bar:' #'foo::bar:') ('#foo::bar::' #'foo::bar::')) do: [ :pair
>> |
>>                tree := RBParser parseExpression: pair first.
>>                self assert: tree value = pair second.
>>                self assert: tree start = 1.
>>                self assert: tree stop = pair first size ]
>>
>> testStatements
>>        | tree |
>>        #(('' 0 0) ('.' 0 1) ('| bar |' 0 0) ('| bar | .' 0 1) ('| bar | ..'
>> 0 2) ('foo. bar' 2 1) ('foo. bar.' 2 2) ('foo. bar. .' 2 3) ('. foo.
>> bar' 2 2)) do: [ :each |
>>                tree := RBParser parseExpression: each first.
>>                self assert: tree statements size = each second.
>>                self assert: tree periods size = each last ]
>>
>> testNumberParsing
>>        | numbers node |
>>        numbers := #(('1' 1) ('-1' -1) ('123' 123) ('123' 123) ('-123' -123)
>> ('1.1' 1.1) ('-1.1' -1.1) ('1.23' 1.23) ('-1.23' -1.23) ('1e3' 1e3)
>> ('1d3' 1d3) ('1q3' 1q3) ('-1e3' -1e3) ('1e-3' 1e-3) ('-1e-3' -1e-3)
>> ('2r1e8'  2r1e8) ('-2r1e8' -2r1e8) ('2r1e-8' 2r1e-8) ('-2r1e-8'
>> -2r1e-8) ('0.50s2' 0.50s2) ('0.500s3' 0.500s3) ('0.050s3' 0.050s3)).
>>        numbers do: [ :spec |
>>                node := RBParser parseExpression: spec first.
>>                self assert: node token source = spec first.
>>                self assert: node value = spec second ]
>>
>> Lukas
>>
>> --
>> Lukas Renggli
>> www.lukas-renggli.ch
>>
>
>
>
> --
> Lukas Renggli
> www.lukas-renggli.ch
>
> _______________________________________________
> Pharo-project mailing list
> [hidden email]
> http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
>

_______________________________________________
Pharo-project mailing list
[hidden email]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
Reply | Threaded
Open this post in threaded view
|

Re: Legitimate syntax for # ... foo

Stéphane Ducasse
I would really like to get rid of that.
It makes everything looking so brittle.

Stef

On Apr 29, 2010, at 9:50 PM, Nicolas Cellier wrote:

> I don't think any other st dialect would accept that syntax but Squeak.
> It's just how the parser/scanner works now, but It wouldn't break much
> code IMO if we stop supporting these weirdnesses.
>
> Nicolas
>
> 2010/4/29 Lukas Renggli <[hidden email]>:
>> Actually I didn't have all the latest code loaded in the open image.
>> There is more, hold your breath:
>>
>> testSymbolNumbers
>>        #(('#1' 1) ('#12' 12) ('#12.3' 12.3) ('# 1' 1) ('##1' 1) ('#"bar"1'
>> 1)) do: [ :pair |
>>                tree := RBParser parseExpression: pair first.
>>                self assert: tree value = pair second.
>>                self assert: tree start > 1.
>>                self assert: tree stop = pair first size ]
>>
>> On 29 April 2010 21:12, Lukas Renggli <[hidden email]> wrote:
>>>> # "helllooo" foo
>>>>
>>>> prints
>>>> #foo
>>>>
>>>> is this correct?
>>>
>>> Probably not, but the standard compiler accepts it. So I had to patch
>>> the parser of the refactoring engine to accept a whole series of
>>> degraded constructs. Below a small collection of tests documenting
>>> some of these strange things:
>>>
>>> testSymbolLiteral
>>>        | tree |
>>>        #(('# foo' #foo) ('#"bar"foo' #foo) ('##foo' #foo) ('###foo' #foo)
>>> ('#foo:' #foo:) ('#foo::' #'foo::') ('#foo::bar' #'foo::bar')
>>> ('#foo::bar:' #'foo::bar:') ('#foo::bar::' #'foo::bar::')) do: [ :pair
>>> |
>>>                tree := RBParser parseExpression: pair first.
>>>                self assert: tree value = pair second.
>>>                self assert: tree start = 1.
>>>                self assert: tree stop = pair first size ]
>>>
>>> testStatements
>>>        | tree |
>>>        #(('' 0 0) ('.' 0 1) ('| bar |' 0 0) ('| bar | .' 0 1) ('| bar | ..'
>>> 0 2) ('foo. bar' 2 1) ('foo. bar.' 2 2) ('foo. bar. .' 2 3) ('. foo.
>>> bar' 2 2)) do: [ :each |
>>>                tree := RBParser parseExpression: each first.
>>>                self assert: tree statements size = each second.
>>>                self assert: tree periods size = each last ]
>>>
>>> testNumberParsing
>>>        | numbers node |
>>>        numbers := #(('1' 1) ('-1' -1) ('123' 123) ('123' 123) ('-123' -123)
>>> ('1.1' 1.1) ('-1.1' -1.1) ('1.23' 1.23) ('-1.23' -1.23) ('1e3' 1e3)
>>> ('1d3' 1d3) ('1q3' 1q3) ('-1e3' -1e3) ('1e-3' 1e-3) ('-1e-3' -1e-3)
>>> ('2r1e8'  2r1e8) ('-2r1e8' -2r1e8) ('2r1e-8' 2r1e-8) ('-2r1e-8'
>>> -2r1e-8) ('0.50s2' 0.50s2) ('0.500s3' 0.500s3) ('0.050s3' 0.050s3)).
>>>        numbers do: [ :spec |
>>>                node := RBParser parseExpression: spec first.
>>>                self assert: node token source = spec first.
>>>                self assert: node value = spec second ]
>>>
>>> Lukas
>>>
>>> --
>>> Lukas Renggli
>>> www.lukas-renggli.ch
>>>
>>
>>
>>
>> --
>> Lukas Renggli
>> www.lukas-renggli.ch
>>
>> _______________________________________________
>> Pharo-project mailing list
>> [hidden email]
>> http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
>>
>
> _______________________________________________
> Pharo-project mailing list
> [hidden email]
> http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project


_______________________________________________
Pharo-project mailing list
[hidden email]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
Reply | Threaded
Open this post in threaded view
|

Re: Legitimate syntax for # ... foo

Eliot Miranda-2
In reply to this post by Nicolas Cellier


On Thu, Apr 29, 2010 at 12:50 PM, Nicolas Cellier <[hidden email]> wrote:
I don't think any other st dialect would accept that syntax but Squeak.

VisualWorks accepts it just fine.

# "hello" foo => #foo

# "hello" (foo # "hello" foo) => #(#foo #foo) 

I think this is the way the language works.  Relax.  Celebrate its weirdness.  Don't sweat the petty stuff, pet the sweaty stuff:


It's just how the parser/scanner works now, but It wouldn't break much
code IMO if we stop supporting these weirdnesses.

Nicolas

2010/4/29 Lukas Renggli <[hidden email]>:
> Actually I didn't have all the latest code loaded in the open image.
> There is more, hold your breath:
>
> testSymbolNumbers
>        #(('#1' 1) ('#12' 12) ('#12.3' 12.3) ('# 1' 1) ('##1' 1) ('#"bar"1'
> 1)) do: [ :pair |
>                tree := RBParser parseExpression: pair first.
>                self assert: tree value = pair second.
>                self assert: tree start > 1.
>                self assert: tree stop = pair first size ]
>
> On 29 April 2010 21:12, Lukas Renggli <[hidden email]> wrote:
>>> # "helllooo" foo
>>>
>>> prints
>>> #foo
>>>
>>> is this correct?
>>
>> Probably not, but the standard compiler accepts it. So I had to patch
>> the parser of the refactoring engine to accept a whole series of
>> degraded constructs. Below a small collection of tests documenting
>> some of these strange things:
>>
>> testSymbolLiteral
>>        | tree |
>>        #(('# foo' #foo) ('#"bar"foo' #foo) ('##foo' #foo) ('###foo' #foo)
>> ('#foo:' #foo:) ('#foo::' #'foo::') ('#foo::bar' #'foo::bar')
>> ('#foo::bar:' #'foo::bar:') ('#foo::bar::' #'foo::bar::')) do: [ :pair
>> |
>>                tree := RBParser parseExpression: pair first.
>>                self assert: tree value = pair second.
>>                self assert: tree start = 1.
>>                self assert: tree stop = pair first size ]
>>
>> testStatements
>>        | tree |
>>        #(('' 0 0) ('.' 0 1) ('| bar |' 0 0) ('| bar | .' 0 1) ('| bar | ..'
>> 0 2) ('foo. bar' 2 1) ('foo. bar.' 2 2) ('foo. bar. .' 2 3) ('. foo.
>> bar' 2 2)) do: [ :each |
>>                tree := RBParser parseExpression: each first.
>>                self assert: tree statements size = each second.
>>                self assert: tree periods size = each last ]
>>
>> testNumberParsing
>>        | numbers node |
>>        numbers := #(('1' 1) ('-1' -1) ('123' 123) ('123' 123) ('-123' -123)
>> ('1.1' 1.1) ('-1.1' -1.1) ('1.23' 1.23) ('-1.23' -1.23) ('1e3' 1e3)
>> ('1d3' 1d3) ('1q3' 1q3) ('-1e3' -1e3) ('1e-3' 1e-3) ('-1e-3' -1e-3)
>> ('2r1e8'  2r1e8) ('-2r1e8' -2r1e8) ('2r1e-8' 2r1e-8) ('-2r1e-8'
>> -2r1e-8) ('0.50s2' 0.50s2) ('0.500s3' 0.500s3) ('0.050s3' 0.050s3)).
>>        numbers do: [ :spec |
>>                node := RBParser parseExpression: spec first.
>>                self assert: node token source = spec first.
>>                self assert: node value = spec second ]
>>
>> Lukas
>>
>> --
>> Lukas Renggli
>> www.lukas-renggli.ch
>>
>
>
>
> --
> Lukas Renggli
> www.lukas-renggli.ch
>
> _______________________________________________
> Pharo-project mailing list
> [hidden email]
> http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
>

_______________________________________________
Pharo-project mailing list
[hidden email]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project


_______________________________________________
Pharo-project mailing list
[hidden email]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
Reply | Threaded
Open this post in threaded view
|

Re: Legitimate syntax for # ... foo

Nicolas Cellier
2010/4/29 Eliot Miranda <[hidden email]>:

>
>
> On Thu, Apr 29, 2010 at 12:50 PM, Nicolas Cellier
> <[hidden email]> wrote:
>>
>> I don't think any other st dialect would accept that syntax but Squeak.
>
> VisualWorks accepts it just fine.
> # "hello" foo => #foo
> # "hello" (foo # "hello" foo) => #(#foo #foo)
> I think this is the way the language works.  Relax.  Celebrate its
> weirdness.  Don't sweat the petty stuff, pet the sweaty stuff:
> http://www.popsci.com/gadgets/article/2010-04/exclusive-making-elements-one-ipads-most-magical-apps

Maybe I should relax about comment anywhere, but these:

[Compiler evaluate: '#( # 2 # -2 )'] on: Error do: [:exc | exc return: nil].
[Compiler evaluate: '# -2'] on: Error do: [:exc | exc return: nil].
[Compiler evaluate: '#-2'] on: Error do: [:exc | exc return: nil].
[Compiler evaluate: '#$a'] on: Error do: [:exc | exc return: nil].
[Compiler evaluate: '##(1##)1)'] on: Error do: [:exc | exc return: nil].

would all return nil in VW, not so in Squeak.
Also, I mind the difference of first two in Squeak.
That's hardly predictable and much too weird to my own taste...

Nicolas

>>
>> It's just how the parser/scanner works now, but It wouldn't break much
>> code IMO if we stop supporting these weirdnesses.
>>
>> Nicolas
>>
>> 2010/4/29 Lukas Renggli <[hidden email]>:
>> > Actually I didn't have all the latest code loaded in the open image.
>> > There is more, hold your breath:
>> >
>> > testSymbolNumbers
>> >        #(('#1' 1) ('#12' 12) ('#12.3' 12.3) ('# 1' 1) ('##1' 1)
>> > ('#"bar"1'
>> > 1)) do: [ :pair |
>> >                tree := RBParser parseExpression: pair first.
>> >                self assert: tree value = pair second.
>> >                self assert: tree start > 1.
>> >                self assert: tree stop = pair first size ]
>> >
>> > On 29 April 2010 21:12, Lukas Renggli <[hidden email]> wrote:
>> >>> # "helllooo" foo
>> >>>
>> >>> prints
>> >>> #foo
>> >>>
>> >>> is this correct?
>> >>
>> >> Probably not, but the standard compiler accepts it. So I had to patch
>> >> the parser of the refactoring engine to accept a whole series of
>> >> degraded constructs. Below a small collection of tests documenting
>> >> some of these strange things:
>> >>
>> >> testSymbolLiteral
>> >>        | tree |
>> >>        #(('# foo' #foo) ('#"bar"foo' #foo) ('##foo' #foo) ('###foo'
>> >> #foo)
>> >> ('#foo:' #foo:) ('#foo::' #'foo::') ('#foo::bar' #'foo::bar')
>> >> ('#foo::bar:' #'foo::bar:') ('#foo::bar::' #'foo::bar::')) do: [ :pair
>> >> |
>> >>                tree := RBParser parseExpression: pair first.
>> >>                self assert: tree value = pair second.
>> >>                self assert: tree start = 1.
>> >>                self assert: tree stop = pair first size ]
>> >>
>> >> testStatements
>> >>        | tree |
>> >>        #(('' 0 0) ('.' 0 1) ('| bar |' 0 0) ('| bar | .' 0 1) ('| bar |
>> >> ..'
>> >> 0 2) ('foo. bar' 2 1) ('foo. bar.' 2 2) ('foo. bar. .' 2 3) ('. foo.
>> >> bar' 2 2)) do: [ :each |
>> >>                tree := RBParser parseExpression: each first.
>> >>                self assert: tree statements size = each second.
>> >>                self assert: tree periods size = each last ]
>> >>
>> >> testNumberParsing
>> >>        | numbers node |
>> >>        numbers := #(('1' 1) ('-1' -1) ('123' 123) ('123' 123) ('-123'
>> >> -123)
>> >> ('1.1' 1.1) ('-1.1' -1.1) ('1.23' 1.23) ('-1.23' -1.23) ('1e3' 1e3)
>> >> ('1d3' 1d3) ('1q3' 1q3) ('-1e3' -1e3) ('1e-3' 1e-3) ('-1e-3' -1e-3)
>> >> ('2r1e8'  2r1e8) ('-2r1e8' -2r1e8) ('2r1e-8' 2r1e-8) ('-2r1e-8'
>> >> -2r1e-8) ('0.50s2' 0.50s2) ('0.500s3' 0.500s3) ('0.050s3' 0.050s3)).
>> >>        numbers do: [ :spec |
>> >>                node := RBParser parseExpression: spec first.
>> >>                self assert: node token source = spec first.
>> >>                self assert: node value = spec second ]
>> >>
>> >> Lukas
>> >>
>> >> --
>> >> Lukas Renggli
>> >> www.lukas-renggli.ch
>> >>
>> >
>> >
>> >
>> > --
>> > Lukas Renggli
>> > www.lukas-renggli.ch
>> >
>> > _______________________________________________
>> > Pharo-project mailing list
>> > [hidden email]
>> > http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
>> >
>>
>> _______________________________________________
>> Pharo-project mailing list
>> [hidden email]
>> http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
>
>
> _______________________________________________
> Pharo-project mailing list
> [hidden email]
> http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
>

_______________________________________________
Pharo-project mailing list
[hidden email]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
Reply | Threaded
Open this post in threaded view
|

Re: Legitimate syntax for # ... foo

Stéphane Ducasse
In reply to this post by Eliot Miranda-2
Eliot cleaning some left over or glitches is always good.
I think that this is what nicolas wanted to say.
like ###f -> #f we could use that for another syntactic extension.
#12 -> 12 is not really nice.
or #foo::bar:

Stef

> VisualWorks accepts it just fine.
>
> # "hello" foo => #foo
>
> # "hello" (foo # "hello" foo) => #(#foo #foo)
>
>
> It's just how the parser/scanner works now, but It wouldn't break much
> code IMO if we stop supporting these weirdnesses.
>
> Nicolas
>
> 2010/4/29 Lukas Renggli <[hidden email]>:
> > Actually I didn't have all the latest code loaded in the open image.
> > There is more, hold your breath:
> >
> > testSymbolNumbers
> >        #(('#1' 1) ('#12' 12) ('#12.3' 12.3) ('# 1' 1) ('##1' 1) ('#"bar"1'
> > 1)) do: [ :pair |
> >                tree := RBParser parseExpression: pair first.
> >                self assert: tree value = pair second.
> >                self assert: tree start > 1.
> >                self assert: tree stop = pair first size ]
> >
> > On 29 April 2010 21:12, Lukas Renggli <[hidden email]> wrote:
> >>> # "helllooo" foo
> >>>
> >>> prints
> >>> #foo
> >>>
> >>> is this correct?
> >>
> >> Probably not, but the standard compiler accepts it. So I had to patch
> >> the parser of the refactoring engine to accept a whole series of
> >> degraded constructs. Below a small collection of tests documenting
> >> some of these strange things:
> >>
> >> testSymbolLiteral
> >>        | tree |
> >>        #(('# foo' #foo) ('#"bar"foo' #foo) ('##foo' #foo) ('###foo' #foo)
> >> ('#foo:' #foo:) ('#foo::' #'foo::') ('#foo::bar' #'foo::bar')
> >> ('#foo::bar:' #'foo::bar:') ('#foo::bar::' #'foo::bar::')) do: [ :pair
> >> |
> >>                tree := RBParser parseExpression: pair first.
> >>                self assert: tree value = pair second.
> >>                self assert: tree start = 1.
> >>                self assert: tree stop = pair first size ]
> >>
> >> testStatements
> >>        | tree |
> >>        #(('' 0 0) ('.' 0 1) ('| bar |' 0 0) ('| bar | .' 0 1) ('| bar | ..'
> >> 0 2) ('foo. bar' 2 1) ('foo. bar.' 2 2) ('foo. bar. .' 2 3) ('. foo.
> >> bar' 2 2)) do: [ :each |
> >>                tree := RBParser parseExpression: each first.
> >>                self assert: tree statements size = each second.
> >>                self assert: tree periods size = each last ]
> >>
> >> testNumberParsing
> >>        | numbers node |
> >>        numbers := #(('1' 1) ('-1' -1) ('123' 123) ('123' 123) ('-123' -123)
> >> ('1.1' 1.1) ('-1.1' -1.1) ('1.23' 1.23) ('-1.23' -1.23) ('1e3' 1e3)
> >> ('1d3' 1d3) ('1q3' 1q3) ('-1e3' -1e3) ('1e-3' 1e-3) ('-1e-3' -1e-3)
> >> ('2r1e8'  2r1e8) ('-2r1e8' -2r1e8) ('2r1e-8' 2r1e-8) ('-2r1e-8'
> >> -2r1e-8) ('0.50s2' 0.50s2) ('0.500s3' 0.500s3) ('0.050s3' 0.050s3)).
> >>        numbers do: [ :spec |
> >>                node := RBParser parseExpression: spec first.
> >>                self assert: node token source = spec first.
> >>                self assert: node value = spec second ]
> >>
> >> Lukas
> >>
> >> --
> >> Lukas Renggli
> >> www.lukas-renggli.ch
> >>
> >
> >
> >
> > --
> > Lukas Renggli
> > www.lukas-renggli.ch
> >
> > _______________________________________________
> > Pharo-project mailing list
> > [hidden email]
> > http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
> >
>
> _______________________________________________
> Pharo-project mailing list
> [hidden email]
> http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
>
> _______________________________________________
> Pharo-project mailing list
> [hidden email]
> http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project


_______________________________________________
Pharo-project mailing list
[hidden email]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
Reply | Threaded
Open this post in threaded view
|

Re: Legitimate syntax for # ... foo

Eliot Miranda-2
In reply to this post by Nicolas Cellier


On Thu, Apr 29, 2010 at 1:25 PM, Nicolas Cellier <[hidden email]> wrote:
2010/4/29 Eliot Miranda <[hidden email]>:
>
>
> On Thu, Apr 29, 2010 at 12:50 PM, Nicolas Cellier
> <[hidden email]> wrote:
>>
>> I don't think any other st dialect would accept that syntax but Squeak.
>
> VisualWorks accepts it just fine.
> # "hello" foo => #foo
> # "hello" (foo # "hello" foo) => #(#foo #foo)
> I think this is the way the language works.  Relax.  Celebrate its
> weirdness.  Don't sweat the petty stuff, pet the sweaty stuff:
> http://www.popsci.com/gadgets/article/2010-04/exclusive-making-elements-one-ipads-most-magical-apps

Maybe I should relax about comment anywhere, but these:

[Compiler evaluate: '#( # 2 # -2 )'] on: Error do: [:exc | exc return: nil].
[Compiler evaluate: '# -2'] on: Error do: [:exc | exc return: nil].
[Compiler evaluate: '#-2'] on: Error do: [:exc | exc return: nil].
[Compiler evaluate: '#$a'] on: Error do: [:exc | exc return: nil].
[Compiler evaluate: '##(1##)1)'] on: Error do: [:exc | exc return: nil].

would all return nil in VW, not so in Squeak.
Also, I mind the difference of first two in Squeak.
That's hardly predictable and much too weird to my own taste...

That's fair enough, but that's a different issue to there being allowable whitespace between the literal hash and the literal.  In any case, comparing against VW is probably a sensible thing to do.

best
Eliot


Nicolas

>>
>> It's just how the parser/scanner works now, but It wouldn't break much
>> code IMO if we stop supporting these weirdnesses.
>>
>> Nicolas
>>
>> 2010/4/29 Lukas Renggli <[hidden email]>:
>> > Actually I didn't have all the latest code loaded in the open image.
>> > There is more, hold your breath:
>> >
>> > testSymbolNumbers
>> >        #(('#1' 1) ('#12' 12) ('#12.3' 12.3) ('# 1' 1) ('##1' 1)
>> > ('#"bar"1'
>> > 1)) do: [ :pair |
>> >                tree := RBParser parseExpression: pair first.
>> >                self assert: tree value = pair second.
>> >                self assert: tree start > 1.
>> >                self assert: tree stop = pair first size ]
>> >
>> > On 29 April 2010 21:12, Lukas Renggli <[hidden email]> wrote:
>> >>> # "helllooo" foo
>> >>>
>> >>> prints
>> >>> #foo
>> >>>
>> >>> is this correct?
>> >>
>> >> Probably not, but the standard compiler accepts it. So I had to patch
>> >> the parser of the refactoring engine to accept a whole series of
>> >> degraded constructs. Below a small collection of tests documenting
>> >> some of these strange things:
>> >>
>> >> testSymbolLiteral
>> >>        | tree |
>> >>        #(('# foo' #foo) ('#"bar"foo' #foo) ('##foo' #foo) ('###foo'
>> >> #foo)
>> >> ('#foo:' #foo:) ('#foo::' #'foo::') ('#foo::bar' #'foo::bar')
>> >> ('#foo::bar:' #'foo::bar:') ('#foo::bar::' #'foo::bar::')) do: [ :pair
>> >> |
>> >>                tree := RBParser parseExpression: pair first.
>> >>                self assert: tree value = pair second.
>> >>                self assert: tree start = 1.
>> >>                self assert: tree stop = pair first size ]
>> >>
>> >> testStatements
>> >>        | tree |
>> >>        #(('' 0 0) ('.' 0 1) ('| bar |' 0 0) ('| bar | .' 0 1) ('| bar |
>> >> ..'
>> >> 0 2) ('foo. bar' 2 1) ('foo. bar.' 2 2) ('foo. bar. .' 2 3) ('. foo.
>> >> bar' 2 2)) do: [ :each |
>> >>                tree := RBParser parseExpression: each first.
>> >>                self assert: tree statements size = each second.
>> >>                self assert: tree periods size = each last ]
>> >>
>> >> testNumberParsing
>> >>        | numbers node |
>> >>        numbers := #(('1' 1) ('-1' -1) ('123' 123) ('123' 123) ('-123'
>> >> -123)
>> >> ('1.1' 1.1) ('-1.1' -1.1) ('1.23' 1.23) ('-1.23' -1.23) ('1e3' 1e3)
>> >> ('1d3' 1d3) ('1q3' 1q3) ('-1e3' -1e3) ('1e-3' 1e-3) ('-1e-3' -1e-3)
>> >> ('2r1e8'  2r1e8) ('-2r1e8' -2r1e8) ('2r1e-8' 2r1e-8) ('-2r1e-8'
>> >> -2r1e-8) ('0.50s2' 0.50s2) ('0.500s3' 0.500s3) ('0.050s3' 0.050s3)).
>> >>        numbers do: [ :spec |
>> >>                node := RBParser parseExpression: spec first.
>> >>                self assert: node token source = spec first.
>> >>                self assert: node value = spec second ]
>> >>
>> >> Lukas
>> >>
>> >> --
>> >> Lukas Renggli
>> >> www.lukas-renggli.ch
>> >>
>> >
>> >
>> >
>> > --
>> > Lukas Renggli
>> > www.lukas-renggli.ch
>> >
>> > _______________________________________________
>> > Pharo-project mailing list
>> > [hidden email]
>> > http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
>> >
>>
>> _______________________________________________
>> Pharo-project mailing list
>> [hidden email]
>> http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
>
>
> _______________________________________________
> Pharo-project mailing list
> [hidden email]
> http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
>

_______________________________________________
Pharo-project mailing list
[hidden email]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project


_______________________________________________
Pharo-project mailing list
[hidden email]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
Reply | Threaded
Open this post in threaded view
|

Re: Legitimate syntax for # ... foo

Nicolas Cellier
2010/4/29 Eliot Miranda <[hidden email]>:

>
>
> On Thu, Apr 29, 2010 at 1:25 PM, Nicolas Cellier
> <[hidden email]> wrote:
>>
>> 2010/4/29 Eliot Miranda <[hidden email]>:
>> >
>> >
>> > On Thu, Apr 29, 2010 at 12:50 PM, Nicolas Cellier
>> > <[hidden email]> wrote:
>> >>
>> >> I don't think any other st dialect would accept that syntax but Squeak.
>> >
>> > VisualWorks accepts it just fine.
>> > # "hello" foo => #foo
>> > # "hello" (foo # "hello" foo) => #(#foo #foo)
>> > I think this is the way the language works.  Relax.  Celebrate its
>> > weirdness.  Don't sweat the petty stuff, pet the sweaty stuff:
>> >
>> > http://www.popsci.com/gadgets/article/2010-04/exclusive-making-elements-one-ipads-most-magical-apps
>>
>> Maybe I should relax about comment anywhere, but these:
>>
>> [Compiler evaluate: '#( # 2 # -2 )'] on: Error do: [:exc | exc return:
>> nil].
>> [Compiler evaluate: '# -2'] on: Error do: [:exc | exc return: nil].
>> [Compiler evaluate: '#-2'] on: Error do: [:exc | exc return: nil].
>> [Compiler evaluate: '#$a'] on: Error do: [:exc | exc return: nil].
>> [Compiler evaluate: '##(1##)1)'] on: Error do: [:exc | exc return: nil].
>>
>> would all return nil in VW, not so in Squeak.
>> Also, I mind the difference of first two in Squeak.
>> That's hardly predictable and much too weird to my own taste...
>
> That's fair enough, but that's a different issue to there being allowable
> whitespace between the literal hash and the literal.  In any case, comparing
> against VW is probably a sensible thing to do.
> best
> Eliot

Here we go: fix at http://code.google.com/p/pharo/issues/detail?id=2371

Some tests from Lukas would be appreciated :)

Nicolas

>>
>> Nicolas
>>
>> >>
>> >> It's just how the parser/scanner works now, but It wouldn't break much
>> >> code IMO if we stop supporting these weirdnesses.
>> >>
>> >> Nicolas
>> >>
>> >> 2010/4/29 Lukas Renggli <[hidden email]>:
>> >> > Actually I didn't have all the latest code loaded in the open image.
>> >> > There is more, hold your breath:
>> >> >
>> >> > testSymbolNumbers
>> >> >        #(('#1' 1) ('#12' 12) ('#12.3' 12.3) ('# 1' 1) ('##1' 1)
>> >> > ('#"bar"1'
>> >> > 1)) do: [ :pair |
>> >> >                tree := RBParser parseExpression: pair first.
>> >> >                self assert: tree value = pair second.
>> >> >                self assert: tree start > 1.
>> >> >                self assert: tree stop = pair first size ]
>> >> >
>> >> > On 29 April 2010 21:12, Lukas Renggli <[hidden email]> wrote:
>> >> >>> # "helllooo" foo
>> >> >>>
>> >> >>> prints
>> >> >>> #foo
>> >> >>>
>> >> >>> is this correct?
>> >> >>
>> >> >> Probably not, but the standard compiler accepts it. So I had to
>> >> >> patch
>> >> >> the parser of the refactoring engine to accept a whole series of
>> >> >> degraded constructs. Below a small collection of tests documenting
>> >> >> some of these strange things:
>> >> >>
>> >> >> testSymbolLiteral
>> >> >>        | tree |
>> >> >>        #(('# foo' #foo) ('#"bar"foo' #foo) ('##foo' #foo) ('###foo'
>> >> >> #foo)
>> >> >> ('#foo:' #foo:) ('#foo::' #'foo::') ('#foo::bar' #'foo::bar')
>> >> >> ('#foo::bar:' #'foo::bar:') ('#foo::bar::' #'foo::bar::')) do: [
>> >> >> :pair
>> >> >> |
>> >> >>                tree := RBParser parseExpression: pair first.
>> >> >>                self assert: tree value = pair second.
>> >> >>                self assert: tree start = 1.
>> >> >>                self assert: tree stop = pair first size ]
>> >> >>
>> >> >> testStatements
>> >> >>        | tree |
>> >> >>        #(('' 0 0) ('.' 0 1) ('| bar |' 0 0) ('| bar | .' 0 1) ('|
>> >> >> bar |
>> >> >> ..'
>> >> >> 0 2) ('foo. bar' 2 1) ('foo. bar.' 2 2) ('foo. bar. .' 2 3) ('. foo.
>> >> >> bar' 2 2)) do: [ :each |
>> >> >>                tree := RBParser parseExpression: each first.
>> >> >>                self assert: tree statements size = each second.
>> >> >>                self assert: tree periods size = each last ]
>> >> >>
>> >> >> testNumberParsing
>> >> >>        | numbers node |
>> >> >>        numbers := #(('1' 1) ('-1' -1) ('123' 123) ('123' 123)
>> >> >> ('-123'
>> >> >> -123)
>> >> >> ('1.1' 1.1) ('-1.1' -1.1) ('1.23' 1.23) ('-1.23' -1.23) ('1e3' 1e3)
>> >> >> ('1d3' 1d3) ('1q3' 1q3) ('-1e3' -1e3) ('1e-3' 1e-3) ('-1e-3' -1e-3)
>> >> >> ('2r1e8'  2r1e8) ('-2r1e8' -2r1e8) ('2r1e-8' 2r1e-8) ('-2r1e-8'
>> >> >> -2r1e-8) ('0.50s2' 0.50s2) ('0.500s3' 0.500s3) ('0.050s3' 0.050s3)).
>> >> >>        numbers do: [ :spec |
>> >> >>                node := RBParser parseExpression: spec first.
>> >> >>                self assert: node token source = spec first.
>> >> >>                self assert: node value = spec second ]
>> >> >>
>> >> >> Lukas
>> >> >>
>> >> >> --
>> >> >> Lukas Renggli
>> >> >> www.lukas-renggli.ch
>> >> >>
>> >> >
>> >> >
>> >> >
>> >> > --
>> >> > Lukas Renggli
>> >> > www.lukas-renggli.ch
>> >> >
>> >> > _______________________________________________
>> >> > Pharo-project mailing list
>> >> > [hidden email]
>> >> > http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
>> >> >
>> >>
>> >> _______________________________________________
>> >> Pharo-project mailing list
>> >> [hidden email]
>> >> http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
>> >
>> >
>> > _______________________________________________
>> > Pharo-project mailing list
>> > [hidden email]
>> > http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
>> >
>>
>> _______________________________________________
>> Pharo-project mailing list
>> [hidden email]
>> http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
>
>
> _______________________________________________
> Pharo-project mailing list
> [hidden email]
> http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
>

_______________________________________________
Pharo-project mailing list
[hidden email]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
Reply | Threaded
Open this post in threaded view
|

Re: Legitimate syntax for # ... foo

Stéphane Ducasse
THANKS!!!
I'm sure that lukas is occupy to clean his house/repaint the wall/read all the papers he forgot instead of writing his phd that
he will help :D with great enthusiasm.

>>>>> That's fair enough, but that's a different issue to there being allowable
>> whitespace between the literal hash and the literal.  In any case, comparing
>> against VW is probably a sensible thing to do.
>> best
>> Eliot
>
> Here we go: fix at http://code.google.com/p/pharo/issues/detail?id=2371
>
> Some tests from Lukas would be appreciated :)


_______________________________________________
Pharo-project mailing list
[hidden email]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project