Timeline for Module inside Module. Conflict of names in arguments
Current License: CC BY-SA 3.0
9 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
Aug 21, 2017 at 15:58 | comment | added | Daniel Lichtblau |
Maybe it does not, I'm not sure. Anything that relies on a single dollar sign being appended is at a bit of risk. Things that rely on the Module approach of adding dollar sign and a (unique) number are far less at risk.
|
|
Aug 19, 2017 at 2:19 | comment | added | Michael E2 |
@DanielLichtblau I don't see how the code above depends on the specifics of renaming, except in what turns out to be an unintended clash (and the warning/description can be updated as needed, I suppose). I mentioned the $ to point out what to look for in the example, for those who did not realize that happened. Now if in a future change patterns are not renamed at all, then that would be a problem and the usefulness of this approach would have expired. But as I intimated in the answer, I don't think the usefulness of this sort of code-fixing is going to be that broad anyway.
|
|
Aug 17, 2017 at 15:57 | comment | added | Daniel Lichtblau |
They are renamed, yes, but there is no guarantee as to the specifics of the renaming. Examples indicate a $ will be appended. But as they say in investment counseling, past behavior is not necessarily indicative of the future.
|
|
Aug 16, 2017 at 23:06 | comment | added | Michael E2 | @DanielLichtblau At least they're documented, and they have been that way since at least V2 (1991). Incompatible changes have happened before...one hopes always for the better. | |
Aug 16, 2017 at 22:41 | comment | added | Daniel Lichtblau | It could also be a moving target, should that mode of renaming change. Hard-wiring code based on internal variable rewriting specifics is dangerous. | |
Aug 16, 2017 at 10:37 | vote | accept | Nasser | ||
Aug 13, 2017 at 21:25 | comment | added | Michael E2 |
I should probably add that this is not the way to create new code, as the OP also remarked. It's an ad hoc fix to existing code. And it's not bulletproof because Mathematica's renaming by adding a $ is not bulletproof: With[{code = a$}, f[a_, a$_] := code;]; ? f .
|
|
Aug 13, 2017 at 20:07 | history | edited | Michael E2 | CC BY-SA 3.0 |
Changed answer
|
Aug 13, 2017 at 18:09 | history | answered | Michael E2 | CC BY-SA 3.0 |