[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Psuedo-proposal: const expression
- From: Christopher Berardi <cberardi@...>
- Date: Fri, 9 Mar 2012 18:11:33 -0500
On Fri, Mar 09, 2012 at 11:16:14AM -0000, Robert Virding wrote:
> Immutable data will/should also change the meaning of equality. If I have
>
> x1 = const {'a','b'}
> x2 = const {'a','b'}
>
> should x1 == x2? In an immutable world they should be. So immutable tables
> are not just equal if they are the same object but also if they they have
> the fileds.
>
> Coming from a functional world I find this natural and self-evident. There
> are a lot of benefits in having immutable data, it is a Big Win (tm).
I also find it natural that x1 == x2 from a set theoretic point of view.
But, couldn't this be acheived by redefining the __eq metamethod to do a
deep memberwise comparison? Regardless, somethings will be essentially
uncomparable (such as functions or userdata) on a value basis and must
be compared on a reference basis.
--
Christopher Berardi
http://www.natoufa.com/
May grace and peace by yours in abundance.