[Cuis-dev] Language constructs

Juan Vuletich juan at jvuletich.org
Wed May 6 07:22:11 PDT 2020


On 5/1/2020 12:53 PM, Nicolas Cellier via Cuis-dev wrote:
> For myself, I find the { } syntax very short and useful. I use it a 
> lot even if it reduces a bit portability.
> Also note that the construct is supported by dedicated byteCodes.
>
> I like the Float64Array extension #[ 1.0 3.5 ], maybe it should be 
> generalized in Squeak/Pharo.

Yes!

> But we should also optimize the class with same set as primitives as 
> FloatArray, which is IMO even more useful.

I agree that having the FloatArrays primitives would be great. 
Especially #floatAt: and #floatAt:put:, the simplest ones.

> Note the alternative to backticks that can be used in Squeak: ^[ 0 at 0 ] 
> once.
> It does not require a new syntax, just an elegant trick.
> But it costs 3 message send and 2 Dictionary lookup at runtime though...
> With pre-existing Dolphin ##( 0 at 0 ) we now have at least 2 syntaxes 
> and 3 ways to achieve the same effect in Smalltalk, which is not ideal...
>
> I would vote for immutability of all literals including backticks. 
> That's the least surprising.
> Otherwise, if you mutate the literal, then the code shows a non 
> corresponding value, which is misleading.

I completely agree. Do you know what is the status of immutability in 
Squeak and Pharo? Wasn't the VM work done by Clement a few years ago?

> The first time I was bitten with this was in st80 in the late eighties...
> I discovered that I could write (WriteStream on: 'some literal') which 
> was much shorter than (WriteStream on String new; nextPutAll: 'same 
> literal'; yourself).
> But WriteStream did use a become: under the hood when writing past the 
> destination size, and as a newbie, it tooks me some time to understand 
> why my nicer code would not give the expected result twice :)
>

Yes... Immutable literals would be great.

Thanks,

-- 
Juan Vuletich
www.cuis-smalltalk.org
https://github.com/Cuis-Smalltalk/Cuis-Smalltalk-Dev
https://github.com/jvuletich
https://www.linkedin.com/in/juan-vuletich-75611b3
@JuanVuletich



More information about the Cuis-dev mailing list