Services & Resources / Wolfram Forums / MathGroup Archive

MathGroup Archive 2010

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: Mathematica daily WTF

  • To: mathgroup at
  • Subject: [mg115061] Re: Mathematica daily WTF
  • From: kj < at>
  • Date: Thu, 30 Dec 2010 04:09:06 -0500 (EST)
  • References: <ifcnhn$bai$> <iff45b$r5s$>

In <iff45b$r5s$1 at> David Bailey <dave at> writes:

>I can't see why programmers would assume that the attributes of a symbol 
>would, or would not, get copied with an assignment, because languages 
>like C++ or Fortran don't have any equivalent of attributes. LISP does 
>have property lists, and as far as I can remember, these also don't get 
>copied with assignment.

OK, perhaps I omitted a step in my argument.  Let me clarify.

Mathematica's notion of, and notation for, a symbol's multiple
"associated values" inverts the one that has become commonplace in
mainstream programming through the the object-oriented model: in
this view, instead of writing


one would write


IOW, what Mathematica calls a symbol's various associated values,
in OOP become "encapsulated" as properties (or slots/methods/attributes,
etc) of the "symbol object".  (BTW, there's a similar syntactic
inversion in R, so instead of writing list.names one writes

In the OOP view, "cloning a symbol object" would mean copying all
its properties.  Hence, coming from an OOP background, it is
surprising to me that writing "B = A" in Mathematica does not copy
all of attributes of A to B.

Yes, even in OOP languages it can be the case that assignment
results in shallow copying, as opposed to deep copying.  But
Mathematica's assignment does not produce even a shallow copy.


  • Prev by Date: Behavior of Eigenvalues and Eigensystem
  • Next by Date: Re: About TeXForm
  • Previous by thread: Re: Mathematica daily WTF
  • Next by thread: Re: Mathematica daily WTF