Re: Context and return types question

2008-04-21 Thread TSa
HaloO, Larry Wall wrote: In general, we're trying to get away from want-based context dependency and instead attempting to encourage lazy semantic constructs such as Captures that can behave with a wide dynamic range when actually bound later. Shouldn't we then change the heading of the

Re: Context and return types question

2008-04-21 Thread TSa
HaloO, John M. Dlugosz wrote: How about sub foo (-- Seq^Item) {...}? Interesting idea, but that doesn't tell the compiler that the return is keyed to the context. The compiler should know what return type to expect, if only I could explain it. Sorry, the type has nothing to do with how

Re: Context and return types question

2008-04-21 Thread TSa
HaloO, John M. Dlugosz wrote: Great. So the flip side is, what do I return from a function so that it gives a single value if called simply, but provides optional named returns that are there if you catch them? As a capture with one positional and one named argument? Yeah, just that.

Re: Context and return types question

2008-04-21 Thread John M. Dlugosz
TSa Thomas.Sandlass-at-barco.com |Perl 6| wrote: I guess with strong you mean as lossless as possible? I think the type is just :( $: :named$ ) if you want to extract the invocant with a $ prefix. Otherwise it would be :( $, :named$ ) and you extract the item positionally with prefix @ or

Re: Context and return types question

2008-04-21 Thread TSa
HaloO, John M. Dlugosz wrote: I don't want to have to extract it. I want to be able to say $x = foo I guess that does not collapse the capture that foo returns. So it goes into $x unaltered. If you later use $x as an invocant of a method this extracts the invocant slot from the

Re: Context and return types question

2008-04-21 Thread Brandon S. Allbery KF8NH
On Apr 21, 2008, at 9:39 , John M. Dlugosz wrote: TSa Thomas.Sandlass-at-barco.com |Perl 6| wrote: I think the type is just :( $: :named$ ) if you want to extract the invocant with a $ prefix. Otherwise it would be :( $, :named $ ) and you extract the item positionally with prefix @ or

Re: Context and return types question

2008-04-21 Thread John M. Dlugosz
Brandon S. Allbery KF8NH allbery-at-ece.cmu.edu |Perl 6| wrote: my ($x, :$named) = foo; # or something like that That looks to me like a form of positional extraction. (Of course, my hit rate on p6 stuff has been remarkably low of late...) It's not just positional, but allows

Re: Context and return types question

2008-04-18 Thread TSa
HaloO John, your inquiry rate is quite high. I try to keep-up as good as I can. Without being authoritative, of course. you wrote: If a function returns different things if called in list context or item context, how do you define the of type (outer return type) to make the function strongly

Re: Context and return types question

2008-04-18 Thread Larry Wall
On Fri, Apr 18, 2008 at 05:34:25AM -0500, John M. Dlugosz wrote: If a function returns different things if called in list context or item context, how do you define the of type (outer return type) to make the function strongly typed? You can't. An of type forces the function into a single

Re: Context and return types question

2008-04-18 Thread John M. Dlugosz
If a function returns different things if called in list context or item context, how do you define the of type (outer return type) to make the function strongly typed? How about sub foo (-- Seq^Item) {...}? Interesting idea, but that doesn't tell the compiler that the return is keyed to

Re: Context and return types question

2008-04-18 Thread John M. Dlugosz
Great. So the flip side is, what do I return from a function so that it gives a single value if called simply, but provides optional named returns that are there if you catch them? As a capture with one positional and one named argument? And how do you declare =that= return type (of type)