Thanks for pointing out the error and the best practice comment. When I
get the method to do what I really want I will post the solution.
Best,
-Tom
On Thu, Mar 19, 2015 at 10:33 PM, Tom Browder wrote:
> Why do you say that is not a method? The first line says
Sorry, somehow I managed to misread that.
So you want what I have already said twice: the accessor `self.elem`. If
you want to access the variable directly for some reason, you use
On Mar 19, 2015 9:30 PM, "Brandon Allbery" wrote:
> Unless there is more that you didn't show, that function is not a method
and has no `self`.
[Please ignore last msg sent prematurely.]
Why do you say that? The first line says it is a private method.
-Tom
On Mar 19, 2015 9:30 PM, "Brandon Allbery" wrote:
>
> On Thu, Mar 19, 2015 at 10:26 PM, Tom Browder
wrote:
>>
>> On Mar 19, 2015 8:58 PM, "Brandon Allbery" wrote:
>> > On Thu, Mar 19, 2015 at 9:32 PM, Tom Browder
wrote:
>> >>
>> >> if (self.$elem) { # <=== LINE 995 === LINE
On Thu, Mar 19, 2015 at 10:26 PM, Tom Browder wrote:
> On Mar 19, 2015 8:58 PM, "Brandon Allbery" wrote:
> > On Thu, Mar 19, 2015 at 9:32 PM, Tom Browder
> wrote:
> >>
> >> if (self.$elem) { # <=== LINE 995 === LINE 995
> > This is an indirect method call. Is that really wha
On Mar 19, 2015 8:58 PM, "Brandon Allbery" wrote:
> On Thu, Mar 19, 2015 at 9:32 PM, Tom Browder
wrote:
>>
>> if (self.$elem) { # <=== LINE 995 === LINE 995
> This is an indirect method call. Is that really what you intended?
No, it's supposed to be the value of the self attr
On Thu, Mar 19, 2015 at 9:32 PM, Tom Browder wrote:
> if (self.$elem) { # <=== LINE 995 === LINE 995
>
This is an indirect method call. Is that really what you intended?
If you wanted the `my` variable, it's just `$elem`.
If you somehow have an object in scope there (I don'
The error message is:
Cannot find method 'postcircumfix:<( )>'
in method _normalize_output at
/usr/local/people/tbrowde/mydata/tbrowde-home-bzr/perl6/my-perl6-repos/Geo-Ellipsoid/test/../lib/Geo/Ellipsoid.pm:995
in method to at
/usr/local/people/tbrowde/mydata/tbrowde-home-bzr/perl6/my-perl6-r
On 2015-03-19 4:17 PM, Tom Browder wrote:
On Thu, Mar 19, 2015 at 5:58 PM, Tobias Leich wrote:
The multi dispatcher *only* chooses the multi candidate by matching
arguments to parameters. The return type is not considered.
Okay, I have now kind of found that in the synopses (which are a bit
c
On Thu, Mar 19, 2015 at 5:58 PM, Tobias Leich wrote:
> The multi dispatcher *only* chooses the multi candidate by matching
> arguments to parameters. The return type is not considered.
Okay, I have now kind of found that in the synopses (which are a bit
confusing for me considering the function r
There is nothing exactly like wantarray in Perl 6. Functions can no longer
return different values based on context, because as Darren mentioned
above, it's a Bad Thing.
There are a few ways of doing something similar by returning mixins,
perhaps something like
return $num but [$num, $num2];
(w
So, I think that a proper solution here is for there to be a single method foo
that has the desired parameter signature, and have that method return a single
object which acts like / has the roles/interfaces of both of the return types
that 'wantarray' would have chosen between. Therefore, each
The multi dispatcher *only* chooses the multi candidate by matching
arguments to parameters. The return type is not considered.
Btw, the syntax for returning an arrayish thing might be: method foo($a,
$b --> Positional) { ... }
Am 19.03.2015 um 23:53 schrieb Darren Duncan:
> I think as a general
I think as a general principle, multi methods should dispatch entirely on their
parameter signatures, and dispatching on return type is just a bad design that
leads to trouble. If you want different return types for identical parameters,
you should give those 2 versions different method base na
I need to replace the Perl 5 'wantarray' and think a multi method with
differing return types should do it.
So I've tried this:
multi method foo($a, $b --> {Num,Num}) { #... }
multi method foo($a, $b --> Num) { #... }
and get errors like:
Missing block
at Ellipsoid.pm:672
--> ethod to($lat1
On Thu, Mar 19, 2015 at 10:15 AM, Moritz Lenz wrote:
> On 03/19/2015 04:05 PM, Tom Browder wrote:
>>
>> In Perl 5 I can do this:
...
>> 1. How can I combine arrays @a and @b into one array?
>
>
> generally with the comma operator:
>
> my @combined = @a, @b;
It looks like I can also do this:
my
On 03/19/2015 04:05 PM, Tom Browder wrote:
In Perl 5 I can do this:
my @a = (1, 2);
my @b = (3);
foo(@a,@b);
sub foo { my $n = @_; die "Wrong num args: $n" if ($n != 3);}
In Perl 6 I think this is correct (or nearly so):
sub foo(*@args) { die "Wrong num args: { @args.elems }" if @args.ele
In Perl 5 I can do this:
my @a = (1, 2);
my @b = (3);
foo(@a,@b);
sub foo { my $n = @_; die "Wrong num args: $n" if ($n != 3);}
In Perl 6 I think this is correct (or nearly so):
sub foo(*@args) { die "Wrong num args: { @args.elems }" if @args.elems != 3;}
Questions for Perl 6:
foo is now de
On Mar 19, 2015 3:02 AM, "Moritz Lenz" wrote:
> On 03/19/2015 12:40 AM, Tom Browder wrote:
> So, you can have an attribute $!x and a method x, but if you write
>
> class A {
> has $.x;
> method x() {... }
> }
>
> then the method will prevent the automatic accessor from being generated.
Th
Hi,
On 03/19/2015 12:40 AM, Tom Browder wrote:
I have a class with an attribute and a method with the same name and
it looks so far like they clash.
Attributes are always private. If you write 'has $.x', that generates
not only the attribute, but also an accessor method of name 'x'. See
also
20 matches
Mail list logo