🦋 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.
codesections m: my %h = %{key => ${inner-key => 'value'}}; say %h<key>.WHAT 00:01
camelia (Hash)
00:01 oneeggeach left
codesections this ^^^ declares a hash-of-hashes. What's the equivalent syntax for declaring a Map of Maps? 00:02
m: my %m is Map = %{key => ${inner-key => 'value'}}; say %m<key>.WHAT
camelia (Hash)
codesections That ^^^ is a Map of Hashes, which is halfway there… 00:03
m: my %m is Map = %{key => Map.new('inner-key', 'value')}; say %m<key>.WHAT 00:07
camelia (Map)
codesections that ^^^^ gets the result I'm looking for, but gives up on having a literal syntax. Is there a way to get the same result with a literal syntax, or do I need to stop being lazy and just call `Map.new()`? 00:08
00:16 patrickz left 00:25 sena_kun joined 00:26 Altai-man_ left 00:28 marcusr left 00:29 marcusr joined
SmokeMachine m: my %m is Map = key => Map.new: { inner-key => “value” }; say %m<key>.^name 00:39
camelia Map
SmokeMachine codesections: ^^
01:29 linkable6 left, evalable6 left 01:31 evalable6 joined, linkable6 joined 01:45 Noisytoot left 02:02 linkable6 left 02:03 linkable6 joined 02:07 squashable6 left 02:08 linkable6 left, squashable6 joined 02:11 rockxloose left, releasable6 left, releasable6 joined 02:12 rockxloose joined
guifa2 codesections: what SmokeMachine said. MAybe you could do my %foo is Map[Map] in the declaration or similar, but I dunno if the literal hash will auto coerce in that case 02:13
02:13 sergot_ left 02:14 sergot joined 02:24 Altai-man_ joined 02:26 sena_kun left 02:31 dataangel left
[Coke] it won't 02:35
IIRC
02:38 gnufr33dom joined
guifa2 that said 02:49
you could always make your own map operator
codesections :D thanks all 02:50
02:55 aborazmeh left
guifa2 oh 02:56
apparently Map can't be parameterized, which kind of makes sense since it's immutable
but how is this? 02:57
m: multi sub circumfix:<;( )> (*@p) { Map.new: |@p }; my %a is Map = ;( b => ;( c => 'd'), e => ;( f => 'g', h => 'i') ); say %a 02:58
camelia Map.new((b => Map.new((c => d)), e => Map.new((f => g, h => i))))
guifa2 codesections: ^^ I tried using <m( )> but the default precedence is off and it reads it first as a method call
codesections That's pretty nifty
02:59 dataangel joined
guifa2 I only thought about that because I actually had my first realworld use of a signature literal 03:00
and that's defined as :( … )
codesections The unhappy cousin of the Type Smiley 03:02
rockxloose The other day NYT had an article from the Go Team explaining their effort to fit 59 million objects within the memory of a 16Gb laptop. The examples given, complicated and simple, can based on that theme or use case; a newspaper's archie from 1800s to now. 03:05
codesections Although, as nifty as that is, I'm realizing (after coming back to this) that I was suffering from a bit of an XY problem: I don't *really* want a Map of Maps – what I really want is to limit the interior mutability of a hash when passing it around. Which…requires a bit more thought/reading
03:05 linkable6 joined
guifa2 codesections: in what way? Asking because I did all sorts of crazy stuff to try to preserve internal mutability of the CLDR database while preventing end-users for touching it 03:08
Actually ended up with a pretty nice solution
codesections well, to take a simple case: if I have something like 03:12
m: my %h = %{outer1 => %{inner1 => 'val'}, outer2 => %{inner => 'other val'} }; say %h; sub fn(%hash) { %hash<outer2> = 'new' }; fn(%h); say %h;
camelia {outer1 => {inner1 => val}, outer2 => {inner => other val}}
{outer1 => {inner1 => val}, outer2 => new}
codesections I'd like to ... not be allowed to do that :)
i.e., to have a way to ensure that the inner hash can't be modified by the function `%h` is passed to 03:13
Without making it fully immutable in the scope it's declared in
(similar to how a scalar variable can't be modified in the function without `is rw`) 03:14
guifa2 github.com/alabamenhu/Intl-CLDR/bl...s/Base.pm6
^^ a bit overkill for what you want, but achieves the same result, jsut a lot of extra stuff I needed
Basically, I made a class that had an internal hash. You can give it the Associative role although it's not strictly necessary 03:16
the { } and < > shorthands called the ASSIGN-KEY, BIND-KEY with = and := respectively, and so you can toss an exception there with a nice warning to not meddle with your internals
(or you could have it not error and just skip the assignment) 03:17
codesections "a nice warning" aka the text «Foo :(» :D 03:18
03:18 skids left
guifa2 haha I've got a big update for that module coming with a more awesome error message 03:19
codesections :D But yeah, that looks like the way to do it if I'm being more serious about it. But, like you said, a bit overkill for what I'm doing. I'm really just trying to get a feel for what Raku provides/what the right mental model for mutability is 03:20
guifa2 oh right 03:22
there was the better messages
github.com/alabamenhu/Intl-CLDR/bl...bility.pm6
but there's a lot of old code in there from when I was playing around with a bunch of different ways 03:23
protip: backtrace checking is a cool idea, doesn't work as well in practice :-)
guifa2 . o O ( I probably need to go beef up Carp) 03:27
codesections (I guess what's really going on is that I'm missing this pattern from Rust, where I can tell that a complex data structure I pass to a function won't be mutated, because I passed it with an & reference and not an `&mut` reference: play.rust-lang.org/?version=stable...e2de14892b
guifa2 That would be a good use of Maps / Lists over Hashes / Arrays. But there's no easy way to quickly protect one and nest it 03:31
Although… I wonder. It might be possible to mix in a role right before sending it
03:32 aborazmeh joined, aborazmeh left, aborazmeh joined
codesections Yeah. The nice thing about the Rust idiom is that you can have something like `let mut foo = …` and then pass `&foo` to a function – and the reference the function gets does *not* allow mutation, even though the variable does 03:32
But ¯\_(ツ)_/¯ managing mutable state is one of Rust's main features, so I shouldn't expect to be able to replicate *everything* in Raku (just, you know, 90% :D) 03:34
guifa2 ooh 03:35
Got it
codesections: how about this? 03:43
bit.ly/31iZeE6
(TIO link)
codesections OOooh, that's really nice 03:45
I almost wonder if that should be built in, maybe with the name `Mappy` (to match `Baggy` and `Mixy`) 03:46
03:46 cpan-raku joined, cpan-raku left, cpan-raku joined
codesections "that" = the Role. As nice as the operator is (and as much as I'd use it!) I'm not sure it should be built in – the burden for new operators is pretty high 03:47
guifa2 That role only really works when shipping out the object. But you would never want to apply in internally, because then you run into the problems that I had with CLDR where you still want to be able to manipulate it. 03:49
codesections Yeah, fair point. But it doesn't become *harder* to manipulate than a Map 03:51
guifa2 For internal stuff, you could even add a SECRET-ASSIGN-KEY method that does what you really want, and create a postcircumfix like < >! and { }! that allow them to actually be done. 03:56
But definitely appropriate for module space
codesections yeah, agreed 03:58
guifa2 remind me never to touch old C programs again. The spaghetti code used to handle 15023234023 different configurations is mindboggling 04:02
codesections Wait, are we overthinking this? 04:05
m: sub foo(%h) { say %h; %h<a> = 5 }; my %x1 = :1a, :2b, :3c; foo %x1.Map
camelia Map.new((a => 1, b => 2, c => 3))
Cannot change key 'a' in an immutable Map
in sub foo at <tmp> line 1
in block <unit> at <tmp> line 1
codesections doesn't that do the same thing as your `Can'tTouchThis` Role, guifa2?
guifa2 .Map will only apply to the outer 04:06
And not the inner
codesections yeah. But I guess you could deepmap the Map?
guifa2 oof
I feel like applying a role is easier at that point :-)
codesections haha, fair 04:07
guifa2 I'm really annoyed that core took the "timezone" attribute as an alias for gmt-offset
greppable6: .timezone 04:08
greppable6 guifa2, 1562 lines, 54 modules: gist.github.com/904c0f92e0e0d85319...5a7ef3dd81
guifa2 yikes, that's a lot of them 04:09
ooh I know, I could make the named parameter accept both Str and Int 04:10
that'd be backwards compatible for construction at least
codesections that sounds good
guifa2 Whateveer I end up with I'm sure I'll tweak it 04:13
04:23 aborazmeh left 04:28 Kaeipi left, Kaeipi joined 05:10 lucasb left 05:22 xelxebar_ left 05:23 xelxebar joined 05:25 sena_kun joined 05:26 Altai-man_ left 05:44 bocaneri joined 05:59 leont joined 06:16 samcv left, aluaces joined 06:46 ambs left 06:53 JJMerelo joined 06:54 sjm_uk joined 06:55 samcv joined 06:59 ambs joined 07:09 ab5tract joined 07:17 kensanata joined
Geth_ doc: beb441ce45 | (JJ Merelo)++ | doc/Type/Iterator.pod6
Shows ambiguous behavior of IterationEnd, closes #3147
07:22
linkable6 Link: docs.raku.org/type/Iterator
doc: 6de783d005 | (JJ Merelo)++ | doc/Language/traps.pod6
Documenting LEAVE trap, closes #3148
linkable6 DOC#3147 [closed]: github.com/Raku/doc/issues/3147 [trap] silence of IterationEnd failures
Link: docs.raku.org/language/traps
linkable6 DOC#3148 [closed]: github.com/Raku/doc/issues/3148 [trap] LEAVE block skipped when die is called
07:32 dakkar joined 07:39 rindolf joined 07:45 phogg left, phogg joined, phogg left, phogg joined 07:54 domidumont joined 07:57 ab5tract left, ab5tract joined
Geth_ doc: acfbf324ec | (JJ Merelo)++ | doc/Language/objects.pod6
Adds documentation for object equality

It's actually another example of the documentation already in the eqv description. Anyway, closes #2004
07:57
linkable6 Link: docs.raku.org/language/objects
linkable6 DOC#2004 [closed]: github.com/Raku/doc/issues/2004 [docs][update] Object Equality Documentation
08:24 Altai-man_ joined 08:26 sena_kun left
Geth_ doc: 8d8b3014f0 | (JJ Merelo)++ | doc/Type/Collation.pod6
Minor revision of Collation.pod6

This would close #2434 again, although the bulk of the issue was solved already.
08:26
linkable6 Link: docs.raku.org/type/Collation
linkable6 DOC#2434 [closed]: github.com/Raku/doc/issues/2434 [docs] LTA placement of collation docs
08:26 andinus left 08:28 BuildTheRobots left, BuildTheRobots joined, BuildTheRobots left, BuildTheRobots joined 08:29 manj-gnome_ joined, manj-gnome_ left 08:30 dominix joined
dominix hi everyone 08:30
Altai-man_ o/
dominix I would like to know what platform is raku ported to ? 08:31
is there a list ?
08:32 bocaneri left 08:33 andrzejku joined
dominix I know most linux distro are able to compile rakudo, win and mac, but what about *bsd ? and other OS like QNX 08:33
08:33 bocaneri joined 08:34 bocaneri left 08:35 bocaneri joined 08:36 Sgeo left
Altai-man_ dominix, some people are using BSD here, so there is a nice chance of it to work, not sure about QNX though. 08:36
dominix can I stand that platform that run JVM are supported ? (I guess no) 08:38
Altai-man_ dominix, build.opensuse.org/project/monitor...rakudo-git <- here is the matrix of recent Rakudo builds, it includes ARM, PowerPC, s390x.
dominix nice
08:39 bocaneri left, bocaneri joined
dominix however, some can't run nqp, so it may not be usable ... 08:40
Altai-man_ dominix, re JVM - it won't be oe too much help for you unless you intent to develop it. 08:41
s/oe/of/
dominix Altai-man_ u right 08:44
we have a personnal project, some coworker would like to use another language just because it supported on lot's of platform
08:44 dominix left 08:46 dominix joined
dominix I am willing to list all platform that can run raku programs, so they may be willing to use raku 08:47
Altai-man_ Sadly, I don't think it is ensured right now. More so, JIT does not work on ARM, so you can expect performance issues there, for example. 08:51
dominix i guess I can not stand that perl5 support help for raku as well
Altai-man_ So "a lot of platforms" is not the selling point for Raku. E.g. Java would be more solid choice. 08:52
dominix anyway, it may end ups in a docker or K8 container platform 08:53
moon-child random idea for anyone working on raku: case insensitivity for typo detection. E.g. 1.what should suggest 1.WHAT, instead of the completely useless Rat and flat 09:01
Altai-man_ moon-child, the problem with WHAT is that it is a compiler hook, not a real "method", so if you want nice type detection, use officially supported `^name`. :) 09:02
m: say 1.^name;
camelia Int
Altai-man_ m: say 1.^namE;
camelia No such method 'namE' for invocant of type
'Perl6::Metamodel::ClassHOW'. Did you mean 'name'?
in block <unit> at <tmp> line 1
moon-child m: say 1.flat; say 1.FLAT 09:04
camelia (1)
No such method 'FLAT' for invocant of type 'Int'
in block <unit> at <tmp> line 1
moon-child Altai-man_: looks like in that example it's just doing fuzzy match and noticing namE is one character off from name. I think it should just be case-insensitive
Altai-man_ m: say 1.^NAME; 09:05
camelia No such method 'NAME' for invocant of type 'Perl6::Metamodel::ClassHOW'
in block <unit> at <tmp> line 1
Altai-man_ Hmm, it apparently stops working after certain difference threshold, you are right.
09:10 dominix left 09:54 Noisytoot joined
cpan-raku New module released to CPAN! Abbreviations (0.0.1) by 03TBROWDER 09:57
10:10 andinus joined
tbrowder .tell Thundergnat thanks for auto-abbreviate on rosettacode.org 10:23
tellable6 tbrowder, I'll pass your message to thundergnat
tbrowder g'day raku ppl 10:35
anyone know who manages the m: REPL here? 10:37
m: use JSON::Fast; 10:38
camelia 5===SORRY!5=== Error while compiling <tmp>
Could not find JSON::Fast in:
inst#/home/camelia/.raku
inst#/home/camelia/rakudo-m-inst-2/share/perl6/site
inst#/home/camelia/rakudo-m-inst-2/share/perl6/vendor
inst#/home/cameli…
tbrowder it would be very useful to get modules installed for use here. then i/we could advertise our handiwork 10:40
who knows what "perls" are hiding in the bulrushes!
10:50 Altai-man_ left, sena_kun joined 10:51 markoong joined
Geth_ doc: e7ce74e555 | (Tom Browder)++ (committed using GitHub Web editor) | doc/Type/Signature.pod6
Add example of parameter multiple type constraint

Satisfies doc issue #3548.
10:55
linkable6 Link: docs.raku.org/type/Signature
linkable6 DOC#3548 [open]: github.com/Raku/doc/issues/3548 [docs] Need example and words on constraint of an arg in a sub parameter to one of multiple types
10:59 cpan-raku left 11:06 cpan-raku joined, cpan-raku left, cpan-raku joined 11:12 smash left 11:13 Altai-man_ joined, JJMerelo left 11:15 sena_kun left 11:16 dakkar left 11:37 Black_Ribbon left, Black_Ribbon joined 11:42 rcyu joined 12:13 Celelibi left 12:17 dolmen joined 12:21 aborazmeh joined, aborazmeh left, aborazmeh joined 12:22 Black_Ribbon left 12:25 rcyu left 12:57 _jrjsmrtn joined 12:59 __jrjsmrtn__ left
codesections Lists and Maps are both immutable data types. However, they seem to mean somewhat different things by "immutable". Compare: 13:02
13:03 dolmen left
codesections m: my $l List.new(1,2,3); $l[1] = 42; 13:04
camelia 5===SORRY!5=== Error while compiling <tmp>
Two terms in a row
at <tmp>:1
------> 3my $l7⏏5 List.new(1,2,3); $l[1] = 42;
expecting any of:
infix
infix stopper
statement end
statement modifie…
13:04 finanalyst joined
codesections er, wait, never mind. I think I'm just getting tripped up by sigils again… 13:05
finanalyst hi. I'm looking at Pod::Block::Declarator. The raku compiler seems to deliver these for sub/method, but not variables. Comma picks up #| comments for variables. 13:07
Where to ask about this?
codesections github.com/rakudo/rakudo/issues/3804 13:08
It's Not Yet Implemented™ but Declarator blocks *should* eventually be applicable to variables 13:09
13:13 dolmen joined 13:16 aborazmeh left 13:19 andrzejku left
codesections Today in «Codesections attempts to understand Raku's semantics for nested Maps»: 13:41
m: my %m := Map.new(%{outer => Map.new(%{ :0inner})}); say %m.WHAT; say %m<outer>.WHAT; say %m<outer><inner>.WHAT; %m<outer><inner> += 1; say %m
camelia (Map)
(Map)
(Int)
Map.new((outer => Map.new((inner => 1))))
codesections That ^^^ describes itself as a Map (%m) containing a Map (outer) which contains Ints. And so each layer should be immutable 13:42
Yet the inner value gets mutated without an error. 13:43
What am I misisng? 13:44
*missing
13:50 squashable6 left
finanalyst @codesections: Thanks. That's the response I was looking for. 13:50
codesections Glad I could help :) 13:51
finanalyst @codesections: You quoted and AST in the above issue. Did you generated the whole AST tree and cut/paste the bit you needed, or is there a more precise way to get the bit you need? 13:52
13:52 squashable6 joined
codesections No, that was the whole AST for that minimal example 13:53
(I actually don't know QAST/Rakudo internals well enough to be confident that I would have copied the right bit, if I'd copied some) 13:54
14:08 domidumont left 14:12 patrickb joined 14:13 Noisytoot left 14:14 Noisytoot joined, sena_kun joined 14:16 Altai-man_ left
ab5tract So I'm curious whether we (that is, Raku) has collected examples where `Rational` vs `Float` makes a significant difference in an otherwise harmless looking bit of math? 14:18
tellable6 2020-08-03T08:35:02Z #raku <JJMerelo> ab5tract how are you doing with your article?
2020-08-04T08:20:23Z #raku-dev <JJMerelo> ab5tract how's your article for the 20th anniversary going?
ab5tract (working on it ;) ) 14:19
I've just had a hell of a time arguing the utility of rationals to a bunch of computer science minded folks :/
codesections Wow. I would have thought anyone who'd spent time in the debugging trenches wouldn't take much convincing! 14:22
jast well, for one thing, doing financial stuff in floating point is a big no no 14:26
14:30 wamba joined
ab5tract jast, yup. My argument is that finance is the one place where the numbers are most scrutinized. Therefore we should take a great deal more heed at the fact that we use a form of representation for "regular" calculations that we find unusable "when it counts" 14:31
14:32 |Sno| left 14:34 sno joined
ab5tract Because to me the argument that "we know FP is fine" isn't really based on any actual data -- the data we _do_ have (whether it works when there is money on the line) does not bode well for FP 14:34
codesections ab5tract, I came across a post that goes into the gymnastics MATLAB does with ranges, all because of floating-point nonsense possiblywrong.wordpress.com/2020/0...for-loops/ 14:37
just saw that the other day, but it seems relevant
ab5tract thanks, I'll have a look! at first glance at your description it definitely sounds relevant :) 14:38
14:42 wamba left 14:55 gnufr33dom left 15:02 Sgeo joined
Altreus It perplexes me that the solution "stop representing floats like that then" wasn't used 15:08
jast I believe Matlab has a single number type only 15:09
and once you have huge matrixes, using arbitrary precision numbers can make a huge difference for performance
codesections Yeah, floats definitely have valid use cases. But so does ASCII. Imo, both should be opt-in 15:10
Altreus I bet it does, but that seems like one of those things that is just ... the case 15:11
jast anyway there's an entire branch of math about making algorithms more resilient to rounding errors
Altreus Solving problems teaches us about numbers! 15:12
jast see e.g. numerical analysis 15:13
Altreus I'm all for theoretical mathematics and problem solving but sometimes problems are solved by not having them :D 15:14
jast some algorithms get extremely expensive if you use arbitrary precision (or even symbolic computation)
so sometimes using floating point and tuned algorithms is your best choice under the circumstances 15:15
Altreus this implies that floating point is computationally better, for reasons other than we've been using them for a long time and have got good at it
codesections Yeah, I don't think anyone is arguing that languages shouldn't *have* floating point numbers 15:16
Altreus Which is a reason I'd be interested in learning about
codesections My only claim is languages should have them but, generally, shouldn't use them as the default
which is also how I feel about ASCII, null-terminated strings, and 8-byte numbers 15:17
s/byte/bit
15:42 skids joined
Altreus Raku has null-terminated strings available? 15:55
sena_kun Altreus, NativeCall? 16:01
codesections That was my assumption too. I just checked the doc page for nativetypes, and it doesn't *say* that NativeCall creates a C-string from a Str. But it must, right? 16:03
Oh, here it is: 16:06
m: my $string = "FOO"; my $c-string = CArray[uint8].new($string.encode.list, 0); say $c-string;
camelia 5===SORRY!5=== Error while compiling <tmp>
Undeclared name:
CArray used at line 1. Did you mean 'Array', 'array'?
Altreus oh yeah that makes sense 16:07
codesections m: use NativeCall; my $string = "FOO"; my $c-string = CArray[uint8].new($string.encode.list, 0); say $c-string;
camelia NativeCall::Types::CArray[uint8].new
Altreus but if we didn't have nativecall would we need C strings?
codesections Probably not? I mean, the advantage of C strings is that they're smaller. But anything that is *that* memory constrained **might** not be the best fit for Raku even before the size of your strings is factored in :D 16:08
How are our strings represented, anyway? 16:09
Altreus I was just trying to gently challenge your assertion that they were as useful as floats in a language :)
codesections hey, I never said they were *as* useful :) 16:10
But they're both things I'm glad to have, but wouldn't want to have as a default
Altreus pretty sure I'd be happy never to see one again :D
16:10 JJMerelo joined
codesections ha 16:10
fair
Altreus mind you, I'm happy at the high level. If I don't know whether it's a float or otherwise, I'm in my zone 16:11
:)
JJMerelo We still need authors for the 20th anniversary calendar github.com/Raku/advent/tree/master/20th
7 slots to go...
codesections I like being able to hop up or down in levels :) 16:12
[Coke] JJMerelo: how many left until you run out? 16:13
JJMerelo [Coke] quite a few indeed. I'm already thinking about writing one to have it as a backup 16:14
I mean, there are 3 written now, so three days to go.
[Coke] eyes raku.org/archive/rfc/28.html 16:17
I imagine that would be a decent one to have, though I don't think I can do it justice. 16:18
... fine, I'll do one.
Geth_ advent: 1188efcb99 | (Will Coleda)++ (committed using GitHub Web editor) | 20th/README.md
Update README.md

claim an article
16:19
16:21 lizmat left 16:24 lizmat joined
[Coke] JJMerelo: I'll try to get this one done before your current supply runs out. 16:26
ab5tract [Coke]++ (and me too) 16:27
[Coke] It might work better as the *last* one, given the nature of the RFC, but I leave it to you to schedule it when it's written.
JJMerelo That would be awesome, thanks [Coke] and ab5tract
16:29 zacts joined
guifa2 bisectable6: (1|2|3).eigenstates 16:52
bisectable6 guifa2, Will bisect the whole range automagically because no endpoints were provided, hang tight
guifa2, More than 4 changes to bisect, please try a narrower range like old=2017.01 new=HEAD 16:53
guifa2, Output on all releases: gist.github.com/060f1207d482ad7415...61a7a0f8a3
guifa2 is 2015 as far back as bisectable goes?
[Coke] guifa2: you mean, the first release? :) 16:56
guifa2 ssssssh
I'm trying to dig into history!
haha
Trying to figure out when the eigenstates method was removed
rypervenche How is it that you can assign something to $/ if you do: $/=get ? That seems odd to me. Is there logic behind this?
guifa2 In 2009 is was still planned for junctions
$/ is just a variable, there's nothing special about it 16:57
rypervenche But one can't assign to it directly. I get: Unsupported use of $/ variable; in Raku please use the filehandle's .nl-in attribute 17:00
17:01 JJMerelo left
guifa2 m: $/ = %( :a<hello>, :b<world> ); say "$<a> $<b>" 17:01
camelia hello world
guifa2 there shouldn't be any problem assigning to $/, can you give a larger sample of what you're trying to do? 17:02
17:02 dolmen left 17:03 dolmen joined
rypervenche Oh, I'm just trying to understand some code golf is all. repl.it/@theangryepicbanana/Indian...#main.raku 17:04
I was mostly just curious why I couldn't assign a string to $/.
guifa2 Oh, that's left over from the P5 -> P6 17:05
guifa2 really feels we can get rid of some of those protecting-yourself-from-yourself errors
In Perl, $/ was the record separator, so the compiler probably assumes if you're assigning a string to it you're trying to use it for that purpose 17:06
m: $/ = 'foo' 17:07
camelia 5===SORRY!5=== Error while compiling <tmp>
Unsupported use of $/ variable; in Raku please use the filehandle's .nl-in attribute
at <tmp>:1
------> 3$/7⏏5 = 'foo'
guifa2 ^^errors but…
m: my $a = 'foo'; $/ = $a; say $/
camelia foo
guifa2 :-)
raku-bridge <theangryepicbanana> (hey that's my code!) 17:08
17:09 skids left
raku-bridge <theangryepicbanana> (the @ in the link pinged me on the discord bridge lol) 17:09
codesections re: protecting-yourself-from-yourself: I'm all for safety, but I do kind of wish there was a "I was never a Perl5 programmer, so I'm not going to make *those* mistakes" mode :)
guifa2 To be honest, even a Perl programmer wouldn't make some of them I don't think. 17:10
The one that gets me is 'y'
try making a sigil-less y and have fun ;-)
codesections On functional programming idiom that's pretty common is to declare a new variable with the same name as an existing immutable variable, thereby shadowing it 17:11
m: my $a = 0; my $a = $a + 1; say $a 17:12
camelia 5===SORRY!5===
Cannot use variable $a in declaration to initialize itself
at <tmp>:1
------> 3my $a = 0; my $a = $7⏏5a + 1; say $a
expecting any of:
term
Other potential difficulties:
Redeclaration of symbol '$a…
codesections however, this is not *supper* easy to do in Raku ^^^
17:13 skids joined
codesections Is that error («Cannot use variable $a in declaration to initialize itself») a design choice, or an inherent limit? 17:13
17:13 Altai-man_ joined
codesections and, in either case, does anyone know why? 17:13
(not a big deal, just curious)
guifa2 codesections: you could probably use temp for that 17:14
m: my $a = 5; { temp $a = $a + 5; say "In the block A is $a"; }; say " but after the block it's $a " 17:15
camelia In the block A is 10
but after the block it's 5
17:15 dogbert11 joined 17:16 sena_kun left
guifa2 you could also use OUTER 17:16
m: my $a = 5; { my $a = OUTER::<$a> + 5; say "inside A is $a }; say " but outside $a" 17:17
camelia 5===SORRY!5=== Error while compiling <tmp>
Two terms in a row
at <tmp>:1
------> 3 "inside A is $a }; say " but outside $a7⏏5"
expecting any of:
infix
infix stopper
postfix
statement end
guifa2 err
17:17 dogbert17 left
codesections re: temp but not with a bound variable. So it doesn't really let you shadow immutable variables: 17:19
m: my $a := 5; { temp $a = $a + 5; say "In the block A is $a"; }; say $a
camelia Can only use 'temp' on a container
in block <unit> at <tmp> line 1
guifa2 m: my $a = 5; {my $a = OUTER::<$a> + 5; say "Inside is $a" }; say " but outside is $a"
camelia Inside is 10
but outside is 5
codesections interesting/cool :) And that *does* work with bound variables 17:20
tobs m: say for 1..10 # this is the perlism that I am rightfully scolded for the most 17:21
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…
guifa2 And because of OUTERS …
you could even make a prefix :-)
codesections haha
If I took all your advice about creating operators, I'd be programming in a language that isn't Raku anymore 17:22
and it would be wonderful. And take about 30 seconds to load "hello world!" :D
guifa2 I forgot about how to get a symbol's, um, symbol, though 17:23
oh right
although it doesn't work for bound items. weird 17:26
m: sub prefix:<·> (\i) { i.VAR.name}; my $a = 1; my $b := 2; say ·$a; say ·$b 17:27
camelia $a
No such method 'name' for invocant of type 'Int'. Did you mean any of
these: 'base', 'none', 'note', 'take'?
in sub prefix:<·> at <tmp> line 1
in block <unit> at <tmp> line 1
17:28 demostanis joined
codesections Oh, maybe the "use this variable to redefine itself" use case is what `supersede` is (/will be) for 17:30
NYI
guifa2 supersede is more for replacing something wholesale
codesections yeah, true 17:31
demostanis Hello everyone, I've finished the first version of a program called "HubToDate", written in Raku. It is used to fetch automatically pre-defined releases from GitHub repositories using rules. I know the code is uncommented and its structure isn't good and that may restrict future code motifications, which is why I will be changing it for sure in the next few days. But would you guys rate it if I publish it on
GitHub?
17:31 ab5tract left
guifa2 augment is great for adding new stuff, but sometimes you need to just rip out the old and replace, and taht's what supersede is going to be for 17:32
demostanis: I can probably take a look at it later this afternoon
demostanis I need to write a small README 17:33
codesections m: {my $a := 0; our $a := 5; say $a} 17:35
camelia Potential difficulties:
Redeclaration of symbol '$a'.
at <tmp>:1
------> 3{my $a := 0; our $a7⏏5 := 5; say $a}
5
codesections ^^^ slightly hacky 17:36
oh, wait, that doesn't actually work 17:38
m: {my $a := 0; our $a := $a + 5; say $a}
camelia 5===SORRY!5===
Cannot use variable $a in declaration to initialize itself
at <tmp>:1
------> 3{my $a := 0; our $a := $7⏏5a + 5; say $a}
expecting any of:
term
Other potential difficulties:
Redeclaration of symbo…
17:39 kensanata left 17:44 dogbert17 joined 17:46 dogbert11 left
[Coke] m: my $a; our $a; 17:47
camelia Potential difficulties:
Redeclaration of symbol '$a'.
at <tmp>:1
------> 3my $a; our $a7⏏5;
Geth_ advent: alabamenhu++ created pull request #57:
Create RFC233
17:48
guifa2 ^^ my draft for the advent calendar
codesections Well, anyway, I don't actually need to shadow anything. Just curious about why Raku is the way it is (which is also why I'm looking forward to reading these advent posts :) ) 17:50
guifa2 One thing I love about Raku: it's written in (basically) Raku. So when I want to make a brand new DateTime method and mirror how it parses datetimestrings, I can just go in and copy the actual literal regex it uses 17:54
vrurg++ 18:00
18:00 veesh left
demostanis Hereeee: github.com/demostanis/hubtodate 18:01
guifa2
guifa2 demostanis: first thing that jumps out at me would be github.com/demostanis/hubtodate/bl...LI.pm6#L11 18:05
idiomatic Raku would say "die 'This program does not work without root.' unless $*USER == 0"
if you still want to log it, I'd have the log function do the "die" 18:06
18:13 veesh joined
guifa2 demostanis: (…get-release(|@($owner, $name)), "$owner-$name") <-- also a little weird. 18:13
In Raku, () don't actually make something a list or array 18:14
It's actually the comma that does that.
so you can do just 18:15
…get-release($owner,$name), "$owner-$name";
most of the internals of your code is fine AFAICT, just little accents from foreign (programming) languages here and there ;-) 18:16
18:19 MasterDuke left
tbrowder any way to keep #raku repl reasonably updated with published modules? 18:21
18:24 mowcat joined 18:27 bocaneri left
codesections m: use Test; say (1 + 1).&is(2) 18:36
camelia ok 1 -
True
codesections tbrowder, I think it'd just be a matter of getting the modules installed in the container/host camelia is running on 18:37
Not sure how to do that. Maybe a PR to the bot, but I don't see where it lives right off
(we can already `use` installed modules, which is what I was checking with the `use Test` test) 18:38
tbrowder thnx 18:45
maybe moritz or AlexDaniel` know 18:46
18:47 andrzejku joined
moritz there's a star target that comes with the R* modules 18:52
star-m: use JSON::Tiny; say to-json { a => [2 => "förn"]} 18:53
camelia { "a" : [ { 2 : "f\u00f6rn" } ] }
18:54 MasterDuke joined
moritz I don't want camelia's build process to get any more complicated; feel free to fork and run your own, I can switch off camelia for that to avoid duplicating the bots 18:54
tbrowder what would be cool is to have new modules announced here by some bot be installed here soon thereafter. just in case the author would like to show it off );-) 18:55
codesections Fork from where? I mean, where does camelia's src live 18:56
tbrowder m: say "see what my new module X can do!!"
camelia see what my new module X can do!! 18:57
tbrowder codesection: i think somewhere in ge
Germany
codesections haha 18:58
tbrowder oh, source? not sure (i was thinking about the server)
moritz codesections: used to be perl6/evalbot on github. No idea if it's been moved to raku/ by now 18:59
codesections yeah, source. Sorry, I thought you were just being funny
Thanks
tbrowder i think i did see it in raku repo a while ago.... 19:01
info in github:Raku/infrastructure-doc 19:03
ok, as moritz said, github:perl6/evalbot... 19:09
19:10 ab5tract joined
tbrowder with all the neat docker stuff around these days that could become dockerized and take requests for module installation... 19:11
moritz if I'd built evalbot today, I'd likely use something dockerish as well 19:12
tbrowder actual host is named in the infrastructure-doc
moritz problem is, if it's supposed to change, someone must actually do it :D
tbrowder yup
moritz and not just implement it once, but also keep it running 19:13
tbrowder that's the kind of thing jj likes to do
19:14 sena_kun joined, perlmonk joined
perlmonk Hi everyone 19:15
tbrowder howdy
perlmonk New to Raku 19:16
19:16 Altai-man_ left
tbrowder welcome! 19:16
perlmonk Looking for a starting point from perl5 background
Thanks tbrowder