On Sun, Jul 12, 2009 at 12:07:14AM -0400, Chas. Owens wrote:
> On Sat, Jul 11, 2009 at 22:02, Minimiscience<minimiscie...@gmail.com> wrote:
> >  - How does one declare multiple variables of the same type with a single
> > "my" statement?  Is it "my Int ($x, $y);", "my(Int $x, Int $y);", or
> > something else?  Are the parentheses still necessary when declaring more
> > than one variable?  What about when initializing more than one variable?
> 
> At least currently, only
>     my Int $x;
>     my Int $y;
> works.

The following works also -- note there has to be a space between
"my" and the leading paren, or else it's treated like a function call:

    my (Int $x, Int $y);

> >  - Is there some sort of shortcut (e.g., of the form ".‽method") for calling
> > a method on an object if the object is defined and returning undef if it is
> > not defined?  I was hoping that ".?method" could do this, but it doesn't
> > seem to (in Rakudo, at least).
> 
> Not a clue.

".?method" seems to work for me in Rakudo:

    $ cat x
    my $x = undef;
    say ($x.?foo).perl;

    $ ./perl6 x
    undef

Pm

Reply via email to