value dispatch on enums?
Adam Megacz <[email protected]> Mon, 05 Jul 2004 01:43:10 +0000
| Newsgroups | gmane.comp.lang.nice.devel |
|---|---|
| Organization | Myself |
| Message-ID | <[email protected]> |
I think static dispatch is getting confused about values versus
variables when binding arguments within the body of a method:
The code:
enum Signal { High, Low, X }
Signal `&`(Signal, Signal);
`&`(High, x) = x;
`&`(X, x) = X;
`&`(Low, Low) = Low;
`&`(Low, z) = z & Low;
The error:
~/nice/src/com/megacz/test/Test.nice: line 8, column 19:
Ambiguity for symbol Low. Possibilities are :
com.megacz.test.Signal(Low) Low
com.megacz.test.Signal(Low) Low
It looks like Nice is trying to decide "which" Low to return when in
fact it doesn't matter (in fact since they're Enums, they must be both
.equals() and ==)
- a
--
"The first time I read this book I felt what I could only explain as a
great disturbance in the Force: it was as if a billion washing
machinces all became unbalanced at once and were suddenly silenced."
-- anonymous book reviewer on Amazon.com
-------------------------------------------------------
This SF.Net email sponsored by Black Hat Briefings & Training.
Attend Black Hat Briefings & Training, Las Vegas July 24-29 -
digital self defense, top technical experts, no vendor pitches,
unmatched networking opportunities. Visit www.blackhat.com