Skip to content

Added new method for class duplication + changes #17937

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed

Conversation

AlexisCnockaert
Copy link
Collaborator

@AlexisCnockaert AlexisCnockaert commented Mar 6, 2025

Fixes #17518
-Added method #isClass:alreadyExistIn: to check if the class name is already taken before duplicating
-Removed block closure for one method because there was an error
-Changed the precondition for isGlobal because it was not used correctly

@Ducasse Ducasse requested a review from balsa-sarenac March 7, 2025 11:33
Comment on lines 259 to 267
RBCondition class >> isClassNamed: className definedIn: aModel [

^ self new
block: [ | aClassOrTrait |
aClassOrTrait := aModel classNamed: className.
aClassOrTrait isNotNil ]
errorString: [ className , ' is <1?:not > defined' ]
^ self new
block: [
| aClassOrTrait |
aClassOrTrait := aModel classNamed: className.
aClassOrTrait isNotNil ]
errorString: className , ' is <1?:not >defined'
]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why you couldn't just use this isClassNamed:definedIn:?
Why did you have to duplicate and create isClass:alreadyExistIn:?

Comment on lines -45 to +46
(RBCondition isGlobal: className in: self model) not.
(RBCondition isSymbol: packageName).
((RBCondition withBlock: [ packageName isNotEmpty ]) errorMacro:
'Invalid package name') }
(RBCondition isClass: className alreadyExistIn: self model).
(RBCondition isValidClassName: className).
(RBCondition isGlobal: className in: self model) .
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you explain why isGlobal: was not used correctly?

Copy link
Member

@balsa-sarenac balsa-sarenac left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

-Removed block closure for one method because there was an error

The PR description mentioned this, but I cannot find it in the code. Suggestion: try to be more precise when writing these, for example say exactly in which method and because of which error. This can be applied to all points in the PR description. Always try to say WHY you did the change, not WHAT is the change. Because I can easily see WHAT you did, but WHY is the tricky part and that is what I'm reviewing.

@AlexisCnockaert
Copy link
Collaborator Author

I understood the point, also I made some mistakes about this PR, im going to make some more changes

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.

[UX] [RB] Duplicate class
2 participants