Thx. Thats exactly what I was looking for. The key part being "self
isInitializer" where...
    isInitializer
        ^ selector = #initialize and: [classIsMeta]

Now I also see "self isExternalStructureFieldDefinition"
    "Postloading of FFI fields. This code will be called when loading FFI
structures that are not by default in the image."

Could something similar be done like "self isEnumDecl" ?  It would be a
minor improvement to not have write up in blog posts that
MyFFIExternalEnumeration needs a class-side #initialize simply to do
"self initializeEnumeration"
when having #enumDecl is a strong convention and indicator that
intialization is required.

Or is that starting to load up with too many implicit initializations?

Alternatively, what consideration has been given to pragmas for class
initialization?
For example this seems more self contained and explicit....
    MyFFIExternalEnumeration class >> enumDecl
        <classInitialization: #initializeEnumeration>
        ^ #( EnumA  1   EnumB 2)

cheers -ben

On 14 November 2017 at 16:40, Pavel Krivanek <pavel.kriva...@gmail.com>
wrote:

> Hi,
>
> the #initialize message is sent only to the classes that implement this
> method. In *.st files it is an explicit call, Monticello does it slightly
> smarter way, see MCMethodDefinition>>#postloadOver:
>
> Cheers,
> -- Pavel
>
> 2017-11-14 3:08 GMT+01:00 Ben Coman <b...@openinworld.com>:
>
>> Because I'm lazy to experiment this instant (not wanting to get
>> distracted from my current track), and also its probably a useful remainder
>> for others I'll just ask...
>>
>> When MyClass is loaded, #initialize is sent to it.  Typically the
>> class-side>>initialize should not call "super initialize" to avoid
>> re-initializing the superclaass, but what if MyClass doesn't implement
>> #initialize?  Does the message fall through to the superclass, or is
>> #initialize only sent if MyClass implements it?
>>
>> Concrete example...
>> FFIExternalEnumeration subclass MyEnumeration needs to be sent
>> #initializeEnumeration when it is loaded.  We have...
>>
>>     FFIExternalEnustmeration>>#initialize
>> self initializeEnumeration
>>
>> so is MyEnumeration *required* to implement its own
>> MyEnumeration>>#initialize, or can it rely 
>> FFIExternalEnustmeration>>#initialize.
>>  I believe it is the former, but just wanted to confirm my understanding.
>>
>> cheers -ben
>>
>>
>>
>

Reply via email to