Closed nicolaspayette closed 8 years ago
Hmm, interesting. Reporting false
doesn't strike me as superior enough to warrant breaking backwards compatibility, especially since returning false
also isn't an entirely satisfactory solution.
opinion: I think this is a bug, plain and simple, and there is no excuse for just leaving it the way it is forever. The current behavior is just plain wrong.
If you aren't willing to break compatibility here in the 5.2.x series, how about for 5.3?
From http://ccl.northwestern.edu/netlogo/docs/dictionary.html#create-link-from
"a node cannot be linked to itself"
making me wonder if the concept of a path from a turtle to itself is actually a valid path in terms of netlogo. Maybe the correct thing to do here is error instead of returning anything.
edit: Though I suppose "paths from agents to themselves results in undefined behavior" would satisfy the current implementation.
@frankduncan The idea is that the path from a turtle to itself is, in fact, empty, as it doesn't require traversing any links. You don't need self-loops for this. The current behavior for nw:path-to self
is correct.
Given that a major version change is coming up, I'm going to go ahead and fix this.
See https://stackoverflow.com/questions/29943474/shortest-path-query-returning-empty-list/ for context.
There, @SethTisue makes the excellent point that:
This would be a breaking change. And things have been that way forever. But I think it's worth considering.