How can an object have its "self" and "name" instance variables nil after being instantiated?

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
7 messages Options
Reply | Threaded
Open this post in threaded view
|

How can an object have its "self" and "name" instance variables nil after being instantiated?

Julien Delplanque
Hi,

I have an object that override KMCategory and that is initialized and
added to "KmRepository default" using #postLoadDoIt: message in
BaselineOf after the package is loaded in an image.

But once it is loaded I have huge problems with keyboards entries, they
do not work any more, I get an exception each time I press a key.

If I inspect the Singleton class variable of my category object I can
see it contains an instance of my object that have its "self" variable
nil and its "name" variable nil. Others variables look fine. How is it
possible?

I can remove my custom KMCategory by copy/paste code from sublime text
to Pharo and left click/do it and then everything is fine with my
keyboard: no more exception and it behave correctly.

Thanks in advance,

Julien

Reply | Threaded
Open this post in threaded view
|

Re: How can an object have its "self" and "name" instance variables nil after being instantiated?

jtuchel
I don't have an exact answer for you, but I think neither self nor name are good names for inst vars.



> Am 25.08.2015 um 15:57 schrieb Julien Delplanque <[hidden email]>:
>
> Hi,
>
> I have an object that override KMCategory and that is initialized and added to "KmRepository default" using #postLoadDoIt: message in BaselineOf after the package is loaded in an image.
>
> But once it is loaded I have huge problems with keyboards entries, they do not work any more, I get an exception each time I press a key.
>
> If I inspect the Singleton class variable of my category object I can see it contains an instance of my object that have its "self" variable nil and its "name" variable nil. Others variables look fine. How is it possible?
>
> I can remove my custom KMCategory by copy/paste code from sublime text to Pharo and left click/do it and then everything is fine with my keyboard: no more exception and it behave correctly.
>
> Thanks in advance,
>
> Julien
>
>

Reply | Threaded
Open this post in threaded view
|

Re: How can an object have its "self" and "name" instance variables nil after being instantiated?

Julien Delplanque
I didn't do anything like using these names as inst vars. You can
reproduce what I am talking about:

KMCategory new inspect.

On 25/08/15 17:25, Joachim Tuchel wrote:

> I don't have an exact answer for you, but I think neither self nor name are good names for inst vars.
>
>
>
>> Am 25.08.2015 um 15:57 schrieb Julien Delplanque <[hidden email]>:
>>
>> Hi,
>>
>> I have an object that override KMCategory and that is initialized and added to "KmRepository default" using #postLoadDoIt: message in BaselineOf after the package is loaded in an image.
>>
>> But once it is loaded I have huge problems with keyboards entries, they do not work any more, I get an exception each time I press a key.
>>
>> If I inspect the Singleton class variable of my category object I can see it contains an instance of my object that have its "self" variable nil and its "name" variable nil. Others variables look fine. How is it possible?
>>
>> I can remove my custom KMCategory by copy/paste code from sublime text to Pharo and left click/do it and then everything is fine with my keyboard: no more exception and it behave correctly.
>>
>> Thanks in advance,
>>
>> Julien
>>
>>


Reply | Threaded
Open this post in threaded view
|

Re: How can an object have its "self" and "name" instance variables nil after being instantiated?

Sven Van Caekenberghe-2
Well, name is an instance variable that is simply nil.

Self is printed as nil because this object has its own #gtDisplayOn: method that prints just its name.

You could try 'Basic Inspect' as well.

> On 25 Aug 2015, at 17:30, Julien Delplanque <[hidden email]> wrote:
>
> I didn't do anything like using these names as inst vars. You can reproduce what I am talking about:
>
> KMCategory new inspect.
>
> On 25/08/15 17:25, Joachim Tuchel wrote:
>> I don't have an exact answer for you, but I think neither self nor name are good names for inst vars.
>>
>>
>>
>>> Am 25.08.2015 um 15:57 schrieb Julien Delplanque <[hidden email]>:
>>>
>>> Hi,
>>>
>>> I have an object that override KMCategory and that is initialized and added to "KmRepository default" using #postLoadDoIt: message in BaselineOf after the package is loaded in an image.
>>>
>>> But once it is loaded I have huge problems with keyboards entries, they do not work any more, I get an exception each time I press a key.
>>>
>>> If I inspect the Singleton class variable of my category object I can see it contains an instance of my object that have its "self" variable nil and its "name" variable nil. Others variables look fine. How is it possible?
>>>
>>> I can remove my custom KMCategory by copy/paste code from sublime text to Pharo and left click/do it and then everything is fine with my keyboard: no more exception and it behave correctly.
>>>
>>> Thanks in advance,
>>>
>>> Julien
>>>
>>>
>
>


Reply | Threaded
Open this post in threaded view
|

Re: How can an object have its "self" and "name" instance variables nil after being instantiated?

Mariano Martinez Peck
The problem is that KMCategory reimplements #name, which is not a good idea. And that is the method used by the inspector. Since the implementation of #name answers the instVar that's why it's nil. just remove KMCategory >> name and do the inspect again and you will see the different.  



On Tue, Aug 25, 2015 at 12:39 PM, Sven Van Caekenberghe <[hidden email]> wrote:
Well, name is an instance variable that is simply nil.

Self is printed as nil because this object has its own #gtDisplayOn: method that prints just its name.

You could try 'Basic Inspect' as well.

