On 2020-01-23 06:15, Elizabeth Mattijsen wrote:
Larry Wall once warned that the "return..." syntax may be removed at some point.
"return..." is a common idiom in many programming languages, and
keeping it around might help programmers ease their transition to
raku/perl6. So I'd hate to see "retu
On Thu, Jan 23, 2020 at 08:15 Elizabeth Mattijsen wrote:
> >> Larry Wall once warned that the "return..." syntax may be removed at
> some point.
> > "return..." is a common idiom in many programming languages, and
> > keeping it around might help programmers ease their transition to
> > raku/perl
>> Larry Wall once warned that the "return..." syntax may be removed at some
>> point.
> "return..." is a common idiom in many programming languages, and
> keeping it around might help programmers ease their transition to
> raku/perl6. So I'd hate to see "return" go away--at least for the
> forese
On Tue, Jan 21, 2020 at 5:00 AM Tom Browder wrote:
>
> On Mon, Jan 20, 2020 at 22:16 ToddAndMargo via perl6-users
> wrote:
>>
>> On 2020-01-20 20:09, ToddAndMargo via perl6-users wrote:
>> > On 2020-01-20 19:55, ToddAndMargo via perl6-users wrote:
>
> ...
>>
>> > I think this is it:
>> >
>> > >
On 2020-01-21 22:44, Peter Pentchev wrote:
On Tue, Jan 21, 2020 at 07:16:17PM -0800, Todd Chester via perl6-users wrote:
On 2020-01-21 18:57, Tom Browder wrote:
On Tue, Jan 21, 2020 at 18:34 Todd Chester via perl6-users
mailto:perl6-us...@perl.org>> wrote:
On 2020-01-21 16:09, Todd Ches
On Tue, Jan 21, 2020 at 07:16:17PM -0800, Todd Chester via perl6-users wrote:
>
>
> On 2020-01-21 18:57, Tom Browder wrote:
> > On Tue, Jan 21, 2020 at 18:34 Todd Chester via perl6-users
> > mailto:perl6-us...@perl.org>> wrote:
> >
> > On 2020-01-21 16:09, Todd Chester via perl6-users wrote:
On 2020-01-21 18:57, Tom Browder wrote:
On Tue, Jan 21, 2020 at 18:34 Todd Chester via perl6-users
mailto:perl6-us...@perl.org>> wrote:
On 2020-01-21 16:09, Todd Chester via perl6-users wrote:
>> 4) A block (that is the { ... } bit) will always 'return' the last
>> expression e
On Tue, Jan 21, 2020 at 18:34 Todd Chester via perl6-users <
perl6-us...@perl.org> wrote:
> On 2020-01-21 16:09, Todd Chester via perl6-users wrote:
> >> 4) A block (that is the { ... } bit) will always 'return' the last
> >> expression evaluated.
> >
> > Seems to me I have see the last expression
On 2020-01-21 16:09, Todd Chester via perl6-users wrote:
4) A block (that is the { ... } bit) will always 'return' the last
expression evaluated.
Seems to me I have see the last expression returned even without
the {...}. Maybe I am misremembering.
> sub AplusB( $a, $b --> Int ){$a+$b;}
On 2020-01-21 14:03, Elizabeth Mattijsen wrote:
On 21 Jan 2020, at 22:37, Richard Hainsworth wrote:
2) 'returns' in the declaration (not the part in the block) used to be used,
but for some arcane reason that I never really understood, it is deprecated.
Not sure it is *the* reason, but the
> On 21/01/2020 04:09, ToddAndMargo via perl6-users wrote:
>> On 2020-01-20 19:55, ToddAndMargo via perl6-users wrote:
>>> Hi All,
>>>
>>> What is the proper way to state that I am returning a
>>> hash from a sub? `sub x() returns % {}`
>>>
>>> And an array? `sub x() returns @ {}`
>>>
>>> Many
> On 21 Jan 2020, at 22:37, Richard Hainsworth wrote:
> 2) 'returns' in the declaration (not the part in the block) used to be used,
> but for some arcane reason that I never really understood, it is deprecated.
Not sure it is *the* reason, but the return type is part of the signature of a
bloc
sub x( --> Hash) { my %h = A => 'a' }
1) '-->' in the signature is the best way to provide information to the
compiler about what the subroutine should return
2) 'returns' in the declaration (not the part in the block) used to be
used, but for some arcane reason that I never really understood
On 2020-01-21 05:00, Tom Browder wrote:
The preferred syntax is:
sub x(--> Hash) {...}
See that in the docs.
Larry Wall once warned that the "return..." syntax may be removed at
some point.
-Tom
Hi Tom,
Interesting. I have been showing both in my keepers.
I currently use "returns "
On Mon, Jan 20, 2020 at 22:16 ToddAndMargo via perl6-users <
perl6-us...@perl.org> wrote:
> On 2020-01-20 20:09, ToddAndMargo via perl6-users wrote:
> > On 2020-01-20 19:55, ToddAndMargo via perl6-users wrote:
...
> > I think this is it:
> >
> > > sub x() returns Associative { my %h= A=>"a"; re
On 2020-01-20 20:36, 浪花城主 wrote:
How about returning a reference?
Just for test (sorry I have no perl6 installed on local device):
$ perl -le 'sub x {%hash=(1,2,3,4);\%hash}; print x->{1}'
2
Regards.
Hi 浪花城主,
No Perl6 installed I am Heart Broken!!! Why!
Why! KIDS THESE DAYS!!
:-)
I
How about returning a reference?
Just for test (sorry I have no perl6 installed on local device):
$ perl -le 'sub x {%hash=(1,2,3,4);\%hash}; print x->{1}'
2
Regards.
On Tue, Jan 21, 2020 at 11:56 AM ToddAndMargo via perl6-users <
perl6-us...@perl.org> wrote:
> Hi All,
>
> What is the proper w
On 2020-01-20 20:09, ToddAndMargo via perl6-users wrote:
On 2020-01-20 19:55, ToddAndMargo via perl6-users wrote:
Hi All,
What is the proper way to state that I am returning a
hash from a sub? `sub x() returns % {}`
And an array? `sub x() returns @ {}`
Many thanks,
-T
I think this is it
On 2020-01-20 19:55, ToddAndMargo via perl6-users wrote:
Hi All,
What is the proper way to state that I am returning a
hash from a sub? `sub x() returns % {}`
And an array? `sub x() returns @ {}`
Many thanks,
-T
I think this is it:
> sub x() returns Associative { my %h= A=>"a"; return %
19 matches
Mail list logo