Skip to main content

Timeline for Set promotes Rule to RuleDelayed?

Current License: CC BY-SA 3.0

5 events
when toggle format what by license comment
Jun 7, 2012 at 23:37 vote accept Reb.Cabin
Jun 7, 2012 at 20:21 comment added Leonid Shifrin I gave a more extended analysis of evaluation during assignments here, you may find it interesting as well.
Jun 7, 2012 at 20:20 comment added Leonid Shifrin Since @Rojo already gave an extended answer, I'd just add that IMO the essential part can be summarized very briefly: rules in the rule base must be as inert as they can possibly be, so that no part of them evaluates prematurely. This is why HoldPattern is used for the l.h.s., and RuleDelayed to keep the r.h.s. also unevaluated until the replacement is made. Also, as @Rojo noted, this is not always enough, and some evaluation of the l.h.s. does happen during assignments (which was obviously an intentional design decision).
Jun 7, 2012 at 20:05 answer added Rojo timeline score: 8
Jun 7, 2012 at 19:52 history asked Reb.Cabin CC BY-SA 3.0