Technically speaking, it's mojibake.
Larry
On Fri, Jul 1, 2022 at 7:34 PM ToddAndMargo via perl6-users <
perl6-us...@perl.org> wrote:
> Hi All,
>
> Windows 10 Pro - 21H2
> RakudoMoar-2022.06.01-win-x86_64-msvc.msi
>
> > raku -v
> Welcome to RakudoΓä
ll do that for cases where $_ is
provably an integer, I guess.)
Larry
On Mon, May 31, 2021 at 08:09:05PM -0400, yary wrote:
: Thanks for the explanation, I think the docs (and Roast) also can be more
: explicit on the difference between
: $left ~~ $right
: and
: $right.ACCEPTS($l
ACCEPTS(Numeric:D: $other)
Returns True if $other can be coerced to Numeric and is numerically equal
to the invocant
(or both evaluate to NaN).
And I'd be awfully surprised if any(4,3) can be coerced to Numeric in any
meaningful way...
Perhaps this should be documented as a trap for people coming from Perl, if it
isn't already.
Larry
eryone,
so the vector-processing paradigm is not the default. (But we make it
really easy to get to when you want it, as you can see. And arguably
the explicit presence of » or >> makes your intent clearer to the naïve
reader, who at least has something to look up or ask about if they don't
understand it.)
Larry
ck out is "unknifing" them...
As for OT, everthing is OT here, since we're talking about Raku in a Perl 6
mailing list... :)
Larry
On Wed, Sep 02, 2020 at 10:25:52AM -0400, Parrot Raiser wrote:
: Possibly OT, the "-er/-ee" boundary has become corrupted in recent usage.
(1..2) { say (INIT $ = 'AAA')++ } }"
AAA
AAB
AAC
AAD
If you want to re-initialize a state variable, it's probably better to make
it explicit with the state declarator:
$ raku -e "for { for (1..2) { say (state $ = 'AAA')++ } }"
AAA
AAB
AAA
AAB
Larry
o that you could run your mental model
either way, depending on whether you think the object itself does the
method or the calling context does the method on behalf of the object.
There is no single right answer here. C++ programmers will think of it
very differently from Smalltalk programmers.
Larry
d, I
don't see any reason why the current levels would change in the
next century or two...but no guarantees...
Larry
stole
.. and ... in Raku for ranges and sequences so we needed something else.)
I suppose if you're musical you can come up with mnemonics based on "fff"
being louder than "ff", so it echoes longer before it stops... :)
Larry
numerous of them potentially useful in one-liners, but
>one of my favorite for one-liner use is Regexp::Common, which, as
>its name suggests, contains regular expressions to match numerous
>commonly-used pieces of data.
>
>The full set of regexes available in Regexp::Common is available in
>its documentation, but here's an example of where I might use it:
>
>Neither the ifconfig nor the ip tool that is supposed to replace it
>provide, as far as I know, an easy way of extracting information for
>use by scripts. The ifdata program provides such an interface, but
>isn't installed everywhere. Using perl and Regexp::Common, however,
>we can do a pretty decent job of extracing an IP from ips output:
>
>ip address list eth0 | \
> perl -MRegexp::Common -lne 'print $1 if /($RE{net}{IPv4})/'
I don't know if there's anything quite comparable. And who's to say
what's "common" anymore... Certainly we have -M. But Raku's regex
and grammars are so much more powerful that these things are likely to
kept in more specific Grammar modules anyway, or just hand-rolled for
the purpose on the spot.
>~nelhage Join the discussion Comments ( 7 )
Larry
On Tue, Apr 07, 2020 at 09:15:06AM -0700, Larry Wall wrote:
: Maybe if I actually put a Chinese character in like 楽 it will leave it in
UTF-8?
Oops, actually, now that I think about it, 楽 (raku) is a Japanese-only
character.
The Chinese equivalents are traditional 樂 and simplified 乐.
I really
%hash-with-arrays.values>>[].flat
but for some reason mutt translated it to latin-1, which your mail program
apparently doesn't grok.
Maybe if I actually put a Chinese character in like 楽 it will leave it in UTF-8?
Testing:
%hash-with-arrays.values»[].flat
Larry
Oh, you wanna go deep? Why stop at 10 levels?
say gather %hash-with-arrays.values.deepmap: { .take }
No .flat needed, even.
Larry
On Sat, Apr 04, 2020 at 10:59:36PM +0100, Ralph Mellor wrote:
: [**] will be a wonderful thing when it's implemented.
:
: In the meantime, you could mayb
You can also do a hyper descalarize if you're into that sort of thing:
%hash-with-arrays.values»[].flat
Larry
r to
a routine. Add "is copy" to the declaration if you want to modify it.
Larry
return arguments allowed when return value Bool::True is already
specified in the signature
Larry
contract
into a time-traveling brain pretzel. For instance, what if one of the phaser
traits
needs to know will be returned, and the 'returns' comes after that? Putting in
error
messages that say "Too late for returns trait" is a design smell...
So never say never. :)
Larry
ess, that can be indicated with --> True.
Larry
st later on, but syntactically it's just a single
expression inside the bracketing chars. So in @a[42,43], there are
still only two arguments, @a array and the 42,43 list expression.
Larry
and want them to to stay nested by default, while the function
form is optimized for, er, the typical Perl 5 programmer who expects
random list flattening in various places.
Larry
I is working. The fact that it can be used this way
is not at all contradictory to the description of what the Inf value *is*.
But the description of what it can do really belongs on the many places
where it can be used in various metaphorical ways, not in the definition
of what it is. The floating-point Inf value really has no clue whatsoever
about all the ways it might be used. It probably doesn't even realize
it can be compared with an integer. :)
Larry
infix
The careful distinction of which category the grammar engine is expecting
is critical to understanding any version of Perl, whether 5 or 6.
You can't adequately describe any random syntax in Perl without first
nailing down which of the main grammar rules is going to be parsing it.
Well, I've probably said more than enough. :)
Larry
On Sat, Sep 22, 2018 at 11:40:13AM -0700, Joseph Brenner wrote:
: Sounds good, thanks.
Well, yes, *sounds* good. :-)
Monkey patching is allowed but discouraged in Perl 6, because Ruby.
Larry
d never choose any of them, apart from \N. Where are you getting
this craptastic list from?
Larry
acter classes are always inside angles in Perl 6, and inside those
angles, you can combine Unicode properties and enumerated character classes:
<:L + :N + [_]> A letter or a number or an underscore
Same thing
\wSame thing
Well, okay, I lied, since \w is a character class that is not inside angles. :)
Larry
ts
identity from its associated packages, since it can ignore them entirely.
What it can't ignore is its textual position. A block's location is
its real identity, where it "belongs".
Larry
ot of external variables.
Though "lambda" also implies this to someone who speaks the Functional
Programming lingo. So if you meet an FP person and want to sound smart,
just tell them:
"-> is how we spell λ in Perl 6"
Larry
e never mix them up either, but we also never put subs
into packages by default. The reason Foo::bar notation doesn't work is
because bar isn't in Foo anymore unless you explicitly put it there.
Larry
an undefine Int to indicate no value was passed. You'd have
to write Int:D(Cool) to mean the other thing, and then yes, it couldn't
be optional.
: And another foul!
: There is no stating what the return value is. It
: should be of single value of type Bool.
Indeed, the signature should include --> Bool to indicate that.
Larry
il and Junction it's better to cargo cult
a few common usages and stay the heck away the rest of the time.
Larry
it into a method, and
going the other way, you can pull a method out of a class and call it
like a function.
So basically, if it's meant to be called with .foo notation, call it a
"method", and if it's meant to be called with foo() notation, call it
whatever you like. But not "method". :)
Larry
Oh, I guess Timo suggested .defined. I should relearn to read, now that
I can see again...
Larry
sic method:
say index("abc", "z").defined ?? "True" !! "False"
Larry
if not for the compiler.
Anyway, don't be a language designer if you want to make everyone happy
all the time. :-)
Well, actually, you can want it, just don't expect it... :-)
Larry
out of the optimizer, which is post parser, but pre-runtime. We
could conceivably stop the -c after the optimizer is run.
Larry
I'd probably just write something like:
s:g { « <( 0+ )> \d+ » } = '';
The first <( and the last » are not strictly necessary, but add clarity, or
at least balance. But in golf mode you could get away with something like:
sg/«0+)>\d//;
Larry
of braces:
$ p6 'sub flowers() { { say "My subroutine name is <",
callframe(0).code.name, ">" } }; flowers;'
My subroutine name is <>
$ p6 'sub flowers() { { say "My subroutine name is <", &?ROUTINE.name, ">"
} }; flowers;'
My subroutine name is
Larry
work for those loops too, since they are
controlled by the "for", not by the expression you feed to the "for".
Larry
bcrd-12.3.4".comb.Bag{"a"..."z"}.sum.say'
5
$ p6 '"abcrd-12.3.4".comb.Bag{"0"..."9", "."}.sum.say'
6
That's more ASCII friendly, but ASCII is not always your friend. :-)
Larry
be completely weirded out if someone
used it that way, since dynamic typing (figuring out types on the fly)
has almost nothing to do with either lexicons or lexical scoping.
So I suspect someone has subjected you to a rather idiosyncratic
term and definition there...
Larry
ments going on with the ... operator too. But it's more
like other list associative operators insofar as all the operators in
a given precedence level's subexpression must be identical.)
Hope this helps,
Larry
On Fri, Jan 26, 2018 at 10:50:19AM -0800, Sean McAfee wrote:
: Today I stum
Fixed in 754664ed54aea24f9c9162002b6e68aadd311412.
On Wed, 08 Oct 2014 05:20:07 -0700, timo wrote:
> compare:
>
> > perl6-m -e 'enum Bug ("foo" => -1, "A", "B"); say +A; say +B;'
> > 1
> > 2
>
> and:
>
> > perl6-m -e 'enum Bug (foo => -1, "A", "B"); say +A; say +B;'
> > 0
> > 1
>
> an
Fixed in 754664ed54aea24f9c9162002b6e68aadd311412.
On Thu, 28 Apr 2016 07:06:42 -0700, gfldex wrote:
> enum Bits ( (('Bit-' X~ 1..8) Z=> (1, 2, 4 ... 256)) ); dd Bits.enums;
> # OUTPUT«{"Bit-1\t1" => 0, "Bit-2\t2" => 1, "Bit-3\t4" => 2, "Bit-
> 4\t8" => 3, "Bit-5\t16" => 4, "Bit-6\t32" => 5, "Bit-
Fixed in 754664ed54aea24f9c9162002b6e68aadd311412.
Note however, that there's a braino above, since the 'my' is initialized after
the value is needed. So the fix is to warn about an empty variable, not to
make it work. (It does work if you make it a constant, or put the my inside a
BEGIN.)
On
Actually, the Z=> misbehavior is already called out in #128017.
On Tue, 28 Nov 2017 00:04:05 -0800, larry wrote:
> This also showed up when doing things like:
> enum Foo ( Z=> 1,2,3);
>
> Fixed in d9021cf16e7df051c5e17c33919c9bde44c5e0db but tests needed.
>
>
> O
Actually, the Z=> misbehavior is already called out in #128017.
On Tue, 28 Nov 2017 00:04:05 -0800, larry wrote:
> This also showed up when doing things like:
> enum Foo ( Z=> 1,2,3);
>
> Fixed in d9021cf16e7df051c5e17c33919c9bde44c5e0db but tests needed.
>
>
> O
This also showed up when doing things like:
enum Foo ( Z=> 1,2,3);
Fixed in d9021cf16e7df051c5e17c33919c9bde44c5e0db but tests needed.
On Mon, 07 Nov 2016 11:37:06 -0800, FROGGS.de wrote:
> m: enum Foo ( A => 42, 'B', 'C', 'D' ); say +B
> rakudo-moar e10f76: OUTPUT«43»
>
> m: enum Foo ( 'A
continue parsing even though we know we
will blow up at the end of the parse. So relaxing this in the parser
from immediately fatal to fatal later may be as easy as changing a .panic
to a .sorry somewhere.
Larry
Yes, as noted above, this is a dup of rejected ('better docs needed', really)
ticket #130562.
Yes, as noted above, this is a dup of rejected ('better docs needed', really)
ticket #130562.
Only *@foo and *%foo are slurpy, as in "slurping up the rest of the arguments.
But the term "variadic" refers to all optional arguments including named ones,
so it would be incorrect to call those "slurpy", because they don't. It's like
the difference betwe
Only *@foo and *%foo are slurpy, as in "slurping up the rest of the arguments.
But the term "variadic" refers to all optional arguments including named ones,
so it would be incorrect to call those "slurpy", because they don't. It's like
the difference betwe
We now warn on the ambiguity of >> or » when used where it could easily be
intended as either a hyper or the quotewords terminator. While we could, in
theory, do some lookahead to try to suppress this warning in some cases, it
will be brittle in the face of languages that mutate the postfix spa
On Fri, 09 Jan 2015 10:59:08 -0800, masak wrote:
> m: say :256["☺".ords]
> rakudo-moar c5dcdf: OUTPUT«9786»
> m: say :256[0x263a]
> rakudo-moar c5dcdf: OUTPUT«9786»
> seems we could use a check there...
> m: say :256[256,256]
> rakudo-moar c5dcdf: OUTPUT«65792»
> * masak submits rakudobug
a file was executed directly or
: loaded into memory as a module?
:
: regards
: Gabor
If you write a MAIN sub, it should be called only if the file was executed
directly.
Larry
orarily pretend the thing
is in Latin-1 encoding. But yeah, buffers should be treated stringier
in the long run.
Larry
since
sub postfix:(Int $n) { [*] 2..$n }
is easier.)
Larry
06:31 < [Coke]> iBakeCake: latest message on perl6-users about log(23,0) seems
to be something in your current wheelhouse
06:32 < iBakeCake> [Coke]: what is it?
06:32 < iBakeCake> Isn't log base 0 undefined
06:32 < moritz> log to base 0?
06:32 < [Coke]>
http://www.nntp.perl.org/group/perl.perl6.u
tementlist level should be self-sinking by default.
The loop and repeat forms of loop were not doing this correctly.
Fixes RT #127563 and RT #128596.
Larry
or not.
:
: So now I'm wondering what i did differently from you?!
Used a newer version, I'll warrant.
Larry
On Sat, Oct 01, 2016 at 07:57:34PM +0200, mimosinnet wrote:
: @opposite = @opposite.sort({@$^a[3]});
I'd probably write that as:
@opposite .= sort: { $^a[3] }
or maybe just
@opposite .= sort( *[3] );
Larry
};
foo(10);'
: Hello
That is, in fact, a correct way to write it.
: It seems that "Whatever *" cannot handle sigilless values correctly.
The sigilless variable isn't declared yet, so a.WHAT doesn't work either. But
this is another correct way to write it:
$ perl6 -e 'sub foo(\a where { .WHAT === Int } ) { say "Hello"; }; foo(10);'
Hello
Larry
};
foo(10);'
: Hello
That is, in fact, a correct way to write it.
: It seems that "Whatever *" cannot handle sigilless values correctly.
The sigilless variable isn't declared yet, so a.WHAT doesn't work either. But
this is another correct way to write it:
$ perl6 -e 'sub foo(\a where { .WHAT === Int } ) { say "Hello"; }; foo(10);'
Hello
Larry
Rakudo now gives a decent error (X::Syntax::Signature::InvocantNotAllowed), and
there's even a test for it.
I'm fine with the rakudo behavior here.
The chance of someone using $. inside a regex and meaning what it means in Perl
5 is minimal. Best to just leave this as a "can never match".
Test was bogus. Replaced with test that assumes Empty semantics on next.
test fixed in 06f9c5d010986a7a8dde907971e25985e8ba4601
The code generator in nqp for char ranges was incorrectly using ordat and
ordfirst to find the character to compare, which throw away information on
synthetic characters. We now use the getcp_s instruction instead, which leaves
synthetics negative, so that they drop out of the character range c
Binding of the map routine internally now requires list elements to bind as
Pair, which improves the error message.
(The alternate approach of inserting a CATCH into the map closure could in
theory produce an even better message, but it appeared to slow things down more
than the Pair binding ap
Some method calls were not properly sunk as a final statement in a loop.
Fix in 977797fa401856e5310155f13469b7e6ff5f620a
Test in bc8fa4fd8d449573eb6001b5f43f8890f65b9196
The unwanted() routine needed to add an explicit sink to certain methods found
in a block-final Want node. (Method calls for dispatch:<.=> and Pair.new are
exempt, however. In the case of .=, it is 'nosink' because it's essentially
going to cause a side effect anyway, and doing it twice tends t
The repeat and loop constructs weren't properly self-sinking at statementlist
level.
Fixed in 589061eac14f2847e2c4b401d2ff2eb30c62675e
Test in cbbff3ba0f1120fe7dfded0a980f9b73263f0868
The repeat and loop constructs were not properly sinking themselves at
statementlist level.
Fixed in 589061eac14f2847e2c4b401d2ff2eb30c62675e
Untodo'd existing test.
We now examine the preceding character, and if it's a closing brace, suggest
use of whitespace before curlies taken as a hash subscript.
Fixed in 7ec824e52ab5b285cda47179e6f41e452d870762
This turns out to be a fascinating bug, not the usual "useless use of useless
use".
We were cloning a closure twice because we were calling EXPR twice on the same
expression, namely inside the 'for' rule that looks for a C-style for loop. It
was doing this inside a because it was just conject
We've split the non-associative exceptions into the base class,
X::Syntax::NonAssociative, with a subclass off X::Syntax::NonListAssociative.
nqp's EXPR now calls a different method to fail list associativity, and rakudo
provides the alternate method to get the appropriate message.
nqp fix in
The onearg form of reduce wasn't correctly marking wantedness of either the
operator or the argument.
Fixed in fc28b67185d711cf8e4b3f9e6987e1ceee34e37b.
(We don't test sink warnings currenlty.)
The logical ops andthen, notandthen, and orelse were not propagating wantedness
to their thunky args.
Fixed in 7ba6dbfae97f5ff9398336e49267d51606512df9.
Note that we don't generally test sink warnings currently.
ers. We can't guess
(well, we *could* guess, but can't know) which way the user will want to
use these, so the conservative approach is to make neither of them work,
and let the user take an additive approach, rather than forcing them to
use a subtractive approach if we guessed wrong.
Larry
ad of shell style, use something like this:
token ws { [ \s+ | '/*' .*? '*/' ]* }
or slightly fancier:
token ws { [ \s+ | '/*' ~ '*/' .*? ]* }
The latter form allows you to define a FAILGOAL rule to give an error message
when it
can't find the closing '*/'.
Larry
ck rather than a CATCH block.)
: ...also I now know that I should not use warn in many cases where I would
: have otherwise.
If you need to produce actual warnings in hot code, something's wrong
with your design. (If you just want to print to STDERR, you can use
'note' instead.)
Larry
Not A Bug.
LTM requires it to recognize => over = inside, and then you're missing a >.
Looking at it from the other direction, thinking that it will find the >> on
the end and then back up to isolate the = is a subtle mental trap of two-pass
parsing, which is typically forbidden in Perl 6. To
On Mon, Apr 11, 2016 at 11:32:29PM +0200, Theo van den Heuvel wrote:
: Thanks Larry for the answer and the great language.
:
: It is quite ok for me to start alphabetically. I use the funny char
: to indicate a particular aspect shared by a bunch of subs operators
: and methods.
: So I tried
❤>, but
that would be an operator, not a method call, so you'd have to write
your postfix:<❤> operator to call the actual method in turn, with
sub postfix:<❤> ($f) { $f.'❤'() }
or so...
Larry
On Sun, Apr 10, 2016 at 03:23:21PM +0200, Theo van den Heuvel wrote:
:
Now says: Virtual method call $.foo may not be used on partially constructed
object (maybe you mean $!foo for direct attribute access here?)
Fix in 5a69da88b9b16f916125add8f89aff68113a9877
Dup of #127013, see fix there.
Dup of #127013.
Tests for this particular ticket in a8bbde8fa06d5d55bc6d5879a0c84a669d7f0481
Fix in 386905f6f62f9fa3525c887a8a86fa48b22b4b35 and
37e742f0bb6f36f1a9d9a5f947c5c0de15d236c2
Test in ba521fa8101f3114c87ec1a295707cb68b5b
Fixed in 02588190492349fabde00c5a15b873ea61a9333e
Tested in 2f126a3ab7d0991767ca84c562b8f3ae97b25c4e
There are no tests there for with or whenever, but those did not appear to
misbehave when I tried them on the command line. Feel free to add more tests
for those.
A new restricted dialect of regex is implemented in
28ab83f947b4899a4f8698eee5bc056742f356f1 and
19d84be0066978f616ace6fa9f506e742161a378
Tests in 1becd7c9b456b707a14bfba40d672ec28945f199
Fixed in 091ee7507464595e7712f4ae911d95d467e5281b
Tests in 8b97aa4f6191affdd91da78607eca4ae6dc73b11
fixed in 323a5c077efeaa058de48871963046507e33b272
Minimal test case:
{ my $f := Failure.new("bar"); }
This doesn't seem to be sink related, at least not directly. It seems more to
be related to the difference between storing things in a local vs in a lexical,
and how those are treated on statement or return boundaries.
I shouldn't file bugs when I haven't slept...
~~ is now chaining where it can be; it obviously makes little sense to chain
something on both sides that is not a normal data value. So if you include a
regex or a closure, it must be the final test. Also, in order
to get $a ~~ $b ~~ $c to work, we cannot topicalize $b.
Fix in f457007181bb6e2
Fixed, along with all the other metaops, in:
1e1556b1a25bc4c73a505fdd249d4179ffc813de
0a2303c0f6a2a3782fecb13db1523cb5442467de
67202d697d3fe48b800e95262bebe6da17bfcf49
e2e23fb8853808839884f23a0b8aa91f458fd310
97ef742f350e84dae275ed2dc9d453795f057dba
6516930c86d6ff4296ee8699a64eb1315eed2583
Tests:
The add_categorical method was assuming it was adding a fresh definition of an
operator, not one borrowed from a module, so it overrode the existing
precedence with the defaults, which are wrong if the existing precedence
doesn't happen to match the default.
Fixed with bb598968c68bff2163322aea0
Fixed with 67795245fd9b17ca11036b63aa04e17deabb8e7a
Tests needed.
The default of die is to, er, die. You can resume after a die, but only if you
do so explicitly, in which case you are responsible for overriding the
expectations of whoever wrote the die and likely did not expect it to return.
> p6 'sub a($a) { $a(); CATCH { default { say "default"; .resume }
fix in MoarVM, 6da907f72a8a0015f4631b7d11a20fc428e9aad4
test in 0d2a5c01972d11c0a35573e8362c040bf974cde3
1 - 100 of 3629 matches
Mail list logo