🦋 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.
ryn1x p6: sub foo ( --> (Bool, Str) ) { return (True, "Success") } 01:43
camelia 5===SORRY!5=== Error while compiling <tmp>
Malformed return value
at <tmp>:1
------> 3sub foo ( -->7⏏5 (Bool, Str) ) { return (True, "Success"
ryn1x Can I do a type signature like this in someway? I want to return a typed 2 tuple (list?) 01:44
uzl[m] m: subset Type where { $_[0] ~~ Bool && $_[1] ~~ Str }; sub foo ( --> Type ) { return (True, "Success") } 02:09
camelia ( no output )
uzl[m] m: subset Type where { $_[0] ~~ Bool && $_[1] ~~ Str }; sub foo ( --> Type ) { return (True, "Success") }; say foo() ~~ Type;
camelia True
uzl[m] ryn1x: ^ Probably like this? 02:10
ryn1x cool thx
Is this how I would type against a Class that does a Role? sub foo($x where {$x does SomeRole}) 02:11
sjn m: sub a (--> Pair) { return True => "yes" }; say a.perl 02:13
camelia :True("yes")
sjn no support for parameterized Pair though 02:14
ryn1x hmm... but can I assign the pair like I can a list...
uzl[m] m; role A {}; class B does A {}; sub f( $x where {$_.does(A)} ) {}; f B 02:15
ryn1x p6: my $a; my $b; ($a, $b) = sub a (--> Pair) { return True => "yes" };
camelia ( no output )
uzl[m] m: role A {}; class B does A {}; sub f( $x where {$_.does(A)} ) {}; f B
camelia ( no output )
ryn1x p6: my $a; my $b; ($a, $b) = sub a (--> Pair) { return True => "yes" }; say $a, $b
camelia &a(Any)
uzl[m] m; role A {}; class B {}; sub f( $x where {$_.does(A)} ) {}; f B
m: role A {}; class B {}; sub f( $x where {$_.does(A)} ) {}; f B
camelia Constraint type check failed in binding to parameter '$x'; expected anonymous constraint to be met but got B (B)
in sub f at <tmp> line 1
in block <unit> at <tmp> line 1
ryn1x m: role A {}; class B does A {}; sub f( $x where {$_.does(A)} ) {}; f B 02:17
camelia ( no output )
ryn1x m: role A {}; class B does A {}; sub f( $x where {$_.does(A)} ) { say "worked" }; f B
camelia worked
uzl[m] m: role A {}; class B {} does A; sub f( $x where { $_ ~~ A} ) {}; f B
camelia Cannot use 'does' operator on a type object B.
in block <unit> at <tmp> line 1
uzl[m] m: role A {}; class B does A {}; sub f( $x where {$_ ~~ A} ) {}; f B 02:18
camelia ( no output )
uzl[m] role A {}; class B; sub f( $x where {$_ ~~ A} ) {}; f B
ryn1x m: role A {}; class B does A {}; class C; sub f( $x where {$_.does(A)} ) { say "worked" }; f C
camelia 5===SORRY!5=== Error while compiling <tmp>
Too late for unit-scoped class definition;
Please use the block form.
at <tmp>:1
------> 3role A {}; class B does A {}; class C;7⏏5 sub f( $x where {$_.does(A)} ) { say "w
uzl[m] m: role A {}; class B {} sub f( $x where {$_ ~~ A} ) {}; f B 02:19
camelia 5===SORRY!5=== Error while compiling <tmp>
Strange text after block (missing semicolon or comma?)
at <tmp>:1
------> 3role A {}; class B {}7⏏5 sub f( $x where {$_ ~~ A} ) {}; f B
expecting any of:
infix
infix …
ryn1x m: role A {}; class B does A {}; class C {}; sub f( $x where {$_.does(A)} ) { say "worked" }; f C 02:19
camelia Constraint type check failed in binding to parameter '$x'; expected anonymous constraint to be met but got C (C)
in sub f at <tmp> line 1
in block <unit> at <tmp> line 1
ryn1x yeah $x where {$_.does(A)} seems to work
uzl[m] m: role A {}; class B {}; sub f( $x where {$_ ~~ A} ) {}; f B
camelia Constraint type check failed in binding to parameter '$x'; expected anonymous constraint to be met but got B (B)
in sub f at <tmp> line 1
in block <unit> at <tmp> line 1
ryn1x that one is missing class B does A {} 02:20
uzl[m] Yeah, I was testing a class that doesn't implement the role and it fails as expected. 02:21
ryn1x ahh ok. cool.
uzl[m] ^ It seems you could use smartmatching too but .does looks clearer to me. 02:22
ryn1x so does or ~~...
ok yeah... thats what I was thinking
ryn1x should I use "is rw" or "ir raw" to pass by reference to a sub? 03:01
m: my class Foo {our $.x}; my $foo = Foo.new; $foo.x = 42; sub replace($foo is rw) {$foo = Foo.new; $foo.x = 99}; replace $foo; say $foo.x;
camelia 99
ryn1x m: my class Foo {our $.x}; my $foo = Foo.new; $foo.x = 42; sub replace($foo is raw) {$foo = Foo.new; $foo.x = 99}; replace $foo; say $foo.x;
camelia 99
irced "Raw parameters bind either a variable or a value passed to it, with no decontainerization taking place. That means that if a variable was passed to it, you can assign to the parameter. This is different from rw-parameter which can only bind to variables, never to values." 03:21
irced parses.
m: my class Foo {our $.x}; my $foo = Foo.new; $foo.x = 24; sub replace($foo is raw) { $foo = Foo.new; $foo.x = 99}; replace 42; say $foo.x; 03:23
camelia Cannot assign to an immutable value
in sub replace at <tmp> line 1
in block <unit> at <tmp> line 1
irced m: my class Foo {our $.x}; my $foo = Foo.new; $foo.x = 24; sub replace($foo is rw, $blah is raw) { $foo = Foo.new; $foo.x = 99}; replace $foo 42; say $foo.x; 03:26
camelia 5===SORRY!5=== Error while compiling <tmp>
Two terms in a row
at <tmp>:1
------> 3oo = Foo.new; $foo.x = 99}; replace $foo7⏏5 42; say $foo.x;
expecting any of:
infix
infix stopper
postfix
s…
irced m: my class Foo {our $.x}; my $foo = Foo.new; $foo.x = 24; sub replace($foo is rw, $blah is raw) { $foo = Foo.new; $foo.x = 99}; replace ($foo 42); say $foo.x; 03:27
camelia 5===SORRY!5=== Error while compiling <tmp>
Two terms in a row
at <tmp>:1
------> 3o = Foo.new; $foo.x = 99}; replace ($foo7⏏5 42); say $foo.x;
expecting any of:
infix
infix stopper
statement end
irced m: my class Foo {our $.x}; my $foo = Foo.new; $foo.x = 24; sub replace($foo is rw, $blah is raw) { $foo = Foo.new; $foo.x = 99}; replace ($foo, 42); say $foo.x;
camelia Too few positionals passed; expected 2 arguments but got 1
in sub replace at <tmp> line 1
in block <unit> at <tmp> line 1
irced m: my class Foo {our $.x}; my $foo = Foo.new; $foo.x = 24; sub replace($foo is rw, $blah is raw) { $foo = Foo.new; $foo.x = $blah}; replace($foo, 42); say $foo.x;
camelia 42
irced m: my class Foo {our $.x}; my $foo = Foo.new; $foo.x = 24; sub replace($foo is rw, $blah is rw) { $foo = Foo.new; $foo.x = $blah}; replace($foo, 42); say $foo.x; 03:28
camelia Parameter '$blah' expected a writable container, but got Int value
in sub replace at <tmp> line 1
in block <unit> at <tmp> line 1
irced that sums it up. ryn1x ah crap
irced uses raku code to decrypt satellite communications, intercept an authorization, reproduce it, submits an images of ryn1x's face and body posture, triangulate ryn1x's current geolocation based on facial recognition and cell phone location (with history), deploys a drone to deliver a hand written note that reads BANG. 03:32
[Coke] wonders how to setup a main so he can have a fixed string, then -x args, then normal args 03:38
MAIN("combo", $stuff, :$nonsense) wants to be invoked as ./exe -nonsense combo stuff 03:40
irced It's possible to alter how arguments are processed before they're passed to sub MAIN {} by setting options in the %*SUB-MAIN-OPTS hash. Due to the nature of dynamic variables, it is required to set up the %*SUB-MAIN-OPTS hash and fill it with the appropriate settings. 03:43
"
"For example....raku example.raku 1 --c=2 3 --d=4" 03:44
[Coke] does that get a cigar?
irced fiddles happily with his thumb err cigar cutter, making a steel slicing sound repeatedly. 03:45
[Coke] checking...
irced docs.raku.org/language/create-cli#...-MAIN-OPTS
irced draws a pocket blow torch and a bag of thermite from a satchel, to ensure the cigar burns of course. 03:47
[Coke] irced++ 03:49
irced cool, i had hoped it was close enuf
irced puts on light shielding goggles and lights the torch. Cigar time. 03:50
SmokeMachine m: role A {}; class B does A {}; sub f( A $x ) {}; f B 07:11
camelia ( no output )
SmokeMachine :( 07:13
m: role A {}; class B {}; sub f( A $x ) {}; f B
camelia 5===SORRY!5=== Error while compiling <tmp>
Calling f(B) will never work with declared signature (A $x)
at <tmp>:1
------> 3ole A {}; class B {}; sub f( A $x ) {}; 7⏏5f B
SmokeMachine :) 07:14
Altreus No matter what I do I cannot seem to get this client to reconnect if the heartbeat is not acknowledged. github.com/shuppet/p6-api-discord/...n.pm6#L193 08:45
It just ... stops
It appears to print out a whole bunch of spaces on STDERR but I have no idea how that's even possible
Line 203 just never appears to be reached 08:46
tbrowder m: class f { has $.f; method f {} }; my $o = f.new 10:07
camelia ( no output )
tbrowder m: class f { has $.f; method f { say 'foo'}}; my $f = f.new; $f.f 10:10
camelia foo
tbrowder m: class f { has $.f is rw = 'f'; method f {say self.f}}; my $f.new; $f.f; $f.f = 'a'; $f.f 10:14
camelia No such method 'f' for invocant of type 'Any'
in block <unit> at <tmp> line 1
lizmat my $f.new ?? 10:29
tbrowder 10:30
what are you trying to achieve ?
tbrowder experimenting with identical names for methods and attrs. finished offline to my satisfaction. 10:31
we can if needed--very cool! 10:32
lizmat: is it safe to say in general that i can change perl's value of "undef" to "Nil" in raku for assignments? 10:35
lizmat yes
tbrowder that helps. do you know why Nil was chosen over undef for raku? 10:36
lizmat because every type object is basically undef 10:37
tbrowder ?
lizmat in Perl undef is many things
it's a function and it's a value and it's a state
in Raku these are split up really 10:38
there's an undefine() function still, but that's deprecated
because it has different semantics for scalar / arrays / hashes
every type object is a typed undefined value :-) 10:39
and Nil is the "untyped" undefined value
assigning Nil to a scalar will return that scalar to its default state
tbrowder erg, no wonder i never tried to get into perl guts...
lizmat m: my $a is default(42) = 666; say $a; $a = Nil; say $a 10:40
camelia 666
42
tbrowder !! 10:43
cool if needed. my pea brain can't think of a practical use offhand... 10:44
lizmat it could be handy for arrays 10:45
m: my @a is default(1); say @a[1000]
camelia 1
lizmat or hashes 10:46
m: my %h is default(1); say %h<foobar>
camelia 1
tbrowder oh, so an automatically full defined infinite array?
lizmat well, conceptually, yes
m: my %h is default(1); say %h<foobar>; say %h.elems 10:47
camelia 1
0
lizmat in reality, no :-)
tbrowder hm, raku is indeed wondrous! 10:48
thnx for the interesting trip 10:49
lizmat yw 10:50
Altreus any grown-ups able to help with my problem? :S 11:34
I'm at a total loss ;_;
lizmat Altreus: I have no idea either :-(
Altreus wait! I have output! 11:35
« ♥💔! 🔌…Closing connection
It just doesn't reconnect :z
I'm pretty sure all I changed was the string but ok
chloekek I want something like state but that makes it a property of self instead of the block. Does that exist? 11:41
There is has but its name must be unique across all methods.
Geth doc: Kaiepi++ created pull request #3300:
Document sigiled method calls
11:42
discord6 <tmtvl> Oh hey, the IRC bridge works again. Hello everyone!
chloekek I want to make prepared statements persist throughout my instance, but I would really like to just call all of them $sth, for brevity. 11:42
cpan-raku_ New module released to CPAN! DBIish::Transaction (1.0.1) by 03RBT
chloekek Like this: glot.io/snippets/fm3jkrnrf7 11:44
MasterDuke m: class F { my $sth = "select"; method get-sth() { $sth }; method set-sth($a) { $sth = $a } }; my $f = F.new; say $f.get-sth; my $g = F.new; $g.set-sth("update"); say $f.get-sth # or this? 11:46
camelia select
update
chloekek I specifically want them per instance, not global. 11:47
At runtime like has, but syntactically like my.
The storage of has but scoped per lexical scope, not for the entire class. 11:48
MasterDuke you could probably make some sort of Proxy object that stores in a hash keyed on the calling method's name 11:49
chloekek I can make a hash that maps SQL to prepared statements. 11:50
has DBDish::SQLite::StatementHandle %!sths; 11:52
method !sth(::?CLASS:D: Str:D $sql) { %!sths{$sql} //= $!dbh.prepare($sql); }
That should do the trick.
chloekek Example use: my $sth := self!sth(q:to/SQL/); ☺ 11:54
Geth doc: 7a4f43b118 | (Ben Davies)++ | doc/Language/objects.pod6
Document sigiled method calls
12:52
doc: 9cd4c4d35b | (Ben Davies)++ | xt/words.pws
Learn the enqueue and dequeue words
doc: 795dc6c896 | (Juan Julián Merelo Guervós)++ (committed using GitHub Web editor) | 2 files
Merge pull request #3300 from Kaiepi/sigiled-methods

Document sigiled method calls
linkable6 Link: docs.raku.org/language/objects
Geth doc: 4d7c12fb7d | (Ben Davies)++ | doc/Language/objects.pod6
Add missing quote in sigiled method call example
13:14
linkable6 Link: docs.raku.org/language/objects
cpan-raku_ New module released to CPAN! DBIish::Transaction (1.0.2) by 03RBT 13:50
chloekek When writing actions for grammars, how do you know what $/ will be like, when the grammar uses repetition? 13:58
In my grammar I have token TOP { <option>* %% \n } so I would expect $<option> to be a list of matches. 13:59
lizmat moritz jnthn ^^
jnthn I'd epxect so too :)
chloekek For some reason I get a Nil here: glot.io/snippets/fm3nbm4non 14:00
I inspected the match objects but it was not clear how I would get the option ASTs out.
chloekek $<option>».made just evaluates to [Nil, Nil] 14:02
jnthn You forgot to write `make` in the action methods
chloekek Ah
jnthn wonders if that's a common enough mistake to deserve a weak warning in Comma... 14:03
chloekek Thanks, now it works great. :)
Raku::Critic 14:04
cpan-raku_ New module released to CPAN! Data::Record (0.1.2) by 03KAIEPI 14:38
uzl[m] m: my @a := (1, 2); say @a.VAR.^name; say @a[0].VAR.^name; 14:46
camelia List
Int
uzl[m] m: my @a := (1, 2); say @a.VAR.^name; say @a[0].VAR.^name; @a[0] = 1;
camelia List
Cannot modify an immutable List ((1 2))
in block <unit> at <tmp> line 1

Int
uzl[m] m: my %a := Map.new('a', 1, 'b', 2); say %a.VAR.^name; say %a<a>.VAR.^name; 14:47
camelia Map
Int
uzl[m] m: my %a := Map.new('a', 1, 'b', 2); say %a.VAR.^name; say %a<a>.VAR.^name; %a<a> = 'Hi'; say %a
camelia Map
Int
Map.new((a => 1, b => 2))
uzl[m] ^ Is there any reason why trying to mutate a Map bound to a %-sigiled variable doesn't throw an error the same way a List bound to a @-sigiled variable does? 14:51
kanliot i was reading cr.openjdk.java.net/~rpressler/loo...posal.html and I think i read that raku supports coroutine semantics, but not actual coroutines. is this true? I think raku would be more interesting if it had real coroutines with the existing semantics which seem very good in raku! 14:54
jnthn Raku has multiple constructs that are coroutine-powerful (gather/take, and await); the actual impl of them is done in terms of continuations rather than coroutines, though that's an implementation detail. 14:58
kanliot hmm. does golang use multithreaded goroutines by default? 15:12
and thanks for the reply sir
chloekek At any one time a goroutine runs on at most one thread. 15:19
The number of threads that can be running different goroutines is given by GOMAXPROCS, which defaults to the number of cores. 15:20
chloekek A goroutine may run on different threads along its lifetime. 15:22
kanliot thanks chloekek, I guess you looked that up. 15:25
I'm having trouble learning perl OOP. is raku OOP easier somehow... Im reading raku.guide/#_classes_objects 15:26
mainly the problem is i'm just not smart enough or something
chloekek I looked up the default to GOMAXPROCS. :P
Altreus jnthn: help me jnthn-kenobi, you're my only hope :( 15:31
github.com/shuppet/p6-api-discord/...n.pm6#L193 I've got this far. It notices the exception and disconnects, but never seems to try to reconnect
I don't know what debugging to add to help figure out why 15:32
chloekek p6: sprintf("%4s", ‘楽’).chars; 15:37
camelia ( no output )
chloekek p6: say sprintf("%4s", ‘楽’).chars;
camelia 4
AlexDaniel what 15:38
m: say sprintf("%4s", ‘楽’);
camelia
AlexDaniel ah
chloekek But 楽 is twice as wide as Latin characters. :( 15:38
AlexDaniel chloekek: so? The width of some characters is unknown even 15:39
unidump: 楽
unicodable6 AlexDaniel, gist.github.com/673a178a454e675d1e...0fde87faf0
uzl[m] kanliot: I'd dare to say that Raku's OOP is one of the cleaniest and most straightforward OOP implementations I've seen in a programming language. I'm bit biased though ;-).
AlexDaniel chloekek: check East_Asian_Width property
chloekek Would be great to have support for that in s?printf. 15:40
Maybe it’s already there, I’d have to check.
AlexDaniel I doubt it
you're asking for something that is generally not possible
at least as far as I know
maybe there's a unicode doc somewhere saying how to do it 15:41
chloekek UAX #14 mentions it.
AlexDaniel UAX #14 is talking about where to break lines, I don't think it's helpful for font-related width 15:44
UAX #11 is probably more useful
chloekek There are also characters that take up no space such as the zero-width joiner. 15:45
AlexDaniel well, zero-width joiner normally appears in the middle of things that form a single grapheme anyway
chloekek Right. 15:46
kanliot thx uzl[m] raku.guide/#_classes_objects this web page seems well written as well. I stopped reading the page since I had to google how to distribute raku programs. I didn't like what i saw there
AlexDaniel chloekek: it's an interesting issue, maybe file a ticket about it? github.com/perl6/problem-solving/ 15:47
chloekek I’ll have to do some more research firts.
I found a Perl 5 module called Unicode::GCString that has a columns function for terminal printing. Let’s see what that has to say. 15:48
AlexDaniel chloekek: once there's a ticket I believe samcv will take a look at it, and she knows a lot more :)
chloekek Ok. 15:49
AlexDaniel “In "NONEASTASIAN" context, characters with East_Asian_Width property ambiguous (A) are treated as "narrow" and with Line Breaking Class AI as alphabetic (AL).” 15:53
thing is, your terminal probably has no idea
so my understanding is that you can guesstimate the number of fixed-pitch columns, but it doesn't mean much once you start printing them somewhere 15:54
Geth ¦ problem-solving: chloekek assigned to samcv Issue printf padding and wide East Asian characters github.com/Raku/problem-solving/issues/171 16:02
uzl[m] kanliot: I think raku.guide is meant to give you an overview of the language. For more in-depth treatment of a particular subject, always refer to the documentation. If you feel something isn't clear on there, you can ask here and/or submit an issue to github.com/Raku/doc/issues. 16:05
kanliot uzl[m], ok thanks. i see the documentation is linked at the top of raku.guide 16:06
uzl[m] kanliot: By distributing a Raku program, do you mean how to "modularize" it and then make it available in the ecosystem?
kanliot uzl[m], no I mean make it accessible to uh non-experts like me who google stuff and occassionally get a google result from github. 16:08
kanliot so you could zip up your raku module, but the user still needs to know how to install it on his/her OS 16:09
so it's a nonstarter for most people 16:10
uzl[m] hmm... if a module has its META6.json, installing it is quite easy since zef takes care of everything for you. docs.raku.org/language/modules#Loo...g_modules. 16:13
kanliot: BTW, do you mind sharing what you didn't like on raku.guide? You could submit an issue to github.com/hankache/rakuguide. 16:15
kanliot you remove the appeal of simplicity if it requires expertise. anyhow I can't lecture you
i love raku.guide. i have a problem with "modern perl fourth edition" which gives me a headache 16:16
sorry if i was unclear
uzl[m] Np! 16:20
samcv AlexDaniel, i have looked at it now chloekek 17:24
AlexDaniel samcv: but it's not just different unicode versions 17:49
samcv: people want to use it to render tui stuff in terminals
which will probably work in 99% of cases but this 1% will drown us with unfixable bug reports 17:50
if they want to know if something fits in the terminal then why don't they ask their terminal? :) 17:51
cpan-raku_ New module released to CPAN! DBIish::Transaction (1.0.3) by 03RBT 17:54
lizmat printf is grapheme based, and I think it should stay that way 18:01
which is already much better than printf's in other languages 18:02
Grinnz if you want to know how something will physically fit in terminal columns, you need something smarter than printf 18:03
AlexDaniel lizmat: is it? when somebody writes “%3s” what do they even mean?
why would you even want exactly three graphemes 18:04
Grinnz consider full width characters also
lizmat I'm not saying having a better capability for something like that wouldn't be nice
Grinnz ah, i see that's what the conversation was about :)
lizmat but printf has a POSIX background, and in earlier discussions about adding features to it 18:05
Grinnz yes, in Perl we use Unicode::GCString's "columns" method 18:05
lizmat it was decided to keep to the POSIX meaning of it
Grinnz (for terminal columns)
chloekek I think A good compromise would be to mention a module that implements terminal-aware spacing, once such a module exists.
Grinnz i don't think it would work well as a printf extension, because what do you do when someone tries to print two full-width characters and specifies a width of 3 columns 18:06
lizmat thing is, even something like the "columns" method, assumes a fixed width font
lizmat anybody creating a nice GUI would *not* use a fixed with font if they can help it 18:07
Grinnz of course, if you have to know about the particular font widths everything goes out the window
lizmat so feels to me, that the GUI system of choice, should figure out how much space a string needs
Grinnz yes, much like when dealing with CSS 18:08
chloekek What good is space padding with a proportional font?
AlexDaniel fixed-width or not, you just can't know how it's going to render
Grinnz space padding would not be the appropriate approach in such cases 18:09
instead you'd need to align it to other components of the display
AlexDaniel: you can't know, but you can assume what will happen if it's properly displayed in fixed width 18:10
this would be essential for any TUI app
AlexDaniel “essential” 18:12
here lynx renders stuff in a fake window: github.com/ThomasDickey/lynx-snaps...es.c#L2240 18:13
samcv AlexDaniel, TUI? 18:24
AlexDaniel samcv: text-based/terminal user interface 18:25
samcv Ah terminal user interfaces. Well. We go by what unicode says. The end. If they make a bug report, we close it since we go with unicode spec on this, otherwise it needs to go in a module
it's not going to be guaranteed to be accurate. but only based on the unicode data. I think if we make that clear then that should be okay
samcv lizmat, yes it *is* the gui's job. unicode makes that clear. but also they understand that this is a useful use-case. previously they didn't want to change any of the width properties, but at least as far as I know, they changed their stance to allow changing tho east asian width for non-asian characters to accomodate it. So they don't guarantee it is perfect or even correct information, but just "better" than not having that information. 18:29
though. it can just be kicked to a module, regardless, so i guess the question is if it should exist in sprintf or not 18:32
and also, if it will add value to the language itself 18:33
lizmat you can use sprintf to convert any numerical value to a Str, then have another module take care of twiddling grapheme widths
AlexDaniel anything can add value, doesn't mean that everything should be in the language itself
samcv yep. that is true. 18:34
AlexDaniel also I'm a fan of naming things for what they actually do. %10w makes it look like it does something proper while :guess-rendered-length is a bit more transparent and better :) 18:36
vrurg I would say 'printf ..., :wide;' should be cheap enough to be considered.
AlexDaniel: no guessing. Only clear "use" or "don't". Things must be predictable. 18:37
samcv in addition, what are the pros and cons of letting a module do this. If them reimplementing sprintf is not really feasible. the options are to implement it or have some way people can plug into sprintf or something (just spitballing here, I haven't thought hard enough about all of this)
AlexDaniel vrurg: yeah, exactly why a feature like this should be called this way :P 18:38
vrurg AlexDaniel: perhaps because the feature should be "use 2 char if I ask you for this", not "try guessing if 2char should be used". 18:39
¯\_(ツ)_/¯ 18:40
AlexDaniel vrurg: “Some characters behave differently in an East Asian context than in a non-East Asian context” 18:41
vrurg: how do you define context without guessing?
vrurg If "context" is defined by surrounding symbols – it's not guessing, it's knowing. If it's defined by the purpose and destination of a string – then it's up to the user to determine the context. A 3rd party module can help him in this task. 18:43
But it's Raku job to do it.
samcv AlexDaniel, example? 18:44
vrurg Or I don't understand what 'context' means in this context. :)
AlexDaniel “Ambiguous characters behave like wide or narrow characters depending on the context (language tag, script identification, associated font, source of data, or explicit markup; all can provide the context). If the context cannot be established reliably, they should be treated as narrow characters by default.” 18:45
for terminals it seems to depend on the locale 18:46
samcv AlexDaniel, oh. well. unicode gives us values for all(not actually all but, some) characters. so go on that, and let that be it? i think you are talking about how unicode decides if something is wide or not?
vrurg AlexDaniel: and on a font used. I use DejaVu Mono because it fits most if not all wide-chars (like arrows) into a single position.
samcv though i need to read that document
vrurg Shoud Raku take care finding out what font am I using? 18:47
samcv vrurg, never
vrurg samcv: this is my point too.
AlexDaniel samcv: I'm talking about characters that unicode defines as East Asian Ambiguous
samcv ah yeah. fair enough 18:48
" If they are not used in context of the specific legacy encoding they belong to, their width resolves to narrow" hmm
so. that leads me to believe. that it is usually only wide if it's using a two byte encoding (DBCS) 18:49
and that is a bit out of our scope. so if I am right then those are just narrow, except if you're converting from some dual byte encoding (which we aren't since it's just a NFG unicode string) 18:50
vrurg Iterm2 has a configuration option "Ambiguous characters are double-width". So, this would most likely affect things too. 18:51
samcv vrurg, well. that is out of scope. we can't control what anybody else does with the data
AlexDaniel interesting bug report bugs.debian.org/cgi-bin/bugreport....bug=471021
chloekek Finally got around to writing a dark style sheet for docs.raku.org. 19:17
chloekek Even inverting the type graphs. :) 19:19
lizmat just noticed that en.wikipedia.org/wiki/Raku_(progra..._language) has nothing about supplies,. channels, react / whenever 20:10
AlexDaniel lizmat: yes, but even our own docs don't talk enough about react/whenever :( 20:14
lizmat :-( 20:15
chloekek p6: my (IO() $x) = "foo"; say $x 20:16
camelia foo
chloekek p6: my (IO() $x is copy) = "foo"; say $x
camelia foo
chloekek p6: my (:$x) = |{x => 1}; say $x; 20:17
camelia x => 1
AlexDaniel chloekek: how is this legal :D
chloekek > Signatures appear … as the input to variable declarators like my 20:18
p6: my (*@xs) = (1, 2, (3, 4), 5); say @xs
camelia [1 2 (3 4) 5]
chloekek p6: my (**@xs) = (1, 2, (3, 4), 5); say @xs
camelia [1 2 (3 4) 5]
AlexDaniel m: my ($x is wtf); $x = 42; say $x 20:19
camelia 42
lizmat feels to me it's parsing as a signature, but losing all of the extra info
chloekek p6: my ($x --> Str) = 1; say $x; 20:20
camelia 1
AlexDaniel m: my ($x returns Int) # not sure why this parses 20:22
camelia ( no output )
AlexDaniel but yeah you can do --> 42 and everything else and it is simply ignored
jnthn It *is* parsed as a signature
That's why you can write my ($x, :$y) := ...; to do destructuring 20:23
AlexDaniel jnthn: yeah but returns can't really be inside a signature, right? :)
jnthn Sure, syntactically it's just a trait 20:23
The problem is that when we see it's just an assignment, we reduce it to a variable list and discard everything else
We never apply the trait
It should really be much stricter there 20:24
Though probably at a language version break so we don't turn ignored into boom.
AlexDaniel 6c: my (IO() $x) = "foo"; say $x # just in case
committable6 AlexDaniel, ¦6c (42 commits): «foo␤»
chloekek p6: my (IO() $x) = ‘foo’; say $x.raku
camelia "foo"
AlexDaniel 6c: my (IO() $x return 42) = "foo"; say $x # just in case
6c: my (IO() $x return Int) = "foo"; say $x # just in case
6c: my (IO() $x returns Int) = "foo"; say $x # just in case 20:25
committable6 AlexDaniel, gist.github.com/3d1c1a206b353b9bb2...b874e4dbbf
AlexDaniel, gist.github.com/90245c0cb4c1c68a59...f0c249b04d
AlexDaniel, ¦6c (42 commits): «foo␤»
jnthn Ah, and to be clear: it's parsed as a signature and then reduced because we don't do lookaheads while parsing, but we'd not know what to parse it as until we got to the = or := 20:27
So it's parsed as the most general thing
AlexDaniel m: my ($x returns Int --> 5) # wheeeee 20:36
camelia ( no output )
AlexDaniel m: my ($x of Str returns Str returns Str returns Str --> Str) 20:37
camelia ( no output )
AlexDaniel :)
jnthn Well yeah, it's pretty obvious that if it ignores traits, then you can write whatever crazy thing you wnat ;) 20:44
My worry is if anyone has got such thing in modules. I wonder if greppable can be convinced to help... 20:45
.oO( When we have a Raku AST, write astable so we can query the ecosystem by AST )
p6steve could use some macros, too 20:47
AlexDaniel greppable6: my\s*\( 20:53
let's see if there are many results for this
greppable6 AlexDaniel, 2223 lines, 390 modules: gist.github.com/d0ee9f6e83b83949ea...d3e9f4cd10
AlexDaniel uh 20:54
AlexDaniel greppable6: my\s*\(.*Int 20:54
greppable6 AlexDaniel, 38 lines, 22 modules: gist.github.com/f9114712d13be2e2b7...ea1c1ba453
AlexDaniel greppable6: my\s*\(.*Int\( 20:55
greppable6 AlexDaniel, 3 lines, 1 module: gist.github.com/88fdada4f38cccb37b...c5b0f2a346
AlexDaniel greppable6: my\s*\(.*Str\(
greppable6 AlexDaniel, Found nothing!
AlexDaniel greppable6: my\s*\(.*IO\(
greppable6 AlexDaniel, Found nothing!
AlexDaniel jnthn: I guess it happens but it's not common 20:56
greppable6: my\s*\(.*\(\).*=
greppable6 AlexDaniel, 5 lines, 3 modules: gist.github.com/3fd9c2c0c3bdf3380d...08ac681886
AlexDaniel what else can we search for, default value? 20:57
greppable6: my\s*\(.*=.*\)\s*= 20:58
greppable6 AlexDaniel, 2 lines, 2 modules: gist.github.com/6fda2c575009c97a25...97e5e45117
AlexDaniel heh
AlexDaniel jnthn: R#3587 21:06
linkable6 R#3587 [open]: github.com/rakudo/rakudo/issues/3587 Signature handling in `my (…)` is too permissive
AlexDaniel feel free to edit/comment :)
MasterDuke re searching via AST, what about using Perl6::Parser? 21:07
lichtkind in supply cpu burden is on sender? 21:15
jnthn The sender pays for the processing costs of what it sends unless you do something to prevent that, yes 21:23
Whether that's CPU cost or just time cost is another matter; in principle something downstream can `await` in its `whenever` and that won't use CPU, but will mean it's longer until you get back control. 21:24
(That's the difference between `await` of a Promise or a nested `whenever`: one causes backpressure, the other doesn't) 21:25
lichtkind jnthn++
thank you, so actually my slides were correct :)
jnthn: so whenever does the asking? 21:27
jnthn Not sure what you mean by "asking"; it subscribes, at least :) 21:35