Skip to content

overlapping names of color object and color methods #25

@KimBruce

Description

@KimBruce

The color object in objectdraw allows access to various named colors (white, red, etc.) as well as methods that generate colors (e.g., r()g()b() and random).

Recent fixes to objectdraw have brought up a naming conflict/confusion is hard to resolve. If an object has a method color then invoking e.g., color.white in the hope of getting the value from the color object generates an error because it instead invokes self.color.white. In this particular case, you can resolve the confusion by writing outer.outer.color.white (both outers are required), but this is not a happy solution from the student's point of view. As a result, in 9/14 I will change the name of the objectdraw color object to colorGen, a name which is more appropriate. [This will require a lot of fixes in sample code and documentation (esp the text). Sigh!

It would have been nice to get a warning that an object in the dialect was being hidden by a definition of a method in a user class. I believe earlier we had hoped to ban such conflicts, but at least a warning would be helpful.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions