Skip to content

refactor: rename methods in RB and added hasClassVariableNamed: in Class#19443

Open
jainoshika wants to merge 2 commits intopharo-project:Pharo14from
jainoshika:hasClassVariableNamed
Open

refactor: rename methods in RB and added hasClassVariableNamed: in Class#19443
jainoshika wants to merge 2 commits intopharo-project:Pharo14from
jainoshika:hasClassVariableNamed

Conversation

@jainoshika
Copy link
Copy Markdown
Contributor

@jainoshika jainoshika commented Mar 19, 2026

Changes

  • definesClassVariable: is renamed to hasClassVariableNamed: in RB
  • directlyDefinesClassVariable is renamed to definesClassVariableNamed: in RB
  • added hasClassVariableNamed: in Class(Kernel)
  • Tests ran

What is left

  • Have to add tests for hasClassVariableNamed:

Fixes: #14939

@jainoshika
Copy link
Copy Markdown
Contributor Author

while renaming, i found there is an existing hasClassVarNamed: in Class (Kernel) which tell if class’s own classPool contain this variable name?. This may lead to confusion between it and hasClassVariableNamed:. It can also be renamed to like hasOwnClassVariableNamed: (suggested by LLM).

@Ducasse
Copy link
Copy Markdown
Member

Ducasse commented Mar 19, 2026

Hi thanks.
Some feedback.
Context: such changes requires concentration that I do not have now.

  • directlyDefines is much better than defines so can you revert this change.
  • About the addition of hasClassVariableNamed: we should check. When we are doing the refactoring analysis know that the class locally defined is important and the intention revealing part of the method is important. So may be we should add a method in the same vein in the kernel
  • now classVar are called shared variable so we have to pay attention and it requires a large effrot probably for Pharo 15
  • what would be good is to do an analysis of the API and define what is a good one.
    for example there is hierarchyDefinesMethod:

@Ducasse
Copy link
Copy Markdown
Member

Ducasse commented Mar 19, 2026

while renaming, i found there is an existing hasClassVarNamed: in Class (Kernel) which tell if class’s own classPool contain this variable name?. This may lead to confusion between it and hasClassVariableNamed:. It can also be renamed to like hasOwnClassVariableNamed: (suggested by LLM).

Tx for this finding. Indeed we should revise it. The suggested name is not good. we should think about the API. May be the variable should tell us its definer and the query should be ignorant of the place where the class variable is defined.

@jainoshika
Copy link
Copy Markdown
Contributor Author

jainoshika commented Mar 19, 2026

Hi, thanks for the detailed review @Ducasse. for now, i will revert directlyDefines. Do let me know about the next changes and i will be happy to implement. i will analyse heirarchyDefinesMethod: until then.

@Ducasse
Copy link
Copy Markdown
Member

Ducasse commented Mar 19, 2026

I will try to see if I get some brain cells to allocate to this.
But having a map of the API (May be you can have a look at the paper of Iona Thomas that analyses the reflective API of Pharo): how to navigate...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[RB]: definesClassVariable: should be renamed to #hasClassVariableNamed:

2 participants