Problem filing out change set

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

Problem filing out change set

Chris Kermiet
Hi, Folks --
    I'm new to this list. I'm learning squeak by by creating some artsy objects which create designs according to mathematical algorithms (based on Schillinger's Mathematical Basis of the Arts).  It seemed like a good idea to add the constant Phi to the Float class to keep from recalculating it. (Phi is the Golden Ratio -- the limit ratio of the Fibonacci series.)

    Now, when I try to file out my change set, I get the error message:

"An instance variable was added to class Float and it is not copied in the method veryDeepCopyWith:
Please rewrite it to handle all instance variables.
See DeepCopier class comment."


When I look at the DeepCopier class comment, I have no clue what I'm supposed to do. Does this new instance variable need to be copied somewhere? When the class Float was recompiled, shouldn't that have added the new class variable to the appropriate dictionary? The instance variable is referenced from the class side:

phi
    "Answer the constant, Phi."
    ^ Phi

in exactly the same way as pi or any of the other constants initialized in the Float class. Does it need to be copied somewhere else?

In addition, this error message seems unnecessarily vague. Please rewrite "it" -- what does "it" refer to? The instance variable (phi), the Float class, the veryDeepCopyWith: method? Or the class variable (Phi)? When I look carefully at all of these, none of them look like they should need rewriting.

Unless I should do (just a guess):

    Float veryDeepCopyWith: phi

in a workspace. But I'd like to know why before I try it. Anyone have any ideas on this? Any help would be appreciated. Thanks.

--Chris Kermiet


_______________________________________________
Beginners mailing list
[hidden email]
http://lists.squeakfoundation.org/mailman/listinfo/beginners
Reply | Threaded
Open this post in threaded view
|

Re: Problem filing out change set

Yoshiki Ohshima-2
At Wed, 15 Oct 2008 00:23:25 -0600,
Chris Kermiet wrote:

>
> Hi, Folks --
>     I'm new to this list. I'm learning squeak by by creating some artsy objects which create designs according to
> mathematical algorithms (based on Schillinger's Mathematical Basis of the Arts).  It seemed like a good idea to add the
> constant Phi to the Float class to keep from recalculating it. (Phi is the Golden Ratio -- the limit ratio of the
> Fibonacci series.)
>
>     Now, when I try to file out my change set, I get the error message:
>
> "An instance variable was added to class Float and it is not copied in the method veryDeepCopyWith:
> Please rewrite it to handle all instance variables.
> See DeepCopier class comment."
>
> When I look at the DeepCopier class comment, I have no clue what I'm supposed to do. Does this new instance variable
> need to be copied somewhere?

  In a general case, you are supposed to edit #veryDeepCopyWith:
method for the object.

  But, the system is not supposed to let you add an instance variable
to Float, and adding a class variable to Float shouldn't bring up the
dialog...  Ok, it seems to me that you found a bug in some versions of
Squeak.  I tried it in 3.9 and 3.10.2 and I could reproduce the
problem.  (It used to work fine in more stable versions.)

> In addition, this error message seems unnecessarily vague. Please
> rewrite "it" -- what does "it" refer to?

  I think you got a new browser window that shows a method.  "It"
refers to the method (#veryDeepCopyWith:) in the browser.

> The instance
> variable (phi), the Float class, the veryDeepCopyWith: method? Or the class variable (Phi)? When I look carefully at all
> of these, none of them look like they should need rewriting.
>
> Unless I should do (just a guess):
>
>     Float veryDeepCopyWith: phi
>
> in a workspace. But I'd like to know why before I try it. Anyone have any ideas on this? Any help would be appreciated.
> Thanks.

  What you can do is to ignore the dialog.  I think you did get the
change set on the disk.  So the mission is actually accomplished.

-- Yoshiki
_______________________________________________
Beginners mailing list
[hidden email]
http://lists.squeakfoundation.org/mailman/listinfo/beginners
Reply | Threaded
Open this post in threaded view
|

Re: Problem filing out change set

Bert Freudenberg
In reply to this post by Chris Kermiet

Am 15.10.2008 um 08:23 schrieb Chris Kermiet:

> "An instance variable was added to class Float and it is not copied  
> in the method veryDeepCopyWith:
> Please rewrite it to handle all instance variables.
> See DeepCopier class comment."

> The instance variable is referenced from the class side:
>
> phi
>     "Answer the constant, Phi."
>     ^ Phi

This should *not* be an instance variable, but a class variable. Put  
Phi in the list of classVariableNames: next to the other constants.

- Bert -


_______________________________________________
Beginners mailing list
[hidden email]
http://lists.squeakfoundation.org/mailman/listinfo/beginners
Reply | Threaded
Open this post in threaded view
|

Re: Problem filing out change set

Chris Kermiet
In reply to this post by Yoshiki Ohshima-2
Yoshiki, Burt --
    Thanks for your comments. I seem to have fixed the problem, and no longer get the error message.

Burt, there is no instance variable. Rather, I set up Phi as a class variable, with phi as a class method (exactly as pi was set up). This is one reason why the error message was so confusing. It refers to an instance variable (which I never added- I referred to it as an instance variable in my original email, which was incorrect. It's a class method, the same as the other constants in Float.)
     phi
        ^Phi
But, in trying to decipher the error message, I thought it might be referring to the new constant. I'm still mystified as to what the error message means, or what it refers to, or why I got it. Perhaps, as Yoshiki suggests, it's a bug. (The image which I'm using is 3.9-final-7067.)

What fixed it? I recompiled Float, and then reinitialized it. Now I can file out the new change set without getting the error message. But, being a newbie, I don't know why this fixed it (since it was recompiled when I first added the new class constant, and I had also reinitialized the Float class after that). And I still have no idea what the error message means. And looking at the comments in DeepCopier didn't help a bit.

Yoshiki Ohshima wrote:
At Wed, 15 Oct 2008 00:23:25 -0600,
Chris Kermiet wrote:
  
Hi, Folks --
    I'm new to this list. I'm learning squeak by by creating some artsy objects which create designs according to
mathematical algorithms (based on Schillinger's Mathematical Basis of the Arts).  It seemed like a good idea to add the
constant Phi to the Float class to keep from recalculating it. (Phi is the Golden Ratio -- the limit ratio of the
Fibonacci series.)

    Now, when I try to file out my change set, I get the error message:

"An instance variable was added to class Float and it is not copied in the method veryDeepCopyWith:
Please rewrite it to handle all instance variables.
See DeepCopier class comment."

When I look at the DeepCopier class comment, I have no clue what I'm supposed to do. Does this new instance variable
need to be copied somewhere?
    

  In a general case, you are supposed to edit #veryDeepCopyWith:
method for the object.

  But, the system is not supposed to let you add an instance variable
to Float, and adding a class variable to Float shouldn't bring up the
dialog...  Ok, it seems to me that you found a bug in some versions of
Squeak.  I tried it in 3.9 and 3.10.2 and I could reproduce the
problem.  (It used to work fine in more stable versions.)

  
In addition, this error message seems unnecessarily vague. Please
rewrite "it" -- what does "it" refer to?
    

  I think you got a new browser window that shows a method.  "It"
refers to the method (#veryDeepCopyWith:) in the browser.

  
The instance
variable (phi), the Float class, the veryDeepCopyWith: method? Or the class variable (Phi)? When I look carefully at all
of these, none of them look like they should need rewriting.

Unless I should do (just a guess):

    Float veryDeepCopyWith: phi

in a workspace. But I'd like to know why before I try it. Anyone have any ideas on this? Any help would be appreciated.
Thanks.
    

  What you can do is to ignore the dialog.  I think you did get the
change set on the disk.  So the mission is actually accomplished.

-- Yoshiki
_______________________________________________
Beginners mailing list
[hidden email]
http://lists.squeakfoundation.org/mailman/listinfo/beginners


  

_______________________________________________
Beginners mailing list
[hidden email]
http://lists.squeakfoundation.org/mailman/listinfo/beginners
Reply | Threaded
Open this post in threaded view
|

Re: Problem filing out change set

Yoshiki Ohshima-2
> But, in trying to decipher the error message, I thought it might be referring to the new constant. I'm still mystified
> as to what the error message means, or what it refers to, or why I got it. Perhaps, as Yoshiki suggests, it's a bug.
> (The image which I'm using is 3.9-final-7067.)

  Perhaps?  It is a bug, and that is nasty enough to confuse a newbie.
In a sense, the logic bug has been around since 2001, when
DeepCopier>>checkClass: as written in a way that provides a short-term
fulfilment with some assumptions.  Then, the casual addition of method
properties at 3.9 broke the assumptions and now you see the problem.

> What fixed it? I recompiled Float, and then reinitialized it. Now I can file out the new change set without getting the
> error message. But, being a newbie, I don't know why this fixed it (since it was recompiled when I first added the new
> class constant, and I had also reinitialized the Float class after that). And I still have no idea what the error
> message means. And looking at the comments in DeepCopier didn't help a bit.

  Heh, you also need to look at the code^^;

  If you add Phi to Float, and open the change sorter and select
Float, you see a message that says: "Class definition was changed."

  Then, if you look at the code ChangeSet>>fileOutClassDefinition:on:,
  it has a block:

  (self atClass: class includes: #change) ifTrue: [...]

the check is wrong. if the change is only the class variables, it
shouldn't be true.

  So, you probably created a new change by entering a new project or
such.  And the change doesn't know about the class var addition.
Then, it wouldn't complain.

-- Yoshiki
_______________________________________________
Beginners mailing list
[hidden email]
http://lists.squeakfoundation.org/mailman/listinfo/beginners