Re: constant -> constant
- To: mathgroup at smc.vnet.net
- Subject: [mg41970] Re: constant -> constant
- From: "Will Self" <wself at msubillings.edu>
- Date: Wed, 11 Jun 2003 13:18:13 -0400 (EDT)
- References: <bc6nki$2hd$1@smc.vnet.net>
- Sender: owner-wri-mathgroup at wolfram.com
"Carlos Felippa" <carlos at colorado.edu> wrote in message news:bc6nki$2hd$1 at smc.vnet.net... > I traced a bug in a large program to an unexpected > substitution. This gives the idea: > > a=b=0; Print [a/.b->1]; > > 1 > > Is this correct behavior and, is there a way to guard > against this happening? > There's more to this. a=b=0 Then a/.b->1 returns 1 but also b/.a->1 returns 1 It appears to me that the kernel is using some kind of duplicate storage that Wolfram thought would never cause any trouble, but this is clearly not the claimed behavior of Set. ?Set lhs = rhs evaluates rhs and assigns the result to be the value of lhs.