[Vm-dev] Underscore for assignment in VMMaker and related plugins

Marcel Taeumel marcel.taeumel at hpi.de
Wed Aug 11 07:14:49 UTC 2021


Hi Juan!

> [...] I'll happy to make the change.

This would be the easiest solution. :-) Thank you!

Hi Eliot!

> [...] the class side method must be loaded before methods containing a underscore assignments [...]

Currently, Squeak+Monticello give only coarse-grained control over code load order:

- Packages can be ordered via MC "dependencies" (see "required packages" in context menu)

- Packages can be ordered in an update map / MCConfiguration
- MCPackageLoader implements some generic rules such as "addition-before-removal", which affects "move methods" across packages (see MCPackageLodaer >> #basicLoad)

So, even the #compilerClass hook is currently not working as one might expect. We currently rely on the byte code being present in and installed from .mcz files. See snapshot.bin inside the .mcz.

Maybe also see MethodAddition >> #notifyObservers.

Best,
Marcel
Am 10.08.2021 19:21:48 schrieb Juan Vuletich <juanvuletich at zoho.com>:

Hi Folks,

On 8/10/2021 1:40 PM, Eliot Miranda wrote:
>
> Hi Dave, Hi Marcel,
>
>> On Aug 8, 2021, at 5:40 PM, David T. Lewis wrote:
>>
>> 
>> Background: By convention the assignment operator in modern day Squeak
>> is ':=' and it Cuis it is '_'. The actual fonts are rendered nicely in
>> either case for Cuis and Squeak.
>>
>> The VMs used for Cuis and Squeak consist of the VM proper along with various
>> VM plugins such as OSProcessPlugin and VectorEnginePlugin. The VM plugins
>> are written in Smalltalk ("slang") with supporting external code as needed.
>> The Smalltalk code for each VM plugin is translated to C code, and the
>> resulting C code is expected to be correct regardless of the dialect of
>> Squeak/Cuis in which the plugin is written.
>>
>> The generated C code for a VM plugin is the same regardless of whether the
>> Smalltalk source is written in the '_' or ':=' convention. However, mixing
>> these two conventions in the same VMMaker image may be confusing, especially
>> if the (Squeak) image has disabled its 'Allow underscore selectors' preference.
>>
>> OK, enough background. The question I want to present is this:
>>
>> The new VectorEnginePlugin is being developed in Cuis, and therefore uses
>> the '_' convention in its Smalltalk source code. When building a new
>> opensmalltalk-vm VMMaker image from primary sources, the 'Allow underscore
>> selectors' preference' is disabled, presumably in order to catch VM plugin
>> code that accidentally uses the '_' convention. However, in the case of
>> VectorEnginePlugin, the use of '_' is intentional, and we can expect it
>> to be used for current and future versions of the plugin Smalltalk code
>> as development proceeds.
>>
>> So should we:
>>
>> 1) Relax the restriction and allow VectorEnginePlugin to be loaded without
>> modification in a VMMaker image
>>
>> or:
>>
>> 2) Convert current and future versions of the VectorEnginePlugin Smalltalk
>> to use ':=' for assigments prior to loading in a Squeak VMMaker image
>> (method author/timestamps would be preserved).
>>
>> I personally prefer 1) but consider either option to be reasonable and doable.
>>
>> Comments? Preferences?
> My preference is 1a :-). 1a is supporting a Compiler patch that allows one to assert the 'Allow underscore selectors' preference on a per-class basis and adding some class side state (a method? A method containing a pragma?) to VectorEnginePlugin that asserts the preference. Maybe this is too elaborate, and there’s a bootstrap problem (the class side method must be loaded before methods containing a underscore assignments) but I like not having the preference globally.
>
>> Dave

I can change VectorEnginePlugin to use only ':=' assignments. I used '_'
assignments only because it is what I am used to. But this is code that
is meant to be used in Squeak and not only in Cuis. Dave, unless you see
additional value in allowing '_' assignment in plugin code, I'll happy
to make the change.

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

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.squeakfoundation.org/pipermail/vm-dev/attachments/20210811/0be9becd/attachment-0001.html>


More information about the Vm-dev mailing list