While testing some of the OO code examples and having some
PHASERS(specifically a CONTROL PHASER) installed I ran across a MoarVM
Panic. The code is from the 'Object orientation' page -
https://docs.perl6.org/language/objects. A syntax error on my part in
calling the constructor with a CONTROL
The following code:
use v6;
my $str = 'abc';
sub s {1};
say s;
$str ~~ s:g/ b /x/;
dd $str;
say $/;
outputs:
1
Str $str = "axc"
(「b」)
as expected.
But, just remove the :g global flag and:
===SORRY!=== Error while compiling /home/hogaboom/hogaboom/Perl6/p6ex/./t.p6
Undeclared routine:
OK .. I mistakenly assumed that it should not compile from the doc
'(This does not work with the &zape variable)'.
my $tmp = Foo::Bar::<&zape>;
say $tmp(); # zipi - works
if ';; $_? is raw' is the signature, what does the ';;' mean and what
does '#`(Block|62717656) ...' mean?
On 10/11/18 9
#
# example from https://docs.perl6.org/language/packages
#
# from documentation under Package-qualified names:
#
# "Sometimes it's clearer to keep the sigil with the variable name, so
an alternate way to write this is:
# Foo::Bar::<$quux>
# (This does not work with the &zape variable) The name
k, but apparently
can't. The error should be selfexplanatory. Either you interpolate
using :: or <>, but not both...
JJ
El lun., 1 oct. 2018 a las 13:38, Richard Hogaboom
(mailto:richard.hogab...@gmail.com>>)
escribió:
Not exactly, but close. The following line is exactly f
Not exactly, but close. The following line is exactly from the doc. It
works. It it works, then the offending(next line) line should work as well.
my$bar='Bar';
say$Foo::($bar)::quux;
# compound identifiers with interpolations; OUTPUT: «42»
sayFoo::($bar)::<$quux>; # won't compile - but
This does not compile; I think it should:
use v6;
class Foo {
class Bar {
our $quux = 42;
}
}
say $Foo::Bar::quux; # works - 42
say Foo::Bar::<$quux>; # works - 42
my $bar = 'Bar';
say $Foo::($bar)::quux; # works - 42
# shouldn't this work too?
say Foo::($bar)::<$quux>; # n