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

Clément Bera bera.clement at gmail.com
Wed Feb 21 12:01:20 UTC 2018


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 ?

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/52c129e1/attachment.html>


More information about the Vm-dev mailing list