[Cuis-dev] Subtle Parser bug?
Hernan Wilkinson
hernan.wilkinson at 10pines.com
Tue Dec 1 02:29:08 PST 2020
In some Smalltalks it is not allowed, for example GemStone... when
uploading code from cuis/squeak/pharo to GemStone is one of the
typical errors you can get.
Cheers!
Hernan
On Mon, Nov 30, 2020 at 9:17 PM Phil B via Cuis-dev <cuis-dev at lists.cuis.st>
wrote:
> I don't think it's technically a bug, just an empty (null?) expression.
> It actually has its uses when you want to 'force' a comment at a specific
> place. So you use it in combination with a comment so that the pretty
> printer doesn't 'fix' things for you and put it where you don't want it.
>
> On Mon, Nov 30, 2020 at 3:12 PM Nicolás Papagna Maldonado <
> nicolas.papagna at gmail.com> wrote:
>
>> Hi Phil!
>>
>> Indeed!
>>
>> I was wondering if that should be allowed in the first place because it
>> is a 'mistake' that the system is allowing you to make (as you mention, the
>> bug is in the code and was compiled just fine).
>>
>> Best,
>> Nico
>>
>>
>> On Mon, Nov 30, 2020 at 4:21 PM Phil B <pbpublist at gmail.com> wrote:
>>
>>> Hi Nico,
>>>
>>> The bug is in your source code ;-) The self is due to the fact that you
>>> have 'foo.' instead of just 'foo' (i.e. you don't need the $. to terminate
>>> your args and any empty expressions in the body, which the trailing $. will
>>> be parsed as, will result in a self).
>>>
>>> Thanks,
>>> Phil
>>>
>>> On Mon, Nov 30, 2020 at 7:59 AM Nicolás Papagna Maldonado via Cuis-dev <
>>> cuis-dev at lists.cuis.st> wrote:
>>>
>>>> Hi folks!
>>>>
>>>> Hope. you're doing fine :)
>>>>
>>>> I ran into this (bug?) yesterday while inspecting existing compiled
>>>> methods at Cuis University.
>>>> Looks like if you parse/compile a method that has a dot after the last
>>>> collaborator in the method signature, an additional *self* node is
>>>> added to the AST.
>>>>
>>>> To reproduce it, in a workspace inspect:
>>>>
>>>> Parser new
>>>> parse: 'm1: foo. ^1'
>>>> class: Object
>>>>
>>>> You'll note that the string representation of the inspected MethodNode
>>>> displays:
>>>>
>>>> m1: foo
>>>> *self.*
>>>> ^ 1.
>>>>
>>>> Is that little *self *node there for a reason, or is it just a bug?
>>>>
>>>> Best,
>>>> Nico PM
>>>> --
>>>> Cuis-dev mailing list
>>>> Cuis-dev at lists.cuis.st
>>>> https://lists.cuis.st/mailman/listinfo/cuis-dev
>>>>
>>>
>>
>> --
>>
>> Nicolás Papagna
>>
> --
> Cuis-dev mailing list
> Cuis-dev at lists.cuis.st
> https://lists.cuis.st/mailman/listinfo/cuis-dev
>
--
*Hernán WilkinsonAgile Software Development, Teaching & Coaching*
*Phone: +54-011*-4893-2057
*Twitter: @HernanWilkinson*
*site: http://www.10Pines.com <http://www.10pines.com/>*
Address: Alem 896, Floor 6, Buenos Aires, Argentina
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.cuis.st/mailman/archives/cuis-dev/attachments/20201201/f500d6b5/attachment-0001.htm>
More information about the Cuis-dev
mailing list