---------- Forwarded message ---------- From: Alberto G. Corona <agocorona@gmail.com> Date: 2008/12/19 Subject: Re: Fwd: [Haskell-cafe] Haskell as a religion To: Dan Piponi <dpiponi@gmail.com> As far as I know, const only protect from updates that the compiler can detect at compilation time. Moreover, the C/C++ code does not make use of true referential transparency properties, for example const a=1; const b=a perform a copy of content of a to b . In haskell a=1; b=a make b to point to a directly. 2008/12/19 Dan Piponi <dpiponi@gmail.com> On Thu, Dec 18, 2008 at 4:15 PM, Henning Thielemann
<schlepptop@henning-thielemann.de> wrote:
In C/C++ referential transparent functions code can be declared by appending a 'const' to the prototype, right?
For one thing, some fields in a const C++ object can be explicitly set mutable. mutable is sometimes used in C++ a similar way to unsafePerformIO in Haskell. You have something that uses mutability in its internals but that mutability shouldn't be observable to the caller. In both cases you have no means of actually ensuring that the mutability is actually unobservable. -- Dan