Re: A question on AND

2023-07-01 Thread ToddAndMargo via perl6-users
> On 30/06/2023 06:06, ToddAndMargo via perl6-users wrote: >> if @*ARGS.elems > 0 && "@*ARGS[0]".lc eq "debug" {...} On 6/30/23 02:40, Richard Hainsworth wrote: I tried this and it worked without any problem. And today is is working for me as well without a problem. I must have had somethin

Re: A question on AND

2023-06-30 Thread Andy Bach
;> that you can safely use them after a list operator without the need >> for >> parentheses: >> >> unlink "alpha", "beta", "gamma" >> or gripe(), next LINE; >> >> With the C-style

Re: A question on AND

2023-06-30 Thread yary
out the need for > parentheses: > > unlink "alpha", "beta", "gamma" > or gripe(), next LINE; > > With the C-style operators that would have been written like this: > > unlink("alpha", "beta", "ga

Re: A question on AND

2023-06-30 Thread Andy Bach
or gripe(), next LINE; With the C-style operators that would have been written like this: unlink("alpha", "beta", "gamma") || (gripe(), next LINE); It would be even more readable to write that this way: unles

Re: A question on AND

2023-06-30 Thread Vadim Belman
And then nobody mentions that `and` has low priority. Try `say 42 & 13` and `say 42 and 13`. Best regards, Vadim Belman > On Jun 30, 2023, at 9:45 AM, yary wrote: > > Most of Richard's parting suggestions I understand & agree with, but not > this: " why are you using '&&' and not 'and' " >

Re: A question on AND

2023-06-30 Thread yary
Most of Richard's parting suggestions I understand & agree with, but not this: " why are you using '&&' and not 'and' " My habit (from Perl 5 days) is to use && || for expressions, and reserve "and" "or" for "do this if assignment/function call without parens succeeds/fails" – is there a refinemen

Re: A question on AND

2023-06-30 Thread Richard Hainsworth
I tried this and it worked without any problem. Here's the whole program: use v6.d; say @*ARGS.raku; if @*ARGS.elems > 0 && "@*ARGS[0]".lc eq "debug" { say 'got' } and at the terminal: $ raku todd-test.raku debug --debug=50 ["debug", "--debug=50"] got FWIW why are you quoting ARGS? The .l

A question on AND

2023-06-29 Thread ToddAndMargo via perl6-users
Hi All, This gets the finger wagged at me for a "Nil" when @*ARGS.elems equals zero: if @*ARGS.elems > 0 && "@*ARGS[0]".lc eq "debug" {...} I have to do this instead: if @*ARGS.elems > 0 { if "@*ARGS[0]".lc eq "debug" {...} } Do I misunderstand something? In an AND, is not the test

Re: a question on use and . in class declarations

2020-12-30 Thread ToddAndMargo via perl6-users
On 12/30/20 5:41 PM, ToddAndMargo via perl6-users wrote: A question on the "use" in a class declaration. In "use $.x". does the dot have a special meaning or is it just to make the value ($.x) easier to access ($objectname.x)? Many thanks, -T From my in p

a question on use and . in class declarations

2020-12-30 Thread ToddAndMargo via perl6-users
A question on the "use" in a class declaration. In "use $.x". does the dot have a special meaning or is it just to make the value ($.x) easier to access ($objectname.x)? Many thanks, -T

[perl #108866] [BUG] LTA error message ending in a question mark

2012-01-23 Thread Carl Mäsak
# New Ticket Created by "Carl Mäsak" # Please include the string: [perl #108866] # in the subject line of all future correspondence about this issue. # https://rt.perl.org:443/rt3/Ticket/Display.html?id=108866 > nom: class A { method x() { }; method x() { } } nom d83a1c: OUTPUT«===SORRY!===

Re: A question about role-private attributes

2008-11-09 Thread Jonathan Worthington
[EMAIL PROTECTED] wrote: I am trying to understand the following small portion from S12, and it seems slightly ambiguous to me: === from S12: You may wish to declare an attribute that is hidden even from the class; a completely private role attribute may be declared like this: C The na

A question about role-private attributes

2008-11-09 Thread [EMAIL PROTECTED]
I am trying to understand the following small portion from S12, and it seems slightly ambiguous to me: === from S12: You may wish to declare an attribute that is hidden even from the class; a completely private role attribute may be declared like this: C The name of such a private attrib

Re: A question about arrays

2008-10-16 Thread Larry Wall
On Thu, Oct 16, 2008 at 02:56:28PM +1100, Timothy S. Nelson wrote: > Hi all. I'm working on the code for trees that I keep talking about, > and I have code that somewhat resembles the following: > > role Tree::Node does Array { > has Tree::Node @!children handles ; > } > > The

A question about arrays

2008-10-15 Thread Timothy S. Nelson
Hi all. I'm working on the code for trees that I keep talking about, and I have code that somewhat resembles the following: roleTree::Node does Array { has Tree::Node @!children handles ; } The intent of this code is that, if you treat the Tree::Node as an array, you're operatin

Re: 99 problems in Perl6: 32 and a question on number coercion

2007-01-03 Thread Steffen Schwigon
gabriele renzi <[EMAIL PROTECTED]> writes: > Steffen Schwigon ha scritto: >> I looked at [1]. What's the purpose of "multi" in this case? >> (Maybe you wanted to write it as more than one subs, did you?) > > look the comment: > > # Yet, it should be possible to define it even for commutative rings

Re: 99 problems in Perl6: 32 and a question on number coercion

2007-01-03 Thread gabriele renzi
Steffen Schwigon ha scritto: Hi! gabriele renzi <[EMAIL PROTECTED]> writes: Hi everyone! I solved the (easy) problem 32, implementing gcd($a,$b). You can check the code in the repository or on the web[1] I looked at [1]. What's the purpose of "multi" in this case? (Maybe you wanted to write

Re: 99 problems in Perl6: 32 and a question on number coercion

2007-01-03 Thread Steffen Schwigon
Hi! gabriele renzi <[EMAIL PROTECTED]> writes: > Hi everyone! > > I solved the (easy) problem 32, implementing gcd($a,$b). > You can check the code in the repository or on the web[1] I looked at [1]. What's the purpose of "multi" in this case? (Maybe you wanted to write it as more than one subs,

99 problems in Perl6: 32 and a question on number coercion

2007-01-02 Thread gabriele renzi
Hi everyone! I solved the (easy) problem 32, implementing gcd($a,$b). You can check the code in the repository or on the web[1] But while writing this I noticed that a function written as sub gcd(Int $a, Int $b) still accepts float/rational values in input. I think I read once that a variable

Re: A question about .begin_eh

2006-06-14 Thread Bob Rogers
From: Chip Salzenberg <[EMAIL PROTECTED]> Date: Wed, 14 Jun 2006 12:05:29 -0700 [ Note to p6c: This thread is about the proposed and only partially specified ".begin_eh"/".end_eh" directives that would specify exception handling as a static property of a range of opcodes in a su

Re: A question about .begin_eh

2006-06-14 Thread Chip Salzenberg
[ Note to p6c: This thread is about the proposed and only partially specified ".begin_eh"/".end_eh" directives that would specify exception handling as a static property of a range of opcodes in a subroutine, rather than the current dynamic approach of C etc. I'm including p6c in case Lisp

Re: A question about .begin_eh

2006-06-12 Thread Bob Rogers
From: Chip Salzenberg <[EMAIL PROTECTED]> Date: Mon, 12 Jun 2006 06:54:24 -0700 On Sun, Jun 11, 2006 at 11:52:14AM -0400, Bob Rogers wrote: >I notice the following paragraph, vintage late May, in > pdd23_exceptions.pod: > >A C<.begin_eh> directive marks the beginning

Re: A question about .begin_eh

2006-06-12 Thread Chip Salzenberg
On Sun, Jun 11, 2006 at 11:52:14AM -0400, Bob Rogers wrote: >I notice the following paragraph, vintage late May, in > pdd23_exceptions.pod: > > A C<.begin_eh> directive marks the beginning of a span of > opcodes which the programmer expects to throw an exception. If > an exc

A question about .begin_eh

2006-06-11 Thread Bob Rogers
I notice the following paragraph, vintage late May, in pdd23_exceptions.pod: A C<.begin_eh> directive marks the beginning of a span of opcodes which the programmer expects to throw an exception. If an exception occurs in the execution of the given opcode span, P

Re: array interpolation implemented; a question

2005-03-07 Thread Larry Wall
On Sun, Mar 06, 2005 at 12:30:43PM -0500, Garrett Rooney wrote: : Autrijus Tang wrote: : >On Sat, Mar 05, 2005 at 02:39:06PM -0700, Luke Palmer wrote: : > : >>Garrett Rooney writes: : >> : >>>Garrett Rooney wrote: : >>> : >>> : Assuming the spec is correct, here's a patch to add some more tests

Re: array interpolation implemented; a question

2005-03-06 Thread Garrett Rooney
Autrijus Tang wrote: On Sat, Mar 05, 2005 at 02:39:06PM -0700, Luke Palmer wrote: Garrett Rooney writes: Garrett Rooney wrote: Assuming the spec is correct, here's a patch to add some more tests to t/op/string_interpolation.t. Of course, those should have been todo_is tests... Here's the right p

array interpolation implemented; a question

2005-03-06 Thread Autrijus Tang
On Sat, Mar 05, 2005 at 02:39:06PM -0700, Luke Palmer wrote: > Garrett Rooney writes: > > Garrett Rooney wrote: > > > > >Assuming the spec is correct, here's a patch to add some more tests to > > >t/op/string_interpolation.t. > > > > Of course, those should have been todo_is tests... Here's the

Re: A question about attribute functions

2004-09-01 Thread Larry Wall
On Wed, Sep 01, 2004 at 07:08:57PM +0200, Juerd wrote: : Larry Wall skribis 2004-09-01 8:02 (-0700): : > : $x.transform.(); : > That might not work either. This will, though: : > ($x.transform)(); : : This is surprising. Can you please explain why .() won't work? I have : methods return su

Re: A question about attribute functions

2004-09-01 Thread Juerd
Larry Wall skribis 2004-09-01 8:02 (-0700): > : $x.transform.(); > That might not work either. This will, though: > ($x.transform)(); This is surprising. Can you please explain why .() won't work? I have methods return subs quite often, and like that I can just attach ->() to it to make

Re: A question about attribute functions

2004-09-01 Thread Larry Wall
On Wed, Sep 01, 2004 at 08:02:33AM -0700, Larry Wall wrote: : That might not work either. This will, though: : : ($x.transform)(); So will $x.transform()(); for that matter... Larry

Re: A question about attribute functions

2004-09-01 Thread Larry Wall
On Wed, Sep 01, 2004 at 10:41:37AM -0400, Aaron Sherman wrote: : How do you declare attribute functions? Specifically, I was thinking : about map and what kind of object it would return, and I stumbled on a : confusing point: : : class mapper does iterator { : has &.transform;

A question about attribute functions

2004-09-01 Thread Aaron Sherman
How do you declare attribute functions? Specifically, I was thinking about map and what kind of object it would return, and I stumbled on a confusing point: class mapper does iterator { has &.transform; ... } Ok, that's fine, but what kind of access

Re: A question about binary does

2004-04-23 Thread Dan Sugalski
At 2:21 PM -0500 4/22/04, Abhijit A. Mahabal wrote: This is actually a couple of questions: 1: can you extend roles by saying: role Set is extended {} Parrot will allow this, so if Larry says OK you're fine. It may be rather significantly expensive, however. (Not nearly as bad as, say, adding an

Re: A question about binary does

2004-04-23 Thread Larry Wall
On Fri, Apr 23, 2004 at 09:42:51AM -0700, Larry Wall wrote: : : return $self.keys.grep { exists $other{$^a} } : : grepping a hash? Sorry--looked at that cross-eyed. Of course you can grep the keys... Larry

Re: A question about binary does

2004-04-23 Thread Larry Wall
On Thu, Apr 22, 2004 at 02:21:17PM -0500, Abhijit A. Mahabal wrote: : This is actually a couple of questions: : 1: can you extend roles by saying: role Set is extended {} Perhaps. Classes and objects that have already composed the role would have to be notified that they need to recalculate colli

A question about binary does

2004-04-22 Thread Abhijit A. Mahabal
This is actually a couple of questions: 1: can you extend roles by saying: role Set is extended {} 2: if yes, does this change variables for which you said $var does Set? In other words, is the singleton class like a closure or a first-class class? What follows is just some example code in case

Re: A question

2002-01-21 Thread Piers Cawley
Piers Cawley <[EMAIL PROTECTED]> writes: > Larry Wall <[EMAIL PROTECTED]> writes: > >> Piers Cawley writes: >> : Yeah, that's sort of where I got to as well. But I just wanted to make >> : sure. I confess I'm somewhat wary of the ';' operator, especially >> : where it's 'unguarded' by brackets, a

Re: A question

2002-01-21 Thread Piers Cawley
Larry Wall <[EMAIL PROTECTED]> writes: > Piers Cawley writes: > : Yeah, that's sort of where I got to as well. But I just wanted to make > : sure. I confess I'm somewhat wary of the ';' operator, especially > : where it's 'unguarded' by brackets, and once I start programming in > : Perl 6 then >

Re: A question

2002-01-20 Thread Larry Wall
Piers Cawley writes: : Yeah, that's sort of where I got to as well. But I just wanted to make : sure. I confess I'm somewhat wary of the ';' operator, especially : where it's 'unguarded' by brackets, and once I start programming in : Perl 6 then : : for (@aaa ; @bbb -> $a; $b) { ... } : : w

Re: A question

2002-01-18 Thread Piers Cawley
[reformatting response for readability and giving Glenn a stiff talking to] Glenn Linderman <[EMAIL PROTECTED]> writes: > Piers Cawley wrote: > >> Okay boys and girls, what does this print: >> >> my @aaa = qw/1 2 3/; >> my @bbb = @aaa; >> >> try { >> print "$_\n"; >> } >> >> for @aaa; @bbb ->

Re: A question

2002-01-18 Thread Glenn Linderman
That particular example is flawed, because the try expression is turned into a try statement because the } stands alone on its line. But if you eliminate a couple newlines between } and for, then your question makes sense (but the code is not well structured, but hey, maybe you take out all the n

A question

2002-01-18 Thread Piers Cawley
Okay boys and girls, what does this print: my @aaa = qw/1 2 3/; my @bbb = @aaa; try { print "$_\n"; } for @aaa; @bbb -> my $a; my $b { print "$a:$b"; } I'm guessing one of: 1:1 2:2 3:3 or a syntax error, complaining about something near C<@bbb -> my $a ; my $b {> In other words, how