#pragma indent
using Nemerle.IO
def cmp(a : object, b : object)
print(a == b)
def tuple2 = (0,0)
cmp(tuple2, tuple2)
def tuple4 = (0,0,0,0)
cmp(tuple4, tuple4)
which gives: FalseTrue as a result
...and I was completely confused that actually two-tuple is value type
but four-tuple isn't.
Yep, these are immutable object so actually it's a little difference,
unless someone want to compare by reference. I suppose performance
consideration is a purpose of this. Is it worth it (feels awkward)?
Take care,
--
Paweł Różański
You use reference comparison. A tuple with 2-3 args represent (in
.NET) as ValueType - struct.
If you cast ValueType to object ValueType will be boxed and reference
comparison give False.
Use Equals method:
print(a.Equals(b))
I just wanted be sure that this is expected behaviour.
It seems so :) thanks
--
Paweł Różański
Yes, this is by design. I think we even specify somewhere that 2 and 3
tuples are structs.
> --
> Paweł Różański
>
> >
>
--
Kamil Skalski
http://nazgul.omega.pl