Hi Marcus,

I think I just found a workaround:
if you make Slot>>isVirtual to return *true* by default and override it
in InstanceVariableSlot to return *false* the problem will be gone

I don't want to subclass InstanceVariableSlot because it becomes impossible
to see definition of class with slots in Browser and as soon as I add new
instvars all old ones become default InstanceVariableSlot and not my custom.


Cheers,
Alex

On Thu, Jan 22, 2015 at 5:32 PM, Marcus Denker <[email protected]>
wrote:

>
> On 22 Jan 2015, at 17:20, Aliaksei Syrel <[email protected]> wrote:
>
> Hi,
>
> We faced a problem with committing and loading packages with Slots. It
> seams like when loading a package, compiler first compiles a class that
> uses custom Slot and only then Slot itself. It leads to an error like
> MessageNotUnderstood: CustomSlot>>index:, but index: is implemented for
> sure! I'm using the latest image and vm.
>
>
> I think the reason why this fails is that it loads the first all classes
> and then the methods. But this just makes another issue prominent:
>
> I want to add a class in-between Slot and InstanceVariableSlot for people
> to subclass in this cas
> (AbstractInstanceVariableSlot).
> Because InstanceVariableSlot already needs the byte code level stuff,
> while Slot is the superclass of all Slots, even those that have
> no index.
>
> I will do that as the next step.
>
>
> How to reproduce:
>
> 1) Create CustomSlot:
>
> Slot subclass: #CustomSlot
>   instanceVariableNames: ''
>   classVariableNames: ''
>   category: 'CustomSlot-Test'
>
> Implement the following methods:
>
> index
>   ^ index
>
> index: anIndex
>    index := anIndex
>
> read: anObject
>   ^ anObject instVarAt: index
>
> write: aValue to: anObject
>   ^ anObject instVarAt: index put: aValue.
>
> 2) Add our custom class:
>
> Object subclass: #CutomClass
>   slots: { #var => CustomSlot }
>   classVariables: {  }
>   category: 'CustomSlot-Test'
>
> 3) Commit
> 4) Try to load in fresh image
> 5) Face error
>
> Any suggestions?
>
> Thanks,
> Alex
>
>
>

Reply via email to