Dan Sugalski: # At 7:30 AM +0000 1/24/03, Piers Cawley wrote: # >In my quest to eliminate as many explicit conditionals from # my code as # >possible, I found myself wondering if Perl 6's multidispatch # mechanism # >would allow one to write: # # Okay, I think I remembered the problem. Assume the following: # # list bar(int); # bar takes an int, returns a list # scalar bar(int); # bar takes an int, returns a scalar # # and also assume the following: # # xyzzy(scalar); # xyzzy takes a scalar # xyzzy(list); # xyzzy takes a list # # and then we make the call: # # xyzzy(bar(1)); # # Which bar do we call? And which xyzzy?
This is also a problem with using want(). If we don't provide wants_scalar/wants_list, someone will build it with want(), so we might as well try to address it. I suggest that want() return a special value when the calling context is ambiguous, and any wants_scalar/wants_list property be designed to accommodate this (probably by specifying which one should be the default). --Brent Dax <[EMAIL PROTECTED]> @roles=map {"Parrot $_"} qw(embedding regexen Configure) >How do you "test" this 'God' to "prove" it is who it says it is? "If you're God, you know exactly what it would take to convince me. Do that." --Marc Fleury on alt.atheism