🦋 Welcome to Raku! raku.org/ | evalbot usage: 'p6: say 3;' or /msg camelia p6: ... | irclog: colabti.org/irclogger/irclogger_log/raku
Set by ChanServ on 14 October 2019.
[Coke] 41 ballots reporting (Average votes per ballot: 4.59) 00:58
.tell detroitdan - there is a package installer for windows here rakudo.org/downloads 00:59
tellable6 [Coke], I'll pass your message to DetroitDan
[Coke] .tell detroitdan I also build from source every so often with msvc on windows (using msvc & strawberry perl)
tellable6 [Coke], I'll pass your message to DetroitDan
Geth Raku-Steering-Council/main: 2c09bb94a9 | Coke++ | scripts/tally.raku
show a little more precision
01:00
Xliff Hrm. 07:02
I'm getting the following error: 07:03
$!c = $cancellable;
self.roleInit-Object;
Actually, not that one... this one:
===SORRY!=== Error while compiling /home/cbwood/Projects/p6-GIO/lib/GIO/ApplicationCommandLine.pm6 (GIO::ApplicationCommandLine)
P6M Merging GLOBAL symbols failed: duplicate definition of symbol %RAW-DEFS
at /home/cbwood/Projects/p6-GIO/lib/GIO/ApplicationCommandLine.pm6 (GIO::ApplicationCommandLine):12
However I've removed all references of %RAW-DEFS from the code a few hours ago. Is there an easy way to fix this?
Xliff Error golfed: repl.it/@Xliff/LovingMassiveVendors#C.pm6 07:42
timotimo Xliff: works when i use package A { our %RAW-DEFS; ... } and package B and such 07:59
Xliff OK, so you are placing them in package blocks? 08:00
Here's the real issue. Most of these compunits are there to declare classes of the same name.
However sometims I will need symbols defined that will need quick nativecall defs. 08:01
If I do this in a compunit: class A::B { ... }; package A::B::C { ... };
the class def will not be able to see anything in A::B::C, even if they are marked "is export" 08:02
If we can solve that, then I'll be happy as a clam! :)
Is there a way to declare partials in Raku? 08:05
sarna hello, does raku have bidirectional hashmaps? or something that could emulate one? 08:14
asking mostly out of curiosity - I can just declare ten variables in this particular case, a bidirectional mapping would be much nicer though :) 08:15
sena_kun I imagine implementing one wouldn't be too hard. Implement `Associative` and overload a couple of methods to do checks you want. 08:17
.oO ( document, pack and release then! )
sarna haha thanks, sena_kun - might as well do that :^) 08:22
Xliff sarna: What do you mean by "bidiractional hashmap"? Is there something online that describes the difference between that and the current Associatives we are used to in Raku? 08:32
sena_kun Xliff, see guava.dev/releases/19.0/api/docs/c...BiMap.html ? If I interpreted correctly what sarna wants. 08:36
sarna sena_kun: yeah, something similar at least 08:37
raku is dynamically typed, I could get away with adding stuff twice 08:40
Xliff role TwoWayHash[K, V] { has HahsMap[V, K] %!bizzaro; method EXISTS-KEY(\k) { k ~~ K ?? self{K}:exists !! %!bizzaro{K}:exists }; method AT-KEY(\k) { k ~~ K ?? self<K> !! %!bizzaro{K} }; }; # ??? 09:04
AT-KEY may need to be "is rw" 09:05
Xliff Actually, it's more complex than that. 09:06
EXISTS-KEY need to return Proxy objects
sena_kun has an impression that it's just putting that must be locked, plus you call .antipairs to get "inverted" hash. 09:16
Xliff Yeah. Should have thought about that. Oh well. 09:20
sena_kun I mean, the idea seems to be to enforce that for each key there is a single value which cannot be overwritten (and add a backup method to break this law, of course) + antipairs does all the work on inverting. 09:25
dakkar you don't want to call `.antipairs` on each access though, otherwise you go from ~O(1) to O(N*log(N)) 09:26
(or whatever the cost of building a new hash each time is) 09:27
sena_kun Why call it on each access?
dakkar I just said not to ☺
I may be thinking of a different data structure… an immutable bi-hash is easy, a mutable one needs a bit more work 09:28
El_Che 5 people to vote sounded like a lot at first 09:30
it isn't
:)
sarna how to call methods of a parent, when I'm inheriting? 10:02
tobs sarna: if `class B is A` and you want to call exactly A's method f, then you can inside of a method of B: self.A::f 10:10
sarna tobs: makes sense! I also like the syntax :)
tobs but if you just want to redispatch to the "next most appropriate method in the current dispatch chain" (which also involves methods of parent classes), then see nextsame and nextwith and the like.
sarna will do, thanks 10:11
"nextsame calls the next matching candidate with the same arguments that were used for the current candidate" - oh my!
tobs Those weave multiple dispatch and multiple inheritance into one string of candidates which you can walk and does the right thing if your situation is not as complex, e.g. with single inheritance. 10:12
sarna awesome! 10:13
sarna does raku have keyword punning? in ocaml if you have a variable with the same name as a named argument, you can just omit the second part of "foo => $foo" 11:27
lizmat sarna: :$foo 11:43
sarna lizmat: thanks :)
sarna m: my \foo = a => 1, b => 2; say \foo.keys; say \foo.values; # why?? 11:47
camelia \((:a(1), :b(2)))
\((:a(1), :b(2)))
sarna m: my \foo = a => 1, b => 2; say foo.keys; say foo.values; # oh well that kinda works 11:48
camelia (0 1)
(a => 1 b => 2)
timotimo yeah, when you define a my \foo you're defining a sigil-less "foo" to be used as "foo"; putting a \ in front of a value gives you a Capture object 11:59
lizmat wonders if we should get rid of that for .f 12:00
it's huffmanization for something most people don't use
timotimo capture literal syntax? 12:01
well, not really literal
lizmat m: dd (42,666).Capture # much clearer imo
camelia \(42, 666)
timotimo but yeah 12:02
at the very least change the output to read (blah).Capture
so that it's less confusing?
lizmat yeah, that it should then as well :-) 12:03
timotimo ah, right, can't really not do that 12:04
sarna m: my @foo = [1,2,3]; @foo[1]:delete; say @foo # how can I make @foo be [1,3], without the hole? 12:14
camelia [1 (Any) 3]
sarna m: my %hash = %{foo => [1,2]}; say %hash<foo>; .say for %hash<foo> # this was very confusing :( 12:33
camelia [1 2]
[1 2]
timotimo m: my $blerp = [1, 2]; .say for $blerp; .say for $blerp<> 12:34
camelia [1 2]
1
2
sarna ..decontainerization operator? 12:36
first time I see this
timotimo aye, scalar containers prevent iteration 12:43
sarna repl.it/repls/AgreeableYearlyFile#main.raku 12:48
sena_kun: I made it :)
mostly stolen from here stackoverflow.com/a/21894086, but eh 12:49
timotimo oh i thought bihash would forbid the same value from appearing more than once
sarna well it's an ambiguous condition - I like this approach more 12:50
timotimo OK 12:51
lizmat sarna: do you know about invert and push ? 12:52
m: my %h = a => 1, b => 1; my %i; %i.push(%h.invert); dd %i
camelia Hash %i = {"1" => $["a", "b"]}
sarna implodes
lizmat oops 12:53
Altreus Anyone mind giving me a terminology refresher? In P5 I think of this as a hashref: my $data = {...}; 13:01
I'm not sure what to call it in Raku 13:02
does it particularly differ from my %data = ... ?
dakkar m: my $data = { a => 1 };say $data.WHAT
camelia (Hash)
dakkar it's a Hash
lizmat Altreus : an itemized Hash in a scalar 13:03
m: my $data = { a => 1 }; dd $data
camelia Hash $data = ${:a(1)}
lizmat note the ${ }
that will stop it from iterating seamlessly 13:04
m: my %data = { a => 1 }; dd %data
camelia Potential difficulties:
Useless use of hash composer on right side of hash assignment; did you mean := instead?
at <tmp>:1
------> 3my %data = { a => 1 }7⏏5; dd %data
Hash %data = {:a(1)}
lizmat m: my %data = a => 1; dd %data
camelia Hash %data = {:a(1)}
Altreus itemized!
lizmat note the absence of ${ }, so this *will* iterate seamlessly
Altreus so ${} has to be decontainerised e.g. with <> 13:05
lizmat yup
Altreus hmm
lizmat m: my $data = { a => 1, b => 2 }; .say for $data<>
camelia b => 2
a => 1
Altreus We were just running a test where I suggested swapping a % for a $ and it made no difference so presumably Raku does some containerisation magic when passing things to functions? 13:06
So if it's expecting a $ and you give it a % it itemises it for you, and if it's already a $ it doesn't? Something like that?
lizmat m: my $a = { a => 1 }; sub a(%b) { dd %b }; a $a 13:07
camelia Hash % = {:a(1)}
Altreus m: sub whatever($data) { dd $data }; my %data = 1 => 2; whatever(%data)
camelia ${"1" => 2}
lizmat that's the single arg rule at work
Altreus m: sub whatever($data) { dd $data }; my $data = {1 => 2}; whatever($data)
camelia ${"1" => 2}
Altreus single arg rule!
then
m: sub whatever($data, :$more-data) { dd $data }; my $data = {1 => 2}; whatever($data)
camelia ${"1" => 2}
Altreus o
m: sub whatever($data, :$more-data) { dd $data }; my %data = 1 => 2; whatever(%data) 13:08
camelia ${"1" => 2}
Altreus okay
still, it always looks the same is the point
lizmat well, Raku tries very hard to DWIM
Altreus as long as I SWIM, right
:D
lizmat and if you go with the flow, it generally does 13:09
sarna can I reopen a class in raku, like in ruby? to add one method to it?
lizmat it's different if you're applying e.g. Perl preconceptions
sarna: docs.raku.org/syntax/augment 13:10
but there's probably a better way to do that
afk for a bit&
sarna lizmat: thanks, this one demands going back to monke though :(
Altreus Perl preconceptions are hard to dispense of, especially when you refresh them every day 13:11
lizmat Altreus: true 13:39
lizmat is lucky in that respect
Altreus I'm lucky in the respect that I'm no longer working with PHP :D 14:02
El_Che [Coke]: thx for doing the logistics for the election 14:03
[Coke] 42 ballots reporting (Average votes per ballot: 4.60) 14:14
El_Che: so far, not a problem! :)
El_Che not a lot of votes so far 14:24
[Coke] nope. about 3 days left 14:26
jdv79 what is the percentage of votes to potential votes? 14:27
[Coke] there is no list of potential voters.
if you want to make one, that'd be great!
it's everyone with access to several of the repos, but there is no trivial way to get that list. 14:28
I'm going to verify that the small # of voters appear someone in the list before certifying the results.
*somewhere
jdv79 probably impossible without higher privs at gh to do the api calls
[Coke] (easier to do 42 lookups than it is to write the script for me ATM) 14:29
if someone wrote something that could dump everyone from -a- repo, we can find someone to run it against our 4.
El_Che if the 14 (!) candidates votes, that leaves us at 28 voters 14:31
s/votes/vote/
lizmat
.oO( only marginally better than the Mexican army )
14:32
El_Che 14 managers for 28 programmers sounds about right, on the other hand :)
jdv79 if i have some free time today i could probably cobble it together
that's a big if i'm afraid:(
codesections m: say '»ö«' ~~ /<alpha>/ 14:34
camelia 「ö」
alpha => 「ö」
codesections what's the best way to match just ASCII chars? Just <[A..Za..z]>, or is there a better way? 14:35
jdv79 what's the criteria again? all contributors with commit bit for @repos?
lizmat jdv79: indeed 14:36
jdv79 thanks
[Coke] El_Che: I don't think this is spoilers - some of the 42 votes include votes from candidates. 14:43
codesections: by ascii are you including control characters? NUL ?
I don't think we have <ascii> 14:44
[Coke] m: say "wtf" ~~ /^ <ascii>* $/ 14:44
camelia No such method 'ascii' for invocant of type 'Match'. Did you mean
'asin'?
in block <unit> at <tmp> line 1
codesections [Coke]: Yeah, I didn't think there was a built in (it'd be odd to leave it out from the docs). Is there a unicode property that would do it, though? 14:45
[Coke] m: say "wtf" ~~ /^ <[\c[control-0000]..\c[LATIN SMALL LETTER Y WITH DIAERESIS]>* $/ 14:46
camelia 5===SORRY!5=== Error while compiling <tmp>
Unrecognized character name 'control-0000'
at <tmp>:1
------> 3say "wtf" ~~ /^ <[\c[control-00007⏏5]..\c[LATIN SMALL LETTER Y WITH DIAERESI
[Coke] m: say "wtf" ~~ /^ <[\x00..\xFF>* $/ 14:47
camelia 5===SORRY!5===
Unrecognized regex metacharacter < (must be quoted to match literally)
at <tmp>:1
------> 3say "wtf" ~~ /^ <[\x00..\xFF7⏏5>* $/
Unable to parse regex; couldn't find final '/'
at <tmp>:1
------> 3say "wtf" ~~ /^ <[…
[Coke] m: say "wtf" ~~ /^ <[\x00..\xFF]>* $/
camelia 「wtf」
[Coke] ^^
dakkar maybe \x7F? ASCII is 7-bit
[Coke] sure, FF is extended. 14:48
codesections Sorry, I wasn't clear: I really am looking for <[A..Za..z]> -- that is, just alphabetic ASCII 14:49
[Coke] m: say "wtf\t" ~~ /^ <[\x00..\x7F]>* $/
camelia 「wtf 」
[Coke] codesections: then /:i <[a..z]> / works
[Coke] if you use something like <alpha> you're going to get a lot of unicode support that it sounds like you don't want. 14:50
codesections Makes sense. I think I was just overthinking it, unsuprisingly
(I thought there might be something easy that's similar to `:Lu` but for [letter & ASCII] instead of [letter & uppercase] 14:52
)
[Coke] You could write a code block in the regex to make sure the point is < \xF7 14:55
but that seems less maintainable.
codesections now who's overthinking it? :D
[Coke] (and it doesn't look like there's a unicode category for ascii, which makes sense.) 14:58
dakkar it's called `Basic Latin` 15:00
it's the name of the block 0..7F
(took me a while to find it…)
codesections dakkar: where did you find it? I haven't found a great source for unicode props 15:01
dakkar en.wikipedia.org/wiki/Unicode_block via en.wikipedia.org/wiki/Unicode_char...r_property via docs.raku.org/routine/uniprop via docs.raku.org/language/regexes#Uni...properties 15:01
codesections dakkar++ I still feel like there must be a better reference source than Wikipedia, but that's the best I've found too 15:03
dakkar m: "abc\xe8" ~~ / [<:Script{'Basic Latin'}> & <:L>]+ / # uh? 15:07
camelia ( no output )
dakkar m: say "abc\xe8" ~~ / [<:Script{'Basic Latin'}> & <:L>]+ / # uh?
camelia 「abcè」
dakkar I was not expecting it to match that è 15:07
aahh
m: say "abc\xe8" ~~ / [<:Block('Basic Latin')> & <:L>]+ / 15:08
camelia 「abc」
dakkar the delimiters are important, and it's a Block, not a Script
codesections thanks :)
dakkar (weird that what looks like a colonpair isn't) 15:09
also, what did the parser thought I meant with <:Script{'thing'}> ?
codesections: the official source for unicode stuff is www.unicode.org/Public/14.0.0/ucd/ 15:12
(the Unicode Character Database)
a bit unwieldy, though
[Coke] dakkar++ 15:24
[Coke] I still think a..z is more succint. :) 15:24
dakkar oh sure!
[Coke] *succinct
dakkar I wanted to see what the UCD/declarative way looked like 15:25
also, I found another thing in Raku that looks like a pair but really isn't: the property-based character class 15:26
codesections Yeah, if there had been a shorter one (like `:Lb` or something), it would have won out, but given that there isn't, `[:i <[a..z]>]` is probably better
dakkar (the other being the named parameter in a signature)
[Coke] 43 ballots reporting (Average votes per ballot: 4.60)
codesections The downside with [a..z] is that it's a common bug for when people *should* be matching unicode, but forgot. Depending on the context, it might need a comment to clarify that it's intentional. :Block('Basic Latin') makes your intention clear 15:29
dakkar "I know there's a billion characters out there, I actually really want just these 52" 15:30
guifa This is where you might want <local-alpha> or similar :-) 15:49
Altreus is there a with except for truth and not definedness? as in X = $_ with Y; 15:58
if doesn't set $_ does it
[Coke] yah, hide it all behind a named rule, there's your documentation. :) 16:00
jdv79 [Coke]: here's a quick and dirty maybe...: nopaste.linux-dev.org/?1323914 16:06
i could fix it up more maybe later but the basics are there
dakkar m: my $x=5;if $x -> $_ { .say } # Altreus 16:10
camelia 5
Altreus yeah a bit more pesky than just repeating x 16:12
no worries tbh
codesections m: my $x = 1; say 'True' with $x || Any 16:18
camelia True
codesections m: my $x = 0; say 'True' with $x || Any
camelia ( no output )
codesections Altreus: ^^^ could work, though it's a little less clear
Altreus clarity is preferred :D 16:19
codesections yeah. It all comes down to what idioms you like/are part of your vocabulary :) 16:20
dakkar macros and slangs are still too complicated / immature to easily create a `wif` statement modifier 16:22
(I tried)
Altreus wiv 16:33
:D
[Coke] jdv79: I'll give it a shot later, thank you
jdv79: what does ~/.rel_gen.conf look like? 16:36
{ "github_auth": "user@pass" } ?
after putting what I think is a correct rel_gen.conf in place, and changing foo/bar to "Raku" and "doc", I get: 16:38
[Coke] Not an ARRAY reference at ./test-coke.pl line 25. 16:38
ah typo. ok. that gives a huge dump of ids. 16:40
I don't understand how you're looping through multiple pages (I see the while loop, but don't understand the logic) 16:44
[Coke] hurls gist.github.com/coke/ae6506a3a80da...6c4ef23731 for jdv79 16:45
based on that list, I'm seeing several misses in the votes so far (voters who do not appear on the list) 16:47
but this reduces the number I have to hand check considerably, thanks. 16:48
jnthn: can you make me an admin on rakudo/rakudo, if you're OK with that? 16:49
tellable6 [Coke], I'll pass your message to jnthn
El_Che nwc10 is twice on the list 16:51
[Coke] I dumped several runs of the script into a file and did a sort. probably needed -u
updated 16:52
m: say 43/240 17:03
camelia 0.179167
thundergnat m: say 'camelia »ö« ftw' ~~ m:g/<:ASCII>+/; # <-- codesections; if you haven't already found it 17:45
camelia (「camelia 」 「 ftw」)
codesections O.O thundergnat++ I had _not_ found that, thanks 17:46
(I still feel like there *must* a list of unicode properties somewhere that I just haven't found...) 17:47
[Coke] doesn't look like :ASCII is spec'd. 18:29
Xliff thundergnat: When did <:ASCII> get in? It's not documented here: docs.raku.org/language/regexes#Pre...er_classes 18:30
tellable6 Xliff, I'll pass your message to thundergnat
[Coke] (or in roast) 18:33
(at least not in S05)
there is :ASCIIHexDigit
[Coke] also see :InASCII 18:36
stanrifkin How can i lookup ~~ operator with p6doc? Something like perldoc perlop or so... 18:39
stanrifkin ah. I found it. p6doc operators 18:40
moritz stanrifkin: also on docs.raku.org you can enter operators into the search box 18:45
and once upon a time you could also put it in the URL, but that feature has been removed some time ago
stanrifkin moritz: is docs.raku.org downloadable? I mean is there a zip or so? 18:48
[Coke] stanrifkin: worst case there's github.com/Raku/doc 18:49
there's some work in progress to restore the single-big-html version also 18:50
codesections [Coke]: Xliff: now I'm a bit confused about what unicode properties Raku *does* support. My previous understanding was that we supported some list of properties defined by the unicode consortium/ICU/some other group. Under that understanding, we didn't need to document specific properties that we support (though it would be nice if we could link to an ICU page listing the current relevant 18:57
properties). Was that understanding wrong?
[Coke] we need to document what we support, even if it's a link. 18:58
codesections Listening to you now, it sounds like we only support a subset of properties, and have to select properties that we want to support (instead of getting them automatically as they're added). If that's the case, then we should be documenting/spec'ing each property as it's added
m: say ['-'] ~~ /<:dash>/ 18:59
camelia 「-」
codesections ^^^ works
m: '☕' ~~ /<:Basic_Emoji>/
camelia ( no output )
[Coke] codesections: ... I'm not speaking in any kind of expert capacity here. :)
codesections ^^^ doesn't work
[Coke] I'm just checking to see if stuff is listed on docs site or in roast, that's it 19:00
codesections and I'm not sure if that's because :dash is in a different category according to ICU, or if that's because we've decided to support :dash but not :Basic_Emoji
[Coke] .seen samcv 19:02
tellable6 [Coke], I saw samcv 2020-08-24T19:18:52Z in #raku-dev: <samcv> lizmat++
[Coke] she did most of the work. think nwc10 also has touched it recently
tobs m: say '☕' ~~ /<:Basic_Emoji>/ 19:03
camelia Nil
tobs (so it *really* does not work...)
codesections haha, fair point :)
m: say '☕'.uniprop('Basic_Emoji') 19:05
camelia 0
codesections I'm assuming those use the same mechanisim
m: say 'a'.uniprop('L'); say 'a'.uniprop('ASCII'); say 'a'.uniprop('Alpha') 19:10
camelia 1
Basic Latin
True
stanrifkin in the book "Learning Perl6" the first example program "find_moth_genera.p6" is stuck executing. There is no output. Does anyone had the same issue?
codesections I don't understand why &uniprop sometimes returns a Str, a Bool, or an Int 19:11
very odd
lizmat codesections: uniprop is a multi that returns different things for different invocants 19:22
although I would argue that the 'L' case returning 1 is wrong as it should return a Bool 19:23
codesections lizmat: yeah, I see that now. I was just looking at the source, but couldn't figure out they rhyme or reason behind when it returns different types. It also **looks** like the source has a list of all unicode properties Raku knows about – but then that list doesn't have :ASCII, which is what got us started on this topic 19:24
github.com/rakudo/rakudo/blob/mast...#L624-L679
lizmat wouldn't know why that would not be in there 19:26
codesections It does have `General_Category`. My (now) current understanding is that :ASCII is a synonym for :Block('Basic Latin'), which looks up a character's `General Category`. But I'm not sure how that's implemented/if that's even correct 19:27
[Coke] stanrifkin: do you have a copy of the program in a gist? 19:33
stanrifkin [Coke]: i looked at the source... the program seems fine. There is a misprinting in the book. 19:35
[Coke] oops.
stanrifkin++
melezhik how can I server static files with cro? 19:48
tellable6 2020-09-16T20:37:08Z #raku <SmokeMachine> melezhik thanks! I’ll take a look as soon as possible
melezhik serve
stanrifkin how do you use all the unicode special characters? how do you list... and copy them into a editor? 20:19
timotimo there's a documentation page about different ways 20:20
melezhik looks like the answer on my question is here - cro.services/docs/reference/cro-http-router 20:23
in Serving static content§ section 20:24
[Coke] melezhik: docs.raku.org/language/unicode_entry 20:25
er.
stanrifkin: docs.raku.org/language/unicode_entry
melezhik [Coke] )) 20:26
[Coke] someone should add an os x section to that pag.
stanrifkin os x user which uses raku? :)
melezhik how the things are in general in Raku community? what's up recent reddit are quite quiet ))) ... 20:28
lizmat 2+ posts per day ? 20:30
melezhik oh ... just my personal perception, I might be wrong though ... maybe it's me not that active and so feel that way )))
jdv79 [Coke]: sorry, i took a script at work and butchered it for that. 20:46
anything i can help with? seemed straightforward at the time. 20:47
[Coke] sorry about what now?
I got what I needed, I think.
oh, about the algorithm? no worries 20:48
jdv79 then not sorry
good stuff
so, back to the origin of that. what is the % voting so far?
lizmat jdv79: not knowing how many people can vote, sorta makes % calculations difficult ? 20:49
I understand there have been 42 ballots cast so far
jdv79 well, i think we now have potential voters
or dont we? 20:50
lizmat jdv79: ah, did I miss something ? 20:52
jdv79 i provided coke with a scriptlet that can get the list from gh, more or less. 20:53
ah, ~18%. i backlogged better. cool. 20:54
lizmat ah, cool! 20:55
[Coke] I haven't validated anything, but that's the raw data right now. :) 20:59
jdv79 its like hte US elections - "as it comes in" 21:00
timotimo not enough voter suppression 21:01
guifa SmokeMachine++ for the example on webperl, I’m already making good use fo it 21:58
thundergnat Sorry I didn't answer earlier, I got sucked into meetings and other RL intervened. 22:21
tellable6 2020-09-17T18:30:56Z #raku <Xliff> thundergnat: When did <:ASCII> get in? It's not documented here: docs.raku.org/language/regexes#Pre...er_classes
thundergnat .tell Xliff <:ASCII> isn't a Raku specific thing. It an official Unicode property alias. See unicode.org/Public/UNIDATA/Property...liases.txt - search for ASCII. It's an alias for Block<Basic Latin>. 22:23
tellable6 thundergnat, I'll pass your message to Xliff
codesections thundergnat: is ASCII an alias for Block<Basic Latin> or for Block? Or both? 22:25
guifa codesections: ASCII is defined here: www.unicode.org/Public/UCD/latest/u...liases.txt
codesections m: say 'a'.uniprop('ASCII'); say 'a'.uniprop('blk') 22:26
camelia Basic Latin
Basic Latin
codesections guifa: so why does ^^^ return "Basic Latin" instead of True or 1? 22:29
also, 'ASCII' has the same unipropcode as 'block', which is what made me think it was an alias for 'Block' rather that Block<Basic Latin> 22:30
m: use nqp; say nqp::unipropcode('ASCII')
camelia 6
codesections m: use nqp; say nqp::unipropcode('Block')
camelia 6
thundergnat I'm not sure how 'a'.uniprop('ASCII'); is parsing. blk (block) is a Unicode property and ASCII is nominally an alias for blk<Basic Latin> 22:31
You may be right though. 22:32
m: say "٣".uniprop(<ASCII>)
camelia Arabic
thundergnat Hmm.
I suspect that that is an accident of parsing rather than a intentional implementation. 22:35
guifa Let’s follow the rabbit hole
uniprop is defined in Cool, and calls the sub uniprop, first arg the string and the rest other args (e.g. ASCII)
codesections yeah, and that eventually gets you to unicode_db.c 22:36
guifa m: use nqp; say nqp::unipropcode(‘AHex’) 22:37
camelia 28
guifa m: use nqp; say nqp::unipropcode(‘Xxasdsefsdf’)
camelia 0
codesections yeah, (at least in MoarVM) all that is from the (very long) table in unicode_db.c, which is auto-generated from MoarVM/tools/ucd2c.pl as part of the MoarVM build 22:39
When built, it contains the Unicode Character Database 22:40
thundergnat My suspicion: Unicode properties are all a single word/phrase (linked by underscores). ASCII is an alias for blk; Basic_Latin. I suspect that it is just grabbing the first "word" of the alias (blk) and using that as the property to search for. (all speculation)
codesections interesting! So, if that's the case, it means that <:ASCII> isn't using the same machinery as &uniprop? I'd kind of been assuming that <:ASCII> was implemented as something like `$str.uniprop('ASCII') eq 'Basic Latin'`, but I guess it must use different machinery if it doesn't have the same issue 22:42
thundergnat see my above snippet 22:43
m: say "٣".uniprop(<ASCII>)
camelia Arabic
thundergnat How is it finding Arabic if it isn't just searching for Block? 22:44
m: say "٣".uniprop(<blk>)
camelia Arabic
codesections m: "٣" ~~ /<:ASCII>/
camelia ( no output )
codesections m: say "٣" ~~ /<:ASCII>/
camelia Nil
thundergnat m: say "٣".uniprop(<blk ASCII>)
camelia Cannot resolve caller uniprop(Int:D, List:D); none of these signatures match:
(Str:D $str, |c)
(Int:D $code)
(Int:D $code, Stringy:D $propname)
in block <unit> at <tmp> line 1
guifa m: say “α”.uniprop(<anything>)
camelia 0
thundergnat m: say "٣".uniprop(<blk;ASCII>)
camelia 0 22:45
thundergnat Hmm
guifa Something weird is definitely going on
thundergnat On the other hand, I may be completely full of it...
SmokeMachine guifa: really? Now I’m curious! 22:48
guifa SmokeMachine: I don’t have it ready yet, but it’s going to make localizing errors SOOOOO much easier 22:49
I just wish for JS there was a way to open a file AND SAVE IT in the same place lol 22:50
guifa also needs to write a ton of fake exception data
SmokeMachine Have you thought of using the file API? You could download the new version generated by the js 22:52
thundergnat m: say "\c[LATIN CAPITAL LETTER P WITH SQUIRREL TAIL]" # The odd things you stumble across while perusing the Unicode tables 23:07
camelia
guifa I actually used that character in my dissertation 23:10
It’s generally read as "pro"
thundergnat I can't say that I ever consciously saw that particular character before. I may have _seen_ it but didn't particularly notice it. 23:12
guifa Ps and Qs (hence the expression) have all sorts of variations with special readings 23:15
codesections Aha! I've found the missing piece of the puzzle: &unipvalcode 23:45
m: use nqp; say given '٣' {nqp::matchuniprop(.ord, nqp::unipropcode('ASCII'), nqp::unipvalcode(nqp::unipropcode('ASCII'), 'ASCII'))}
camelia 5===SORRY!5=== Error while compiling <tmp>
Unsupported use of bare "say". In Raku please use: .say if you meant
to call it as a method on $_, or use an explicit invocant or argument,
or use &say to refer to the function as a noun.
at <tmp…
codesections m: use nqp; say do given '٣' {nqp::matchuniprop(.ord, nqp::unipropcode('ASCII'), nqp::unipvalcode(nqp::unipropcode('ASCII'), 'ASCII'))}
camelia 0
codesections m: use nqp; say do given 'a' {nqp::matchuniprop(.ord, nqp::unipropcode('ASCII'), nqp::unipvalcode(nqp::unipropcode('ASCII'), 'ASCII'))}
camelia 1 23:45
codesections thundergnat: guifa: I'm pretty sure ^^^^ (or something like it) is how ~~ /<:ASCII>/ is implemented 23:46
codesections also 23:50
m: use nqp; say nqp::unipvalcode(6, 'BasicLatin'); say nqp::unipvalcode(6, 'ASCII'); say nqp::unipvalcode(6, 'Invalid');
camelia 1
1
0
stanrifkin When I use an variable which I declared as Int like my Int $n and then assign a string to it. Is this checked only at runtime not compile time? When I run raku with the -c option is says OK. 23:58