develooper Front page | perl.perl6.language | Postings from May 2005

"returns" and context

Thread Next
From:
Gaal Yahas
Date:
May 31, 2005 17:25
Subject:
"returns" and context
Message ID:
20050601002458.GT14133@sike.forum2.org
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@forum2.org>
http://gaal.livejournal.com/

Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About