--- Comment #17 from Steven Schveighoffer <schvei...@yahoo.com> 2011-06-28
04:56:43 PDT ---
(In reply to comment #11)
> The use case I can remember being discussed is using 'v is float.init' to
> determine if a floating point value is uninitialized or is a nan due to the
> result of a calculation.
> Maybe Steven or Don have an opinion on this feature they asked for?
> 'isIdentical' seems to do a straight bitwise comparison.
Quite simply, the above (v is float.init) is my use case. In some parts of the
code, the runtime is responsible for default initializing data. I wanted to
verify that my code was properly initializing the data to T.init.
This is impossible without casting the value to a ubyte array to do a
comparison (and even then, it's not quite right, because you can have garbage
data in some cases).
But it makes no sense to me for is to ever do anything but a bitwise compare.
In other words, given any type T (and I mean any type T):
assert(t is t);
should always pass. It makes no sense to me for is to do anything else -- it's
low-level bitwise comparison that bypasses any operators.
To make this true for every type *except* floating point types seems like a
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------