[Cuis-dev] Double colon syntax
Boris Shingarov
shingarov at labware.com
Tue May 17 05:04:39 PDT 2022
I would use caution before I celebrate the double-colon.
(Like the semicolon), it is *adding* stuff instead of *removing*. And
it's not just adding anywhich stuff, it's adding *syntax*, which is
supposed to fit on a postcard. The sad reality is that our syntax is
much more complex than many competitor languages', which manage to
achieve in the library what we do with syntax. (Do we still fit on a
postcard with the double-colon)? I've been thinking about the reasons
why we can't have #; and #:: as selectors (like, say, in Haskell $ does
exactly what :: does in Cuis but $ is just another regular function) and
there is a lot of work ahead of us to make things composable.
On 1/6/22 02:41, Gerald Klix via Cuis-dev wrote:
> Hi,
>
> I use it a lot. For me it is a "logical" or "expected"
> addition to Smalltalk's cascade syntax.
> Smalltalk feels less lispish with it.
> Additionally Haver is full of methods that use it:
>
> --- snip ---
> bear at speedy ~/h/Public-HaverOnCuis> pwd
> /home/bear/hgwork/Public-HaverOnCuis
> bear at speedy ~/h/Public-HaverOnCuis> find -iname '*.st'| wc -l
> 58
> bear at speedy ~/h/Public-HaverOnCuis> find -iname '*.st' | xargs grep -l
> '::' | wc -l
> 51
> --- snip ---
>
> In fact 4 of the 26 CUIS-patches I submitted contain
> double-colon syntax, often in more than one place:
>
> --- snip ---
> bear at speedy ~/g/C/C/CoreUpdates> pwd
> /home/bear/gitwork/Cuis-Smalltalk/Cuis-Smalltalk-Dev/CoreUpdates
> bear at speedy ~/g/C/C/CoreUpdates> ls *Klix* | wc -l
> 26
> bear at speedy ~/g/C/C/CoreUpdates> ls *Klix* | xargs grep -l '::' | wc -l
> 4
> bear at speedy ~/g/C/C/CoreUpdates> ls *Klix* | xargs grep '::' | wc -l
> 9
> --- snip ---
>
> Alas, the pretty printer does not support it.
> Fixing this is a bit complicated, because AFIR
> the AST does not distinguish between these two
> syntagmas.
>
> OTH, if you want to make your double-colon-code portable
> just pretty print it.
>
>
> HTH and Best Regards,
>
> Gerald
>
>
>
> On 1/6/22 2:03 AM, Mariano Montone via Cuis-dev wrote:
>> Hello,
>>
>> I discovered double colon syntax today, when I came across Parser
>> class>>chainExamplesDoubleColon method.
>>
>> Looks like this:
>>
>> 3 + 4 :: negated " => -7 "
>>
>> How many of you already knew about it?
>>
>> Is it something specific to Cuis? Is it available in other Smalltalks
>> too (perhaps in some other form)?
>>
>> Cheers,
>>
>> Mariano
>>
More information about the Cuis-dev
mailing list