[Vm-dev] Fwd: Misc primitives & read-only objects

Eliot Miranda eliot.miranda at gmail.com
Wed Feb 21 15:33:23 UTC 2018


Hi Clément,


> On Feb 21, 2018, at 4:01 AM, Clément Bera <bera.clement at gmail.com> wrote:
> 
> 
> Hi all,
> 
> I'm trying to set literals as read-only in Pharo. I've got this problem with this Misc primitive:
> 
> translate: aString from: start  to: stop  table: table
> 	"translate the characters in the string by the given table, in place"
> 	<primitive: 'primitiveTranslateStringWithTable' module: 'MiscPrimitivePlugin'>
> 	<var: #table  declareC: 'unsigned char *table'>
> 	<var: #aString  declareC: 'unsigned char *aString'>
> 
> 	start to: stop do: [ :i |
> 		aString at: i put: (table at: (aString basicAt: i) + 1) ]
> 
> The primitive mutates aString without checking if it's read-only.
> 
> What is the right way in Smart syntax plugin to add the read-only check ?

I think the right way is to rewrite the primitive as a SmartSyntaxPlugin.  I will do this today.  These translated primitives are a cute idea but fundamentally problematic.

> 
> Best,
> 
> -- 
> Clément Béra
> https://clementbera.github.io/
> https://clementbera.wordpress.com/
> Bâtiment B 40, avenue Halley 59650 Villeneuve d'Ascq
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.squeakfoundation.org/pipermail/vm-dev/attachments/20180221/6fa3f9bd/attachment.html>


More information about the Vm-dev mailing list