> On 25 Aug 2015, at 17:30, Julien Delplanque <[hidden email]> wrote:
>
> I didn't do anything like using these names as inst vars. You can reproduce what I am talking about:
>
> KMCategory new inspect.
>
> On 25/08/15 17:25, Joachim Tuchel wrote:
>> I don't have an exact answer for you, but I think neither self nor name are good names for inst vars.
>>
>>
>>
>>> Am 25.08.2015 um 15:57 schrieb Julien Delplanque <[hidden email]>:
>>>
>>> Hi,
>>>
>>> I have an object that override KMCategory and that is initialized and added to "KmRepository default" using #postLoadDoIt: message in BaselineOf after the package is loaded in an image.
>>>
>>> But once it is loaded I have huge problems with keyboards entries, they do not work any more, I get an exception each time I press a key.
>>>
>>> If I inspect the Singleton class variable of my category object I can see it contains an instance of my object that have its "self" variable nil and its "name" variable nil. Others variables look fine. How is it possible?
>>>
>>> I can remove my custom KMCategory by copy/paste code from sublime text to Pharo and left click/do it and then everything is fine with my keyboard: no more exception and it behave correctly.
>>>
>>> Thanks in advance,
>>>
>>> Julien
>>>
>>>
>
>





--
Reply | Threaded
Open this post in threaded view
|

Re: How can an object have its "self" and "name" instance variables nil after being instantiated?

Mariano Martinez Peck
Well...Sven explained  #gtDisplayOn: and he nailed it.

On Tue, Aug 25, 2015 at 12:54 PM, Mariano Martinez Peck <[hidden email]> wrote:
The problem is that KMCategory reimplements #name, which is not a good idea. And that is the method used by the inspector. Since the implementation of #name answers the instVar that's why it's nil. just remove KMCategory >> name and do the inspect again and you will see the different.  



On Tue, Aug 25, 2015 at 12:39 PM, Sven Van Caekenberghe <[hidden email]> wrote:
Well, name is an instance variable that is simply nil.

Self is printed as nil because this object has its own #gtDisplayOn: method that prints just its name.

You could try 'Basic Inspect' as well.

> On 25 Aug 2015, at 17:30, Julien Delplanque <[hidden email]> wrote:
>
> I didn't do anything like using these names as inst vars. You can reproduce what I am talking about:
>
> KMCategory new inspect.
>
> On 25/08/15 17:25, Joachim Tuchel wrote:
>> I don't have an exact answer for you, but I think neither self nor name are good names for inst vars.
>>
>>
>>
>>> Am 25.08.2015 um 15:57 schrieb Julien Delplanque <[hidden email]>:
>>>
>>> Hi,
>>>
>>> I have an object that override KMCategory and that is initialized and added to "KmRepository default" using #postLoadDoIt: message in BaselineOf after the package is loaded in an image.
>>>
>>> But once it is loaded I have huge problems with keyboards entries, they do not work any more, I get an exception each time I press a key.
>>>
>>> If I inspect the Singleton class variable of my category object I can see it contains an instance of my object that have its "self" variable nil and its "name" variable nil. Others variables look fine. How is it possible?
>>>
>>> I can remove my custom KMCategory by copy/paste code from sublime text to Pharo and left click/do it and then everything is fine with my keyboard: no more exception and it behave correctly.
>>>
>>> Thanks in advance,
>>>
>>> Julien
>>>
>>>
>
>





--



--
Reply | Threaded
Open this post in threaded view
|

Re: How can an object have its "self" and "name" instance variables nil after being instantiated?

Julien Delplanque
Ok, thanks for your answers.

I think this is involved in the problem I had but I solved it by
changing my approach anyway :).

On 25/08/15 17:55, Mariano Martinez Peck wrote:

> Well...Sven explained  #gtDisplayOn: and he nailed it.
>
> On Tue, Aug 25, 2015 at 12:54 PM, Mariano Martinez Peck <
> [hidden email]> wrote:
>
>> The problem is that KMCategory reimplements #name, which is not a good
>> idea. And that is the method used by the inspector. Since the
>> implementation of #name answers the instVar that's why it's nil. just
>> remove KMCategory >> name and do the inspect again and you will see the
>> different.
>>
>>
>>
>> On Tue, Aug 25, 2015 at 12:39 PM, Sven Van Caekenberghe <[hidden email]>
>> wrote:
>>
>>> Well, name is an instance variable that is simply nil.
>>>
>>> Self is printed as nil because this object has its own #gtDisplayOn:
>>> method that prints just its name.
>>>
>>> You could try 'Basic Inspect' as well.
>>>
>>>> On 25 Aug 2015, at 17:30, Julien Delplanque <[hidden email]> wrote:
>>>>
>>>> I didn't do anything like using these names as inst vars. You can
>>> reproduce what I am talking about:
>>>> KMCategory new inspect.
>>>>
>>>> On 25/08/15 17:25, Joachim Tuchel wrote:
>>>>> I don't have an exact answer for you, but I think neither self nor
>>> name are good names for inst vars.
>>>>>
>>>>>
>>>>>> Am 25.08.2015 um 15:57 schrieb Julien Delplanque <[hidden email]>:
>>>>>>
>>>>>> Hi,
>>>>>>
>>>>>> I have an object that override KMCategory and that is initialized and
>>> added to "KmRepository default" using #postLoadDoIt: message in BaselineOf
>>> after the package is loaded in an image.
>>>>>> But once it is loaded I have huge problems with keyboards entries,
>>> they do not work any more, I get an exception each time I press a key.
>>>>>> If I inspect the Singleton class variable of my category object I can
>>> see it contains an instance of my object that have its "self" variable nil
>>> and its "name" variable nil. Others variables look fine. How is it possible?
>>>>>> I can remove my custom KMCategory by copy/paste code from sublime
>>> text to Pharo and left click/do it and then everything is fine with my
>>> keyboard: no more exception and it behave correctly.
>>>>>> Thanks in advance,
>>>>>>
>>>>>> Julien
>>>>>>
>>>>>>
>>>>
>>>
>>>
>>
>> --
>> Mariano
>> http://marianopeck.wordpress.com
>>
>
>