Timeline for How to replace a variable that was assigned a value before
Current License: CC BY-SA 3.0
9 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
Apr 13, 2017 at 12:55 | history | edited | CommunityBot |
replaced http://mathematica.stackexchange.com/ with https://mathematica.stackexchange.com/
|
|
Jul 15, 2015 at 7:06 | history | edited | Mr.Wizard | CC BY-SA 3.0 |
added 120 characters in body
|
Aug 16, 2013 at 20:52 | history | edited | Mr.Wizard | CC BY-SA 3.0 |
added 428 characters in body
|
May 22, 2013 at 13:09 | comment | added | Albert Retey |
... the reason for all that is that when the preemptive links interupt the queued evaluation they obviously see the current state of those Block ed symbols. This can cause problems which are very hard to detect and debug. I would wish that this simply wouldn't be the case, but probably that would make preemptive evaluations too expensive/complicated or whatever. This should, IMHO, certainly be better documented...
|
|
May 22, 2013 at 13:06 | comment | added | Albert Retey |
I think it is only safe as long as you don't use any Dynamic . As the FrontEnd itself might use these functionalities, it probably is only safe when used without a frontend altogether. Here is an example where you can see the problem: x=5;Dynamic[x -> DateString[], UpdateInterval -> 1] and then, in an extra cell: Internal`InheritedBlock[{Rule}, SetAttributes[Rule, HoldFirst]; Pause[5]] . I would in general be very cautious to change system symbols, even in Block and IneritedBlock , especially when also working with Dynamic ...
|
|
May 22, 2013 at 11:49 | history | edited | Mr.Wizard | CC BY-SA 3.0 |
added 264 characters in body
|
May 22, 2013 at 10:34 | comment | added | Mr.Wizard |
@Jacob I think it's safe but I have not tested it extensively. I have set HoldFirst on Rule before (within InheritedBlock ) and it seemed to work without issue, but this isn't documented after all. By the way I prefer to focus on the higher-level issues of "PositionFunction" before getting down to these details, but I was thinking about that too which is why this came to mind. I'll surely be interested in what you learn about this as you're causing me to think through some interesting aspects of the language.
|
|
May 22, 2013 at 10:26 | comment | added | Jacob Akkerboom | wow... is that safe though? I did some experimenting with setting attributes to System` functions, but giving Rule the attribute HoldAllComplete causes problems in the front end right away. If it is safe, I suggest using InheritedBlock in your positionFunction answer to give HoldPattern HoldAllComplete. Lets see if I can find out more about InheritedBlock... | |
May 22, 2013 at 10:20 | history | answered | Mr.Wizard | CC BY-SA 3.0 |