Timeline for Protecting function definitions only for particular inputs
Current License: CC BY-SA 3.0
12 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/
|
|
Sep 10, 2013 at 23:31 | comment | added | Mr.Wizard |
@m_goldberg What Leonid said; believe me I thought of that first because I didn't want to modify Set . I think Rojo has the best approach so far; it just needs a bit of refinement.
|
|
Sep 10, 2013 at 23:29 | comment | added | Leonid Shifrin | @m_goldberg Perhaps, but they won't work inside packages, and also, some code may be dynamically generated - and thus undetected by these functions. | |
Sep 10, 2013 at 23:27 | comment | added | m_goldberg |
Could something be done with $Pre or $PreRead to detect the relevant Set expressions and modify them appropriately? The idea being to avoid monkeying with the definition of Set .
|
|
Sep 10, 2013 at 23:14 | comment | added | Rojo |
@Mr.Wizard, I think it's very hopeful to expect solutions without drawbacks, so sorry for not giving the instant +1. Leonid's probably can be fixed to address your issues, but it will never work inside StackInhibited . We'll have to wait until they give us some form of Experimental`ValueFunction that works on downvalues
|
|
Sep 10, 2013 at 23:02 | comment | added | Mr.Wizard | @Rojo I know; like I said this is a great question because it is both practical and challenging. | |
Sep 10, 2013 at 23:02 | comment | added | Mr.Wizard |
@Timothy I don't see how that would help. AFAIK Protect simply sets the Protected attribute and low-level functionality does the rest. I am not aware of any hooks to affect checking or applying that attribute, or any other for that matter.
|
|
Sep 10, 2013 at 22:49 | comment | added | Rojo |
Right, forgot about the list version of Set . It's just that uuugghh, modifing Set aarggh
|
|
Sep 10, 2013 at 22:33 | comment | added | Timothy Wofford | Maybe we could try modifying Protect instead of Set? | |
Sep 10, 2013 at 22:30 | comment | added | Mr.Wizard |
@Rojo UpValues will not run deep enough; they only trigger on expressions at level one. The OP's first example would fail: {f[x0],f[x1]}={f3,f4}
|
|
Sep 10, 2013 at 22:27 | comment | added | Rojo | Why not as upvalues? | |
Sep 10, 2013 at 21:55 | history | answered | Mr.Wizard | CC BY-SA 3.0 |