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
Breed names can cause shadowing of built-in procedures #920
Conversation
I vote for #3 (and I wouldn't be surprised if the new compiler already behaves that way, the StructureParser rewrite was supposed to fix all issues like this all at once) |
Vote for 3 as well. Do we know of any models this will break? I feel like such models are already asking from trouble... |
The new compiler may behave that way in some circumstances, but not all. Notably it doesn't whine at all about A lot of tests use |
Maybe it would be wise to change
|
Yeah, I changed that on a branch. It broke a bunch of tests (unsurprisingly). I'm trying to work out good names for the breeds. I initially used |
Seems like a sensible choice. |
I support the third option. Anything else seems prone to breaking the principle of least surprise. |
@nicolaspayette , Travis runs on this branch have uncovered a model in the models library which defines a breed prim overriding a built-in. Here is the model and the error:
@qiemem , the following nw models will also need to be changed. I'm happy to do it, but wanted to let you know what models were changing and what changes I was making.
I'm planning to change the breed names from links/link to edges/edge. Let me know if you'd prefer a different change. |
I'll make the change. Now that I see the change, I kind of wish the primitives were named |
Perhaps a rename would be worth discussing, but I still think this change is worth making, even (and perhaps especially) if it forces people to abandon
Having said all that, we should probably add some documentation in the link programming guide which covers this transition as well as making sure all our examples no longer have |
to prevent shadowing `is-agent?` (following NetLogo/NetLogo#920)
cd2a296
to
c171699
Compare
@@ -0,0 +1 @@ | |||
/Users/rgg284/IdeaProjects/LevelSpace |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@mrerrormessage , Is this intended?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nope, good catch!
Consider what the meaning of
is-string?
is in the following file. As it happens,is-string? "abc" => true
, whileis-string? one-of strings => false
.This also affects link breeds (I believe). I'm unsure how to resolve this, as it seems like it has a lot of potential to break models. I think the following are viable alternatives:
I was unable to find an issue like this for NetLogo, but I think it's quite possible that Tortoise and/or Headless have current or past issues to the same effect.
Should also add tests around procedure names shadowing breed procedure names, for instance:
The above fails to compile in NetLogo hexy, but is not tested.