Gmane
Favicon
From: Gaal Yahas <gaal <at> forum2.org>
Subject: "returns" and context
Newsgroups: gmane.comp.lang.perl.perl6.language
Date: 2005-06-01 00:24:58 GMT (4 years, 4 weeks, 6 days, 23 hours and 9 minutes ago)
How do I specify the signature of a context-sensitive function?

     sub foo() returns (what?) {
         return want ~~ Scalar ?? cheap_integer_result :: List_of_Sheep;
     }

If it were two subs, one would "is returns" Int and the other List of
Sheep. The draft S29 uses things like Int|List to express this kind
of thing but that looks weird to me (how would you return a typed
junction?). S06 and E06 don't raise this issue.

-- 
Gaal Yahas <gaal <at> forum2.org>
http://gaal.livejournal.com/