A user can create two different shared blocks with the same name in one project. This can lead to confusion when looking at code and trying to determine which method is called.
Similar issue occurs when creating a class with the same name, in this case GP auto-magically appends a digit to the end of the class name. I think I would prefer an Alert notifying the user of the naming conflict and giving them the option to rename, be curious as to what others think.
See attached project for example.
Also to ponder: How can you find where Shared Blocks are defined when there are multiple classes? You would need to find the class where the shared block was defined. Which is fine in most cases where small number of classes/scripts
V.54
User can create Shared Blocks with same name in one project (v54)
Moderator: MSandro
User can create Shared Blocks with same name in one project (v54)
- Attachments
-
- sameBlockName.gpp
- (5.69 KiB) Downloaded 528 times
Re: User can create Shared Blocks with same name in one project (v54)
Yes, this is potentially confusing. Behind the scenes, every user-defined block maps to a unique function name, but if the labels on the blocks are the same how is user to know which is which?
At the very least, we should probably warn users about such name conflicts, and perhaps require them to choose a unique name.
Shared blocks is a new feature and we're still working out the details...
At the very least, we should probably warn users about such name conflicts, and perhaps require them to choose a unique name.
Shared blocks is a new feature and we're still working out the details...