🦋 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. |
|||
bps | Hmm... Ok. Thanks. The weird thing is, I installed successfully on another laptop a couple days ago. I'll probably try cleaning everything out and going through the installation again... | 00:01 | |
00:02
lostinfog joined
00:06
snarkyboojum_ joined
00:07
patrickz joined
00:09
bps left
00:10
sena_kun joined
00:11
patrickb left
00:12
Altai-man_ left
00:24
patrickz left
00:25
ToddAndMargo joined
00:39
wamba left
|
|||
ToddAndMargo | anyone on newbie duty? | 00:41 | |
01:02
snarkyboojum_ left
|
|||
ToddAndMargo | Qustion: when I use "UInt" and "uint", they act exactly the same for me. One is a subset of Int and the other is a native type, but they act exactly alike (well, for me). What is the difference between them? | 01:11 | |
AlexDaniel | one is a native type and the other isn't | 01:26 | |
uint is uint64 I think | |||
while UInt can be of any size | |||
ToddAndMargo | Hi Alex, I though that if you did not give a type a size (uint16, etc.) that it was assigned one on the fly based on what data you fed it. Am I to presume now that it will always assign the largest size? | 01:30 | |
What confuses me is if one is a native type and the other is a subset of Int, what do they act exactly the same? | 01:31 | ||
why not what. Stinking typos | 01:32 | ||
01:42
llfourn left
|
|||
ToddAndMargo | By any change was UInt just an academic task to show how to duplicate an uint? | 01:43 | |
01:47
llfourn joined
02:02
wildtrees left
02:09
Altai-man_ joined
02:12
sena_kun left
|
|||
[Coke] | when you say they act the same - can you provide an example? | 02:16 | |
02:19
llfourn left
|
|||
[Coke] | native types can have more compact storage, but that's not going to impact functionality. | 02:20 | |
... the fact that they don't have an object associated with them I would expect to impact some functionality, though. | 02:21 | ||
m: my UInt $a = 3; my uint $b = 4; dd $a; dd $b | |||
camelia | Int $a = 3 4 |
||
[Coke] | m: my UInt $a = 3; my uint $b = 4; say $a.^name, $b.^name; | ||
camelia | IntInt | ||
[Coke] | (that explodes on the uint in my REPL, weird.) - but I think what's happening there is that the uint sees you're trying to do something object-y on it, so it upgrades. So then the method call works, but it's not technically being called on the uint. | 02:23 | |
ToddAndMargo | p6 'my UInt $a = 3; my uint $b = 4; say $a.^name, " ", $b.^name;'Int Intsays they are the same thing. I am starting to think UInt is an academic exercise on how to create an unsigned integer | 02:26 | |
02:34
cpan-raku left,
cpan-raku joined,
cpan-raku left,
cpan-raku joined
02:36
llfourn joined
|
|||
ToddAndMargo | oh wait a minute. UInt is not constrained. p6 'my UInt $c = 0x0; $c = $c +| 0x1FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF; say $c'862718293348820473429344482784628181556388621521298319395315527974911 | 02:36 | |
Up to that point they act exactly the same. | |||
uzl[m] | [Coke]: Yeah, those are outside articles so I went with the articles's original titles ;-). I wonder if lizmat will update the OpenSource articles. | 02:41 | |
02:46
mahmudov left
|
|||
[Coke] | ToddAndMargo: yes. when you try to invoke methods on a native type, it converts it first, then calls the method. | 02:54 | |
docs.raku.org/language/nativetypes | 02:55 | ||
m: my uint $a = 3; say $a ~~ uint; say $a ~~ UInt; | |||
camelia | False True |
||
[Coke] | in order to call .ACCEPTS with ~~, it has to put it into a box first. | 02:56 | |
so yes; if you call methods on it, it looks like the same. | |||
[Coke] wanders off | 02:57 | ||
ToddAndMargo | Now I am confused. $ p6 'my uint $a = 3; say $a ~~ uint; say $a ~~ UInt; say $a.^name'FalseTrueInt | 03:03 | |
oh, I get it, it was converted before the method was called. | 03:08 | ||
vrurg | Total memory malfunction: how do I get %?RESOURCES set for the current directory where I debug? | 03:13 | |
tellable6 | hey vrurg, you have a message: gist.github.com/4860b7a544513b7262...971ac8461a | ||
ToddAndMargo | How do I flip the bits? how do I turn 0xFF00 into 0X00FF? | 03:41 | |
foudn this, but can figure out what they are saying: docs.raku.org/language/operators#prefix_?^ | 03:42 | ||
03:56
bps joined
|
|||
bps | Have a lot of people been reporting errors attempting to install raku from source? | 03:57 | |
===SORRY!=== Error while compiling /home/bstahlman/rakudo/home#sources/4166C19B90D62E6DB23143963A5A2C2E658CACB3 (Zef::Distribution)Method 'content' must be implemented by Zef::Distribution because it is required by roles: Distribution.at /home/bstahlman/rakudo/home#sources/4166C19B90D62E6DB23143963A5A2C2E658CACB3 (Zef::Distribution):5 | |||
04:01
NODE left
04:03
NODE joined
04:05
NODE left
04:06
NODE joined
04:10
sena_kun joined
04:12
Altai-man_ left
|
|||
ToddAndMargo | figured it out: $ p6 'my uint8 $c = 0xA5; my uint8 $d = +^$c; say $d.base(16);' 5A | 04:26 | |
04:30
lostinfog left
04:43
snarkyboojum_ joined
04:47
lostinfog joined
04:50
bps left
04:52
snarkyboojum_ left
04:55
snarkyboojum_ joined
05:04
guifa2 joined
|
|||
guifa2 | Someone on SO asked about carp | 05:16 | |
05:16
llfourn left
|
|||
guifa2 | Only thing I can't figure out is how to properly create a new backtrace in the subclassed exception but | 05:17 | |
bit.ly/30k7enl (long TIO url so shortened) | |||
err, I just realized I'm jumping up to the sub but not preserving the line number within it, oops | 05:18 | ||
05:28
llfourn joined,
squashable6 left
|
|||
xinming | m: my $t = try { 3/0 } // 'Inf'; "$t".perl.say; | 05:28 | |
camelia | Attempt to divide by zero when coercing Rational to Str in block <unit> at <tmp> line 1 |
||
xinming | How can we force the 3/0 to be evaluated? | ||
m: my $t = try { 3/0 } // 'Inf'; $t.perl.say; | 05:29 | ||
camelia | <1/0> | ||
05:29
squashable6 joined
|
|||
xinming | I mean this example, I wan the exception to be thrown within try, not delayed to the latter use of $t. | 05:29 | |
05:29
squashable6 left
05:31
squashable6 joined
|
|||
guifa2 | You have to force an evaluation with it, for example you could do | 05:34 | |
m: my $t = try { my $a = 3/0; sink $a.Str; $a } // 'Inf'; $t.perl.say; | |||
camelia | "Inf" | ||
guifa2 | Rats intentionally will go as long as they can, because you can always adjust the denominator at will: | ||
m: my $x = 3/0; $x.denominator = 1; say $x | 05:35 | ||
camelia | Cannot modify an immutable Int (0) in block <unit> at <tmp> line 1 |
||
guifa2 | err... well you used to be able to ha | ||
(or at least I thought you could. Either way, the thinking was there are multiple reasons why a Rat might be unevaluatable, and that it would be more useful to allow for checking that later than force it to be done earlier) | 05:36 | ||
05:43
llfourn left
05:49
NODE left
05:51
NODE joined
05:56
[Coke] left
06:03
lostinfog left
06:09
Altai-man_ joined
06:12
sena_kun left
06:17
sauvin joined
06:18
llfourn joined
06:24
llfourn left
06:28
ToddAndMargo left
06:56
llfourn joined,
stoned75 left
07:01
llfourn left
08:01
quotable6 left,
bloatable6 left,
nativecallable6 left,
committable6 left,
sourceable6 left,
releasable6 left,
bisectable6 left,
greppable6 left,
reportable6 left,
notable6 left,
unicodable6 left,
benchable6 left,
coverable6 left,
statisfiable6 left,
shareable6 left,
squashable6 left
08:02
squashable6 joined,
nativecallable6 joined
08:03
sourceable6 joined,
notable6 joined,
committable6 joined,
quotable6 joined,
reportable6 joined,
releasable6 joined,
statisfiable6 joined
08:04
benchable6 joined,
shareable6 joined,
bisectable6 joined,
bloatable6 joined,
coverable6 joined,
greppable6 joined,
unicodable6 joined
08:10
sena_kun joined
08:12
Altai-man_ left
08:18
xinming left
08:19
xinming joined
08:34
rindolf joined
08:57
llfourn joined
09:02
llfourn left
09:13
pedr0 joined
09:14
pedr0 left
|
|||
xinming | guifa2: Thanks, I use something like, try { my $a = Num(3/0) } // 'Inf'; | 09:17 | |
09:21
pedr0 joined
|
|||
pedr0 | hello everybody - I am a bit new to the perl6 world so forgive me the silly question. I'd like to run a command with 'run', get the output and run a regex on it, then loop through all grouping command. | 09:22 | |
I've managed to run the command and get the output, but I am stuck at the point of running a regex on it | 09:23 | ||
09:24
scimon joined,
rindolf left
|
|||
xinming | pedr0: If you captured output all at once, You can use my $output = qx:/command/; then $output ~~ //; | 09:29 | |
pedr0 | yeah, but how can I iterate through the captured groups ? | 09:31 | |
xinming | You can check the $/ var | 09:33 | |
if it's named capture, You can have $<capture-name> | |||
If it's positioned, You can use $0 $1 $2 ... | |||
09:34
kensanata joined,
rindolf joined
|
|||
pedr0 | thanks | 09:37 | |
09:39
wamba joined
09:40
wamba left
09:56
fingolfin70 joined
|
|||
fingolfin70 | Hello! Where can I find out how to properly create and apply my own exception types? | 09:56 | |
Xliff | fingolfin70: docs.perl6.org/language/exceptions | 09:57 | |
fingolfin70 | I read docs.perl6.org/language/exceptions, but there is only about using. | ||
Xliff | Creating an exception is as simple as defining a class that inherits from exception. "class X::My::Exception is exception { }" | 09:58 | |
Then to use it, X::MyL::Exception.new.throw | |||
X::My::Exception.new.throw # Oops | |||
So... to sum it up PROPERLY! | 09:59 | ||
m: class X::My::Exception is Exceptionl; X::My::Exception.new.throw | |||
camelia | 5===SORRY!5=== Error while compiling <tmp> 'X::My::Exception' cannot inherit from 'Exceptionl' because it is unknown. Did you mean one of these? 'Exception' 'Exceptions' at <tmp>:1 |
||
Xliff | m: class X::My::Exception is Exception; X::My::Exception.new.throw | ||
camelia | 5===SORRY!5=== Error while compiling <tmp> Semicolon form of 'class' without 'unit' is illegal. You probably want to use 'unit class' at <tmp>:1 ------> 3class X::My::Exception is Exception;7⏏5 X::My::Exception.new.throw |
||
Xliff | m: class X::My::Exception is Exception {}; X::My::Exception.new.throw | ||
camelia | Died with X::My::Exception in block <unit> at <tmp> line 1 |
||
Xliff | There you go... | 10:00 | |
fingolfin70 | Thanks. I was hoping that there was detailed information. But if not, then I’ll get along with it. | ||
Xliff | Between what I just showed you, the exeption page, and docs.perl6.org/type/Exception | ||
That should be all you really need. If not, please ask your questions here. | 10:01 | ||
To help us improved the documentation, please suggest changes, here... or even better, let us know where the docs fall short by raising an issue, here: github.com/Raku/doc/issues | 10:02 | ||
m: $a = 'const * char *'; say $a ~~ m:g/ | 10:07 | ||
8 | |||
camelia | 5===SORRY!5=== Error while compiling <tmp> Variable '$a' is not declared at <tmp>:1 ------> 3<BOL>7⏏5$a = 'const * char *'; say $a ~~ m:g/ |
||
Xliff | m: $a = 'const * char *'; say $a ~~ m:g/'*'/ | ||
camelia | 5===SORRY!5=== Error while compiling <tmp> Variable '$a' is not declared at <tmp>:1 ------> 3<BOL>7⏏5$a = 'const * char *'; say $a ~~ m:g/'*' |
||
Xliff | m: my $a = 'const * char *'; say $a ~~ m:g/'*'/ | ||
camelia | (「*」 「*」) | ||
Xliff | m: my $a = 'const * char *'; ($a ~~ m:g/'*'/).elems,sat | 10:08 | |
camelia | 5===SORRY!5=== Error while compiling <tmp> Undeclared routine: sat used at line 1. Did you mean 'set', 'say'? |
||
Xliff | m: my $a = 'const * char *'; ($a ~~ m:g/'*'/).elems.asy | ||
camelia | No such method 'asy' for invocant of type 'Int'. Did you mean 'any'? in block <unit> at <tmp> line 1 |
||
Xliff | m: my $a = 'const * char *'; ($a ~~ m:g/'*'/).^name.say | ||
camelia | List | ||
Xliff | m: my $a = 'const * char *'; ($a ~~ m:g/'*'/).Array.elems.say | ||
camelia | 2 | ||
10:09
Altai-man_ joined
10:12
sena_kun left
10:28
pedr0 left
10:32
laama left
10:52
NODE left
10:55
NODE joined
10:56
NODE left
10:57
NODE joined
10:58
llfourn joined
11:04
llfourn left
|
|||
Kaiepi | releasable6, status | 11:13 | |
releasable6 | Kaiepi, Next release will happen when it's ready. 1 blocker. 0 out of 438 commits logged | ||
Kaiepi, Details: gist.github.com/015cf3abc225ab6cdf...f14bc03a62 | |||
11:19
llfourn joined
11:31
kensanata left
11:35
NODE left
11:36
NODE joined
11:38
laama joined
11:56
Doc_Holliwood left
11:57
Doc_Holliwood joined
12:10
sena_kun joined
12:12
Altai-man_ left
12:19
NODE left
12:21
NODE joined
12:29
fingolfin70 left
12:31
kensanata joined
12:41
NODE left
12:42
NODE joined
12:44
NODE left
12:45
NODE joined
12:46
xinming left
12:47
xinming joined
12:50
wamba joined,
NODE left
12:52
NODE joined
12:53
NODE left
12:54
NODE joined
12:55
wamba left
13:15
wamba joined,
[Coke] joined,
[Coke] left,
[Coke] joined,
snarkyboojum_ left
13:18
llfourn left
13:19
domidumont joined,
NODE left
13:21
lucasb joined,
NODE joined
13:53
xinming left
13:54
xinming joined
|
|||
lizmat clickbaits rakudoweekly.blog/2020/01/13/2020-...nt-things/ | 14:05 | ||
14:07
xinming left,
xinming joined
14:09
Altai-man_ joined
14:12
sena_kun left
|
|||
[Coke] | lizmat++, as always. | 14:13 | |
14:25
kensanata left
14:35
Guest78373 left
14:41
xinming left
14:42
xinming joined
14:50
Poohman joined
|
|||
Geth | doc: Kaiepi++ created pull request #3160: [WIP] Begin documenting HOW archetypes and document parameterization |
15:01 | |
15:17
pmurias joined
|
|||
pmurias | hi | 15:17 | |
tellable6 | 2020-01-12T21:58:44Z #raku-dev <AlexDaniel> pmurias: what's the status of github.com/perl6/perl6-parcel-example ? | ||
2020-01-12T22:07:42Z #raku-dev <AlexDaniel> pmurias: also github.com/perl6/parcel-plugin-nqp | |||
pmurias | AlexDaniel`: those repos are usefull if you want to parcel up rakudo.js apps for use in the browser | 15:19 | |
AlexDaniel`: I haven't done anything raku related in a while (mostly focused on job interview preparation, had a google phone screen today) | 15:20 | ||
AlexDaniel`: rakudo.js stuff should be migrated to parcel 2.0 | |||
15:48
Guest78373 joined
15:53
NODE left
15:55
NODE joined
15:56
NODE left
15:58
NODE joined
16:04
kensanata joined
16:10
sena_kun joined
16:12
Altai-man_ left
16:13
pmurias left
16:24
xinming left
16:25
xinming joined
16:26
domidumont left
16:29
Geth left
16:36
Geth joined
16:43
Kaiepi left
16:44
Kaiepi joined
17:00
NODE left
17:02
NODE joined
|
|||
xinming | What is the right way to redirect the stdout to different handle please? | 17:03 | |
I tried something like... temp $*OUT = "test-stdout.txt".IO; But I got error | |||
somethign like Too many positionals passed; expected 1 argument but got 2 | |||
jnthn | You need to open the file, so there's a file handle there, not a path | 17:04 | |
temp $*OUT = open "test-stdout.txt", :w; | |||
xinming | Thanks, it worked. | 17:05 | |
m: (open "test.txt").WHAT.say; "test-io.txt".IO.WHAT.say; | |||
camelia | (Failure) (Path) |
||
xinming | m: (open "/dev/null").WHAT.say; "test-io.txt".IO.WHAT.say; | ||
camelia | (Handle) (Path) |
||
17:06
ab5tract joined
17:10
bps joined
17:11
NODE left
17:12
NODE joined
|
|||
xinming | Some one asked here before, Is it possible to change args to race and hyper prefix?? | 17:13 | |
what I thought maybe something like race:batch<4>:degree<3> would be nice. :-) | |||
17:14
NODE left
|
|||
xinming | race:batch<4>:degree<3> for @xxx -> $yy { ... } | 17:14 | |
ab5tract | \@xxx.race: &func :batch(4) | 17:15 | |
backslash was to disable the webchat thiny | |||
*thingy | |||
17:15
NODE joined
17:16
lostinfog joined
|
|||
ab5tract | xinming: basically those settings are very easy to pass to the race when used in method form | 17:16 | |
17:17
NODE left
17:18
kensanata left,
NODE joined
17:20
NODE left
17:21
kensanata joined
|
|||
xinming | I don't mean the &func thing, | 17:23 | |
I wish something to support at statement level. | |||
I know @array.race(...).map({ }); will do the job | |||
ab5tract | just put the block you are supplying the for loop as an argument to the race method | ||
jnthn | You can say `race for @foo.race(:batch(1)) { }`. I don't think there'll be sugar for this, since the goal really is that in most cases it picks an appropriate batch/arity for you, and so you'd need to specify them less. | 17:24 | |
ab5tract | nvm, i think i forgot the race syntax, sorry xinming | 17:25 | |
xinming | ab5tract: It's ok. :-) | ||
jnthn: the algorithm to choose degree in race statement prefix is the same as one used in .race method, right? | |||
ab5tract | xinming might be a fun project to try defining your own sugar op for it :) | 17:26 | |
guifa2 is packaging up a Raku Carp module. Should it just be "Carp" or "Exceptions::Carp" or? | |||
17:26
NODE joined
17:27
NODE left
|
|||
jnthn | xinming: Yes | 17:27 | |
lizmat | guifa2++ # glad I don't have to do that | ||
I would call it just Carp and if it adheres to the P5 interface, mark it as such | 17:28 | ||
17:28
NODE joined
17:30
scimon left,
NODE left
|
|||
guifa2 | lizmat: for right now, I just took the basic carp/croak/cuckle/confess output behaviors and replicated (full trace vs single line, and throwing vs just outputing to $*ERR). Might investigate if I can capture the arguments like it seems the P5 one does | 17:33 | |
17:34
NODE joined
17:37
NODE left
|
|||
guifa2 | (it looks like I can't, at least not without digging into deeper internals or implementing a very different way, oh well, the baseline stuff should be enough for now) | 17:39 | |
lizmat | yeah, baseline is good :-) | 17:40 | |
17:41
NODE joined
17:42
xinming left
17:43
xinming joined
|
|||
xinming | m: my @h = <a b c>; my @a = <x y z>; @h.map(-> $h { @a.map({ "$_:$h" }).Slip }).perl.say; | 17:54 | |
camelia | ("x:a", "y:a", "z:a", "x:b", "y:b", "z:b", "x:c", "y:c", "z:c").Seq | ||
xinming | In this example, Is there other way to not write the .Slip the list within list, But still does the Slip thing? I don't mean the | op. | 17:56 | |
HollisterSmiley | m: say (1, slip($(2, 3)), 4) eqv (1, 2, 3, 4); # OUTPUT: «False» | 18:03 | |
camelia | 5===SORRY!5=== Error while compiling <tmp> Bogus statement at <tmp>:2 ------> 3<BOL>7⏏5» expecting any of: prefix term |
||
HollisterSmiley | m: say (1, slip($(2, 3)), 4) eqv (1, 2, 3, 4); | ||
camelia | True | ||
HollisterSmiley | evalable: say (1, slip($(2, 3)), 4) eqv (1, 2, 3, 4); | ||
evalable6 | True | 18:04 | |
HollisterSmiley | As per documentation this should say False | ||
lizmat | HollisterSmiley: I disagree | 18:07 | |
or are you referring to the containerness of $(2,3) ? | |||
HollisterSmiley | With the documentation? | ||
I am referring to the docs saying it should return False | 18:08 | ||
And yet it doesn't. | |||
docs.raku.org/language/list#___top | |||
last example in the paragraph | |||
docs.raku.org/language/list#Slips that is | 18:09 | ||
18:09
Altai-man_ joined
|
|||
lizmat | hmmm... but "(1, |$(2, 3), 4)" is functionally equivalent to (1, slip($(2, 3)), 4) | 18:10 | |
m: dd (1, slip($(2, 3)), 4) | |||
camelia | (1, 2, 3, 4) | ||
lizmat | m: dd (1, |$(2, 3), 4) | ||
camelia | (1, 2, 3, 4) | ||
HollisterSmiley | That's what I thought. Probably just wrong the docs is. | ||
lizmat | yes, /me thinks | ||
18:12
sena_kun left
|
|||
ab5tract | i wonder if that documentation is pre-Great List Refactor? | 18:13 | |
Geth | doc: 2dd56f758c | (Elizabeth Mattijsen)++ | doc/Language/list.pod6 Fix output value (1, |$(2, 3), 4) is functionally equivalent with (1, slip($(2, 3)), 4) so both should give the same answer. Whether or not containerness if the list should be taken into account, is possibly another question. But not a documentation issue. |
||
lizmat | ab5tract: could well be | 18:14 | |
HollisterSmiley | lol | 18:18 | |
i was about to do it, | |||
18:19
wildtrees joined
|
|||
lizmat | HollisterSmiley: sorry :-) | 18:19 | |
18:20
wildtrees left,
wildtrees joined
|
|||
HollisterSmiley | but still. what does , "so it only affects a single | 18:21 | |
value, but unlike the above options, it will break L<Scalars|/type/Scalar>." mean | |||
I mean, the example you just fixed was related to this very statement | 18:22 | ||
i'm thinking, it should also go. | |||
18:23
wildtrees left,
wildtrees joined
|
|||
lizmat | HollisterSmiley: possibly, but that would require more thought / discussion | 18:24 | |
and possibly a doc issue :-) | |||
guifa2 | lizmat: will probably finish up Carp tonight — having a few edge case issues and about ot have to go into $day-job. | 18:36 | |
lizmat | guifa2+ | ||
+ | 18:37 | ||
xinming | I think Slip thing and @array[] thing is a bit confusing to perl5 users at first. | 18:41 | |
Slip will be the behavior in perl5 we want. the @array[] returns an Seq | |||
18:43
wamba left
18:44
bps left
18:47
kensanata left
|
|||
lizmat | m: my @a; dd @a[] # @array[] does not return a Seq? or is that what you want ? | 18:49 | |
camelia | Array @a = [] | ||
xinming | hmm, Ignore me, my bad, | 18:50 | |
guifa2 | is there a way to have a module set variables using :named-parameters on use? it seems if you include a EXPORT::foo package, its block gets called whether you intend to load it or not | ||
xinming | I have example wrong. :-) | ||
18:55
chloekek joined
|
|||
guifa2 | Or should I just do | 18:55 | |
use Module :export, :export, :export, <multiple options in a string like this to get caught by sub EXPORT> | 18:56 | ||
lizmat | there's a way to do named params on a use | ||
HollisterSmiley | Whatever I touch I break, eh lizmat ;-) | 18:57 | |
lizmat | sounds familiar :) | ||
xinming | Is it possible to get how much the :degree and :batch value be calcuated on this machine? | 18:59 | |
ab5tract | guifa2 check out the dispatch table example from the export docs | 19:00 | |
you can programmatically include whatever you want into the importing namespace based on arguments to use | 19:01 | ||
'dispatch table' eqv 'map of functions keyed on function name' | 19:02 | ||
19:02
mahmudov joined
|
|||
lizmat | xinming: afaik, they are public attributes | 19:04 | |
pretty sure :$batch = 64 and :$degree = cpucores / 2 | |||
hmmmm apparently not: | 19:05 | ||
method hyper(Int(Cool) :$batch = 64, Int(Cool) :$degree = 4) { | |||
method race(Int(Cool) :$batch = 64, Int(Cool) :$degree = 4) { | 19:06 | ||
xinming | Yea, They are hard coded. | 19:13 | |
in gen/moar/CORE.c.setting | |||
19:13
stoned75 joined
19:14
NODE left
19:16
NODE joined
19:19
xinming left,
xinming joined
|
|||
guifa2 | ab5tract: so it seems that the OUR::{'foo'} export symbols are only exported in the case that a named parameter is passed BUT any code inside of the block is run | 19:22 | |
I'll probably just do it | 19:24 | ||
use Carp :confess, :croak, :cluck, <block ofun> | 19:25 | ||
19:25
mahmudov left
19:26
sauvin left
19:27
Poohman left
|
|||
ab5tract | guifa2 is it easy to gist? | 19:27 | |
here is the pattern i mentioned github.com/ab5tract/Terminal-Print...t.pm6#L350 | 19:28 | ||
but it might not apply to your case :/ | 19:29 | ||
guifa2 | ab5tract: yeah, that sub EXPORT() only captures positionals =\ | 19:30 | |
19:30
rypervenche left
|
|||
ab5tract | ooof, now i grok you properly | 19:31 | |
19:31
maettu left
|
|||
guifa2 | ab5tract: gist.github.com/alabamenhu/81eecb7...cd437f80a9 | 19:32 | |
If you go "use Carp" you'll see that even though the confess symbol wasn't imported, you still get the output of the 'say' in the same block. I'm sure that there's a reason for it, but it's unexpected | |||
19:34
rypervenche joined
|
|||
lizmat | github.com/rakudo/rakudo/pull/3424 # xinming | 19:37 | |
guifa2 . o O ( plus I'm sure that using named parameters the way I'm trying to is a total abuse of the way the export system was designed ) | 19:40 | ||
ab5tract | guifa2 what happens if you wrap the &confess in a block? | 19:43 | |
i don't know if this is the output i'm supposed to get (haven't used confess in ages) but.. | 19:44 | ||
$ perl6 -Ilib -e 'use Carp :confess; confess(die "obviously")'didn't call ofunobviously in block <unit> at -e line 1 | |||
19:44
wamba joined
|
|||
ab5tract | ah, the new lines didn't translate | 19:44 | |
so it seems that this change might do the trick? | 19:45 | ||
my package EXPORT::DEFAULT { OUR::{'&carp'} := { &carp(@_) } } | |||
guifa2 | ab5tract: notice that it said "didn't call ofun" (but you didn't say use Carp :confess, :ofun) | ||
ab5tract | egads | 19:46 | |
guifa2 | hmm I'll try that out later and see if it works. Worst case scenario I can just add the options in later for a future version. | ||
ab5tract | guifa2 well it stopped complaining about not having a confess in the namespace | 19:47 | |
but i'm not sure it was actually confessing :( | |||
and indeed the didnt call ofun was triggering | |||
i think this export logic might deserve some revisiting | 19:48 | ||
every time i touch it i feel like it doesn't exactly map to how i would expect a Raku solution to order itself | |||
which would make since if it since it would have been one of the earliest and most bedrock functionalities to get into place before further work | 19:49 | ||
*which would make sense | |||
guifa2 | I think 95% of it works fairly straightforwardly | 19:50 | |
ab5tract | *which would make sense since (: | ||
guifa2 | The other 5% is tricky, but it's also for people trying to do weird things, so it's not tooooo evil | ||
ab5tract | the general use case of specifying is export(:tag) does work quit well | 19:51 | |
guifa2 | In other cases, where you want to enable loooots of options, it's almost easier to export subs for it | 19:52 | |
set-foo-option(crazy arguments) | |||
ab5tract | ah, that's a thought | ||
but here's the thing | 19:54 | ||
i feel like i encounter this weirdness whenever i want to enable a default behavior while providing extensibility | 19:55 | ||
that sounds like the kind of corner i don't expect to encounter in a perly world | |||
19:57
mahmudov joined
|
|||
guifa2 | OTOH I suppose I could make my life easy, and just export all four (the default in Perl5 was to export three of the four), and have use Carp <optionA optionB>; | 19:57 | |
ab5tract | i mean, if a camel wants to carp, you think they aren't gonna confess to wanting a block until they've had all their ofun? | 20:00 | |
i don't properly remember the four exports of carp, i just riffed on the exports in your gist :) | 20:01 | ||
HollisterSmiley | "i mean, if a camel wants to carp, you think they aren't gonna confess to wanting a block until they've had all their ofun?" Imagine saying that to the guys at starbucks. they call the police on you for vrazy talk :-D | 20:02 | |
20:04
guifa2 left
|
|||
ab5tract | i'll be carping about my camel confession rights till i die!! :') | 20:04 | |
HollisterSmiley | or maybe they'd just think you work in marketing | 20:05 | |
guifa | hahaha | 20:06 | |
ab5tract | 2020 the return of the camel.. now with butterfly wings! | ||
guifa | Oh and crap I messed up my names in that gist anyways | 20:07 | |
basically, carp = warn (but from caller side), cluck = carp + backtrace, croak = die (but from caller side), confess = croak + backtrace | 20:08 | ||
Grinnz | I'd say you should get away from our weird Perl names while you can, but you'd have to come up with something better ;) | 20:09 | |
20:09
cpan-raku left
|
|||
ab5tract | Grinnz lol | 20:09 | |
20:09
xinming left
|
|||
guifa | Grinnz: the whole reason for the :ofun opion was to have a frog emoji with a thought bubble saying the croak message, a fish emoji with a thought bubble saying the carp message, etc ;-) | 20:09 | |
ab5tract | hahahahaha | 20:10 | |
20:10
cpan-raku joined,
cpan-raku left,
cpan-raku joined
|
|||
ab5tract | now i can get behind that kind of ofun@ | 20:10 | |
! | |||
20:11
xinming joined,
sena_kun joined
|
|||
guifa | croak “I’m a frog” | 20:11 | |
🐸 . o O ( I’m a frog ) in block <unit> at foo.raku line 1 | |||
Grinnz | 🐸🐟🐔🙏 | ||
20:12
Altai-man_ left
20:18
mahmudov left
|
|||
HollisterSmiley | m: my \🐟 = 1; | 20:20 | |
camelia | 5===SORRY!5=== Error while compiling <tmp> Malformed my at <tmp>:1 ------> 3my7⏏5 \🐟 = 1; |
||
HollisterSmiley | m: my \_🐟 = 1; | ||
camelia | 5===SORRY!5=== Error while compiling <tmp> Term definition requires an initializer at <tmp>:1 ------> 3my \_7⏏5🐟 = 1; |
||
HollisterSmiley | m: my \A🐟 = 1; | 20:21 | |
camelia | 5===SORRY!5=== Error while compiling <tmp> Term definition requires an initializer at <tmp>:1 ------> 3my \A7⏏5🐟 = 1; |
||
HollisterSmiley | m: my \A🐟 := 1; | ||
camelia | 5===SORRY!5=== Error while compiling <tmp> Term definition requires an initializer at <tmp>:1 ------> 3my \A7⏏5🐟 := 1; |
||
20:21
mahmudov joined
|
|||
HollisterSmiley | m: sub 🐟 { 1; } | 20:22 | |
camelia | 5===SORRY!5=== Error while compiling <tmp> Missing block at <tmp>:1 ------> 3sub7⏏5 🐟 { 1; } expecting any of: new name to be defined |
||
HollisterSmiley | too bad | ||
m: sub postfix<🐟>($fish) { 1; } | 20:24 | ||
camelia | 5===SORRY!5=== Error while compiling <tmp> Missing block at <tmp>:1 ------> 3sub postfix7⏏5<🐟>($fish) { 1; } expecting any of: new name to be defined |
||
HollisterSmiley | m: sub postfix:<🐟>($fish) { 1; } | ||
camelia | ( no output ) | ||
HollisterSmiley | m: sub postfix:<🐟>($fish) { 🐟 x $fish; }; say 8🐟 | 20:26 | |
camelia | 5===SORRY!5=== Error while compiling <tmp> Bogus statement at <tmp>:1 ------> 3sub postfix:<🐟>($fish) {7⏏5 🐟 x $fish; }; say 8🐟 expecting any of: prefix term |
||
HollisterSmiley | m: sub postfix:<🐟>($fish) { '🐟' x $fish; }; say 8🐟 | ||
camelia | 🐟🐟🐟🐟🐟🐟🐟🐟 | ||
HollisterSmiley | hihi | ||
20:26
ryan88 joined
|
|||
HollisterSmiley | this language is amazing | 20:26 | |
ryan88 | The docs say `==` is the Numeric equality operator, but it seems to work fine for Bool... should I use == or ~~ for Bool? | 20:27 | |
HollisterSmiley | None of the above. It's bool | 20:28 | |
ryan88 | oh... shoot.. what am I thinking smh | ||
HollisterSmiley | m: sub foo { True }; say "this is a code smell" if f() ~~ True | 20:29 | |
camelia | 5===SORRY!5=== Undeclared routine: f used at line 1 Other potential difficulties: Smartmatch against True always matches; if you mean to test the topic for truthiness, use :so or *.so or ?* instead at <tmp>:1 ------>… |
||
HollisterSmiley | m: sub foo { True }; say "this is a code smell" if foo() ~~ True | ||
camelia | Potential difficulties: Smartmatch against True always matches; if you mean to test the topic for truthiness, use :so or *.so or ?* instead at <tmp>:1 ------> 3 say "this is a code smell" if foo() ~~ 7⏏5True this is a code sm… |
||
HollisterSmiley | m: sub foo { True }; say "this is a code smell" if foo() == True | ||
camelia | this is a code smell | ||
20:31
wamba left
|
|||
tobs | what does the hint mean by "use :so [...] instead"? | 20:33 | |
m: temp $_ = False; say :so | |||
camelia | Unexpected named argument 'so' passed in block <unit> at <tmp> line 1 |
||
tobs | m: say False:so | 20:34 | |
camelia | 5===SORRY!5=== Error while compiling <tmp> Invalid type smiley 'so' used in type name at <tmp>:1 ------> 3say False:so7⏏5<EOL> expecting any of: pair value |
||
tobs | m: temp $_ = False; say "true" if :so | ||
camelia | true | ||
[Coke] | *.so, not :so | 20:36 | |
m: sub foo { True }; say "this is a code smell" if foo().so | |||
camelia | this is a code smell | ||
tobs | [Coke]: it lists :so and *.so | 20:37 | |
so I doubt :so was a typo | |||
ab5tract | m: temp $_ = False; say "true" if .so | 20:38 | |
camelia | ( no output ) | ||
ab5tract | tobs is that in the docs somewhere? | 20:39 | |
[Coke] | tobs - oops, so it does. | 20:40 | |
apologies. | |||
ab5tract | i believe that it isn't a typo, just wondering where that behavior is coming from | ||
tobs | ab5tract: a method call without invocant applies to the topic $_. It's in the docs for sure, but I haven't found it yet | ||
ab5tract | :so isn't a method call itself | 20:41 | |
if it causes a method call, it would be something like self.self(:so) | |||
m: say Any:so; | |||
camelia | 5===SORRY!5=== Error while compiling <tmp> Invalid type smiley 'so' used in type name at <tmp>:1 ------> 3say Any:so7⏏5; expecting any of: pair value |
||
ab5tract | m: temp $_ = Any; say :so; | 20:42 | |
camelia | Unexpected named argument 'so' passed in block <unit> at <tmp> line 1 |
||
tobs | ab5tract: there's a mention in the OOP tutorial: docs.raku.org/language/classtut#in...ry-methods | ||
ab5tract | m: temp $_ = Any; say "true" if :so; | ||
camelia | true | ||
ab5tract | m: temp $_ = Any; say "true" if .so; | ||
camelia | ( no output ) | ||
ab5tract | there it is | ||
looks like an unwired dispatch error | 20:43 | ||
:so and .so should have the same output | |||
jnthn ^^ does that parse to you? | 20:44 | ||
m: temp $_ = Any; say "true" if :so; say "true" if .so; | |||
camelia | true | ||
20:44
libertas left
20:45
wamba joined
|
|||
ab5tract | or lizmat or other second eyes? | 20:45 | |
tobs from my standpoint you should feel confident reporting that as a bug on github | 20:46 | ||
lizmat | I'm surprised "if :so" even parses | ||
tobs | that warning was introduced in 2010 apparently and there's a sibling warning that mentions :!so, so it really seems like it's intended as an adverb | ||
will bug if you don't mind | 20:47 | ||
↑ R#3425 | 20:56 | ||
21:05
melezhik joined
21:06
rindolf left
21:11
mahmudov left
21:12
squashable6 left
21:13
squashable6 joined
21:19
pmurias joined
|
|||
Kaiepi | greppable6, Parameter.new | 21:21 | |
greppable6 | Kaiepi, 25 lines, 6 modules: gist.github.com/63cf57c63ad18c7b62...fe2bc21cb2 | 21:22 | |
21:32
libertas joined
|
|||
lucasb | IIUC, '$foo ~~ :bar' is equivalent to ?($foo.bar), and '$foo ~~ :!bar' equivalent to !($foo.bar) | 21:33 | |
I expect it to work with ~~ and given/when as it does. I *don't* expect it to work if "if :so" (meaning to call $_.so) | 21:34 | ||
21:35
libertas_ joined
|
|||
lucasb | 'if :foo {...}' is ok. It's just checking the truthiness of a Pair object, which is always true. | 21:35 | |
ab5tract | lucasb interesting boundary distinction! mind sharing on the ticket? | 21:40 | |
github.com/rakudo/rakudo/issues/3425 | |||
21:41
llfourn joined
|
|||
lizmat | fwiw, I find that syntax *very* confusing | 21:42 | |
I know it was intended to be used on IO::Path objects | |||
so you could say "filename".IO ~~ :r | 21:43 | ||
but yuck | |||
ab5tract | lizmat if i read lucasb's examples correctly, it looks more like this is sugar around truthifying the results of a method call in list format? | 21:44 | |
AlexDaniel | lizmat: I know that it exists but I never used it | ||
just doing .r on IO is clearer | |||
lizmat | well, for a long time I've not known about it, and I never used it | ||
feels to me this feature falls in the "overengineered" section :-) | 21:45 | ||
ab5tract | lizmat where in the git org do we pour these things now? :) | ||
lizmat | perl6/problem-solving I think ? | 21:46 | |
AlexDaniel | ab5tract: bugs github.com/rakudo/rakudo/issues ; requests to change the language github.com/Raku/problem-solving/is...new/choose | ||
ab5tract | AlexDaniel awesome work with that issues path chooser!! | 21:47 | |
in the requests to change link. i really like the way it invites critique and discussion | 21:48 | ||
AlexDaniel | actually, I think we should be able to force different order there | 21:50 | |
maybe by simply adding numbers like “1. ” to template titles | |||
ab5tract | that should work | 21:53 | |
regardless, your attention to detail is appreciated AlexDaniel :) | 21:55 | ||
AlexDaniel | ah no, then the number will appear in all kinds of places :S | 21:56 | |
ab5tract | yuk | ||
22:09
Altai-man_ joined
22:12
sena_kun left
|
|||
cpan-raku | New module released to CPAN! ScaleVec (0.0.6) by 03SAMGWISE | 22:13 | |
22:17
llfourn left
|
|||
guifa | HollisterSmi: you can do it, but you have to make 🐟 a term first | 22:28 | |
ab5tract | guifa in fact, you can take an entire unicode category and dynamically create a sub term:<T> { T } | 22:39 | |
guifa in fact, you can take an entire unicode category and dynamically create a sub term:<T> { "T" } | |||
for all animals, for instance | 22:40 | ||
22:40
guifa2 joined
|
|||
ab5tract | or in this case, sub postfix:<T>(Int $n) { "T" xx 8 } | 22:40 | |
erg, sorry, calling my own get out tonight. much love to all, as always! <3 #raku | 22:42 | ||
22:42
ab5tract left
22:46
ryan88 left,
chloekek left
22:56
NODE left
|
|||
guifa2 | what's the best way to prevent the REPL from returning a value off of a sub (for when it makes no sense)? | 22:58 | |
22:58
NODE joined
23:00
NODE left
|
|||
[Coke] | It's always going to get the value, even if the value is Nil | 23:00 | |
you could add "; True" to your input | |||
guifa2 | Ah okay | 23:01 | |
I won't consider it a bug in my module then :-) | |||
23:01
NODE joined
23:03
NODE left
23:04
NODE joined
|
|||
cpan-raku | New module released to CPAN! Date::Names (2.0.4) by 03TBROWDER | 23:06 | |
23:21
guifa2 left
|
|||
kybr | is there a way to open a .gz transparently like vim does? | 23:23 | |
sjn | using what? | ||
less? cat? LibreOffice? | 23:25 | ||
kybr | for 'huge-csv.gz'.IO.lines -> $line { ... } | ||
Xliff | O_o | ||
Um... no | |||
You could write a module to do that, though... | |||
kybr | okay. thanks. | 23:26 | |
Grinnz | i assume the raku equivalent of metacpan.org/pod/PerlIO::via::gzip would look very different | ||
sjn | Maybe a role you could apply to an IO object? | 23:27 | |
sjn makes a guess | |||
Grinnz | the main difficulty is that you can't tell where lines are until it's decompressed | 23:28 | |
so you need something that can gzip/gunzip a stream so as to not read the whole thing at once | 23:29 | ||
sjn | Or, if you accept how vim does it, just temporarily uncompress the file and iterate over that one | ||
I see github.com/retupmoca/P6-Compress-Zlib has some functionality to extend filehandles. Maybe it can work in IO objects too? | 23:31 | ||
Grinnz | that layer just uses metacpan.org/pod/IO::Uncompress::Gunzip#getline which handles those details | 23:32 | |
sjn | ah | ||
Grinnz | that module is also higher level than Compress::Zlib which this looks like an equivalent to | 23:33 | |
i try not to look at metacpan.org/pod/Compress::Raw::Zlib any more than i have to 😬 | 23:34 | ||
sjn | Hm. Sure? Code says it uses Compress::Zlib::Raw, which is a NativeCall wrapper around zlib.so | ||
Don't know the code though, so I might be missing something | 23:35 | ||
Grinnz | there's also a subtle difference between raw zlib compression and gzip compression | ||
lizmat | we need a module that creates a Supply out of a gzipped file, then you could run .lines on the Supply | 23:41 | |
the supply would get fed with anything the next batch of decompressed data | |||
23:47
guifa2 joined
23:48
wamba left
|