🦋 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.
summerisle i have poked around the nativecall source, and i'm no nqp expert but it does appear that there is only one instance of the structure. changes to the structure are reflected both ways. 00:27
guifa:
guifa summerisle: hmm okay. That might work bode well. 00:59
summerisle to give context, i've worked with two different C libraries (libOGG, libFLAC) in raku so far and the behaviour has been more or less the same as if I were to write C. no weird gotchas 01:00
guifa summerisle: I’m thinking of doing yet ANOTHER rewrite of CLDR. But this time instead of creating all of the objects immediately, just import a single blob, and then create objects as needed that reference the big blob. Should drop load time to zero, albeit with some more run time allocations. If I don’t actually need to allocate Raku objects for the attributes except when accessed via their methods, I could probably reduce the memory 01:28
footprint by a lot too
SmokeMachine guifa: I couldn’t watch your talk live, but did it yesterday, and you were right, Red do not use slangs 02:31
guifa: and congratulations! Very good talk! 02:32
summerisle SmokeMachine: where is this talk? 03:05
Froogal Hi!  I'm looking for the documentation about the Raku equivalent of perl's if(-e $file){do blah}? 03:07
summerisle m: '/dev/null'.IO.e.say
camelia True
codesections summerisle: all the fosdem talks from the Raku/Perl devroom are at video.fosdem.org/2021/D.perl/ ; guifa's is the "surprisingly unsurprising" one 03:08
codesections Froogal: and it's documented here/elsewhere on the same page: docs.raku.org/type/IO::Path#File_test_operators 03:10
Froogal codesections Yay!  thanks, I had trouble finding it. 03:11
codesections (that section is a direct link to smartmatching, which is an alternative to the method syntax summerisle showed) 03:11
guifa SmokeMachine: estou a pensar repetir a palestra, mas em português e espanhol para os não anglofalantes :-) 03:27
guifa We had some really great Raku talks this time around 03:41
codesections++ lizmat++
braden337 I'm having a real tough time compiling rakudo(-star) with the jvm or javascript backend (on Debian and macOS), does anyone have any tips? 06:43
jmerelo braden337: I'm not totally sure about the javascript backend. The JVM should be (mostly) up to date. 06:44
braden337: There are still a number of issues with the JVM backend. I'm not sure they're totally solved github.com/rakudo/rakudo/issues/4191 06:45
SmokeMachine .tell guifa acho uma ótima ideia! :) 07:33
tellable6 SmokeMachine, I'll pass your message to guifa
MasterDuke braden337: i just built rakudo (not -star) with the jvm backend on arch linux, what problem were you seeing? 09:03
braden337 I tried again a few times, following the readme and using 2020.12 rakudo (not star), with "ALL" backends it failed during the configure step, with "moar,jvm" it failed during the make step, but if I just choose "jvm", then it builds successfully and I was able to run make install after. So now I have perl6-j in my install/bin directory 09:39
MasterDuke i don't really know anything about javascript so i never use "ALL", but "moar,jvm" worked for me 09:41
CIAvash I don't know about compiling the javascript backend, but the rakudo on npm doesn't work with new versions of node, only works with v12.11.1 09:47
MasterDuke were you using a "-j n (greater than 1)" option for make? the jvm build used to not like that, but i thought it wasn't a problem anymore 09:49
braden337 I wasn't using any options for make, just "perl Configure.pl --backends=moar,jvm --gen-moar --relocatable" and then "make" 09:52
MasterDuke and i assume you can also build just the moarvm backend by itself? 09:54
braden337 That's correct 09:56
MasterDuke odd. any record of what the error was with both? 09:57
braden337 it starts showing a bunch of errors after 10:19
+++ Generatinggen/jvm/SysConfig.nqp
+++ Compilingblib/Perl6/SysConfig.jar
+++ Generatingrakudo-runtime.jar
then it exits with error 1
Note: src/vm/jvm/runtime/org/raku/rakudo/RakudoJavaInterop.java uses or overrides a deprecated API. 10:20
Note: Recompile with -Xlint:deprecation for details.
100 errors
4 warnings
only showing the first 100 errors, of 1071 total; use -Xmaxerrs if you would like to see more
make: *** [rakudo-runtime.jar] Error 1
PimDaniel Hi. 11:14
\o
tyil o/ 11:15
PimDaniel Does anybody know how to add a new element to a Set?
tyil >A Set is an immutable set,
first line on docs.raku.org/type/Set 11:16
you might want to use a SetHash iirc
docs.raku.org/type/SetHash
PimDaniel iirc?
tyil if I recall correctly :)
the Set docs also mention the use of SetHash if you want it to be mutable
PimDaniel Ok thank's tyil, i'll look at SetHash and come back if necessary. ;) 11:17
tyil good luck :D
PimDaniel Thank's! 11:18
lizmat m: my %sh is SetHash = <a b c>; %sh<d> = True; dd %sh; %sh.set: <e f g>; dd %sh 11:19
camelia SetHash.new("a","d","c","b")
SetHash.new("b","f","c","g","e","a","d")
lizmat m: my %sh is SetHash = <a b c>; %sh<d> = True; dd %sh; %sh.set: <e f g>; dd %sh; %sh.unset: < a b c>; dd %sh
camelia SetHash.new("d","c","a","b")
SetHash.new("c","a","d","g","f","b","e")
SetHash.new("d","g","f","e")
Scimon See I'd personally go with creating a new Set using the union operator because mathematically that's how you do it. 12:22
m: my $s = set(1,2,3);dd $s;$s (|)= (4,5,6);dd $s
camelia Set $s = Set.new(2,3,1)
Set $s = Set.new(5,6,4,2,3,1)
codesections Here's something that I feel quite frequently (especially when reading things online), and yet *no* other programming language will let me express: 13:56
m: my $assessment-of-your-argument's-force = True but False; 13:57
camelia ( no output )
PimDaniel \o 14:02
PimDaniel Bonjour! 14:03
Is there an oposite for === infix operator?
Scimon !=== ? 14:03
PimDaniel ha! i did not try this one. 14:04
Scimon codesections : What about the classic 0e0 from the Perl DBI?
Always go for the simple option first ;)
PimDaniel True : it works : thank's, Scimon. At the same time it is logical. I tried !== but it seamed to act like !=. 14:06
Scimon Yeah ! will megate an infix op. So !== is doing an not equal test while !=== is doing an object equality check then negating it. 14:07
!= is a special case that's an alias for !== docs.raku.org/routine/!= 14:09
codesections I didn't know about 0e0 from perl, but that's not quite the same. It's both 0 and True, but it's not both False but also True 14:13
Scimon I know but it always made me giggle.
And of course you can recreate it in Raku with 0 but True which is just awesome. 14:14
codesections my first real programming language was javascript, where the equivalent was: javascriptwtf.com/wtf/javascript-holy-trinity 14:15
PimDaniel Just by curiosity : how would i express an IntStr into a literal hash description Tree? 14:21
m: my %h = %(a => <1 2 3>, b => <4 5 6>); say %h; 14:23
camelia {a => (1 2 3), b => (4 5 6)}
PimDaniel mmm :/ not sure.
So i can see 3 type possible with what could even represent a number and 3 literal way to express: "3" <3> and 3. 14:25
Scimon m: my %h = %(a => <1 2 3>, b => <4 5 6>); dd %h;
camelia Hash %h = {:a($(IntStr.new(1, "1"), IntStr.new(2, "2"), IntStr.new(3, "3"))), :b($(IntStr.new(4, "4"), IntStr.new(5, "5"), IntStr.new(6, "6")))}
Scimon You can coerce them to Ints if need be. 14:26
PimDaniel Don't think i MAY do it in my case. I'm converting a part of python code in Raku. 14:27
*a piece
PimDaniel In entry i get an hash and so i think data should remain as is : "3" is not 3 is not <3>. 14:28
Scimon But it is "3" is an IntStr the 3 in the output is because of the gist called by say. 14:29
If you look at the dd output you can see you've still got IntStr's
PimDaniel Hum Ok Scimon. 14:30
Scimon (Ok <> gives the IntStr and "" gives a Str... because.. yay?)
I wouldn't worry about it personally.
PimDaniel In fact the question if i must coherce or not is not so simple. 14:31
I must look at what the code does and how it does it.
Phyton des not even type nothing like raku and i wonder why thez set a set is immutable since you can run a put method into a loop on it. :( 14:34
PimDaniel So i must reread all the code and restart from scratch. 14:35
Thank you!
codesections how do I convert a Str to a str ? I'm pretty sure I used to know... 14:53
moritz my str $x = $TheStr; 14:54
codesections moritz++
moritz or nqp::unbox_s if you are into low-level shit 14:55
codesections oh, of course I should have checked the NQP ops 14:56
guifa codesections: what are you doing that needs a str 15:03
tellable6 2021-02-18T07:33:34Z #raku <SmokeMachine> guifa acho uma ótima ideia! :)
codesections guifa: working on github.com/rakudo/rakudo/pull/4201 15:05
and trying not to slow down Raku's start time :)
codesections random unrelated question: where does the Str.ords name come from? I'm having a hard time getting that from "Unicode codepoints". It sounds like "ordinal", but I think I'm missing something 15:35
leont Yeah, it does 15:36
codesections haha, I just came across a comment in Roast that was talking about the Synopses but, due to a typo, called them "the original speculation" (I assume they meant "specification"). 16:01
in retrospect, that seems about right :D 16:02
Froogal Hi!  I'm having trouble finding out how to pass arguments to a class constructor.  I'm used to PHP, there doesn't seem to lot of documentation regarding this, just how to make an initial class or module. 16:03
codesections Froogal: In general/by default, you pass named arguments to the constructor with the :name(value) syntax. 16:05
I'll send you a link in a second 16:06
Froogal with a colon?
Ok :)
I don't really understand the colon in Raku either, it seems to be pretty prevalent.
codesections See the `class Point` example here docs.raku.org/language/objects#Obj...nstruction 16:08
m: say key => 'val'; say :key('val2');
camelia Unexpected named argument 'key' passed
in block <unit> at <tmp> line 1
lizmat codesections: i believe .ord to be a Perlism
because that's what it is called in Perl
codesections m: dd key => 'val'; dd :key('val2'); 16:09
camelia :key("val")
:key("val2")
codesections Froogal: the colon is another way to declare a Pair ^^^
Froogal Wow that's actually a pretty nice syntax lol 16:10
codesections thanks, lizmat (though that just pushes the mystery deeper :D ) 16:11
lizmat from the ASCII only days, ord is short for ordinal number, aka the numeric representation of an ASCII character (chr( 16:12
(chr)
hence, the name of the function the other way
codesections aha! I should have thought to go back to ASCII 16:13
lizmat m: dd 65.chr, "A".ord
camelia "A"
65
lizmat I think it comes with "grep" :-)
codesections right. Which is both Unicode & ASCII
lizmat yup, nowadays :-)
codesections ha. and grep, in turn comes from ed 16:14
lizmat TIL :-) 16:16
codesections from global/regular expression/print; or g/re/p for short 16:17
lizmat and ed is pronounced ee dee TIL another thing :-) 16:21
guifa Froogal, the even cooler colon syntax is
m: my $val = 4; dd :$val
camelia :val(4)
guifa It encourages smart naming of variables and parameters to keep cleaner code ^_^
PimDaniel Hi again. 16:24
Is it a good idea to use math glyphs like ∈ ? 16:25
and how do you write them? if so?
lizmat If you use something like Comma, it's done for you :-) 16:31
PimDaniel: seriously: docs.raku.org/language/unicode_entry 16:32
Froogal guifa what does that do?  Like dd as in data dumper?  The linux command? 16:35
guifa2 that's what it comes from 16:36
Froogal what is the purpose of the colons there?
PimDaniel Thank's Lizmat!
guifa2 but i was more showing how you can just prefix a regular variable with a colon, and it turns it into a Pair
lizmat actually, I thought of it as Tiny Data Dumper, but so tiny it lost the "t"
Froogal oh a pair
guifa2 m: sub ten-times ( :$number #`[ ← named argument] ) { $number * 10 }; my $number = 5; say ten-times :$number 16:38
camelia 50
guifa2 . o O ( still doesn't understand why we need the backtick. Synopses didn't have it. )
lizmat: any idea why it was made necessary for multiline/embedded comments? 16:39
lizmat guifa2: I have no idea... this is from the time when I was not closely associated with the project 16:40
masak moritz might
codesections guifa: not only do the Synopses not mention using the backtick, I'm pretty sure there's something explicitly about _not_ using in – leaving it as the one ASCII glyph intentionally reserved for users 16:50
guifa2 codesections: I wonder if much would brek if we made the backtick optional. It's not like #[ #( #{ are reserved for anything else. Theoretically iy could break old code but… minimally so I think 16:55
codesections Hmm, I kind of wonder if we might want those combos for something else one day 16:58
maybe something macro/ast related?
or POD/doc comment related?
guifa2 that's the only reason I can think of them ultimately using the backtick 16:59
but TBH
my $foo = #[comment] 5;
looks much nicer than my $foo = #`[comment] 5;
guifa2 still proud though of his opening multiline comment on this script: github.com/alabamenhu/DateTimeTime...abase.raku 17:00
codesections That _is_ a nice use of ;-), I'll admit 17:07
Though I tend to use # on each line for true multi-line comments, and just use #`{...} for inline comments 17:11
guifa2 I don't think I've fully developed a house style for that yet 17:12
Sometimes I do pod blocks (like in the above script, but mainly when it's definitively more narrative) 17:13
codesections (also, it'd never occurred to me that &dd takes named arguments. The number of times I've added an extra text label when I could have just done that...)
guifa2 But I also probably think about code style more than I should 17:15
codesections likewise
guifa2 I guess I want to make sure Raku doesn't end up like Perl with thousands of really poorly written, unreadable bits of code out there
codesections Yeah. I've been thinking about that a lot too (though I haven't come up with any clear ideas yet) 17:16
guifa2 Perl *can* be super readable. But all the script kiddies from back in the day C&P code and wanted to look super 1337 with illegible mess of code (and didn't / couldn't refactor) gave it the horrible reputation it has today 17:17
codesections I was also thinking of it re: JavaScript and NPM and leftpad. It's not even that the code is _bad_ necessarily -- just that there's so much that there's no good way to know 17:18
summerisle guifa2: that, and some people just have bad habits. i inherited some perl scripts (no longer necessary, were for fax automation) from someone who is extremely prominent in the OpenVMS hobby scene and they were just sloppy af
naming variables things they thought were funny, among other strange things 17:19
codesections ...did the fax machines run perl?
summerisle there was a small farm of linux systems with fax modems
guifa2 I just read an article hwere someone was bitching about projects using way too creative names and then when they get big, they're just annoying to use
codesections ah
guifa2 I've tried to be ultra straight forward with naming things in my modules 17:20
tadzik re NPM and leftpad, to be fair just because there's not much code doesn't mean it's any easier to tell which one is not bad :P
summerisle my favorite was naming a mutex "highlander"
guifa2 WTF
summerisle luckily, that was one of very few documented things. the reasoning? "there can only be one!"
tadzik shorter dependency chains help a bit though, but I think they're mostly a symptom of underdeveloped module/package/library scene
summerisle i believe it's a reference to a very old television series
guifa2 summerisle: indeed, I heard the theme in my head when you mentioned it ha 17:21
codesections tadzik: well, to some extent, sure. But having a deeper standard library helps a lot too
guifa2 www.youtube.com/watch?v=SnJt9p-sHho
"there can be only one" at 0:18 17:22
codesections Most js CLI scripts pull in a ton of deps just to parse arguments, for example
(transitive deps, I mean)
summerisle codesections: for sure, but i can't wait till the ecosystem reaches the level of CPAN
codesections Yeah. In my ideal world, we'd have that level of *library* coverage, but each library would use far fewer dependencies (which would each use fewer deps, etc.) 17:24
summerisle absolutely
the situation with js is a total cluster
and it's sort of gotten that way with ruby, but not nearly as bad
codesections And, I mean, I'm torn: On one hand, I _do_ understand the appeal of/argument for small, single purpose libraries 17:26
guifa2 codesections: that's where I do like the idea of CPAN's Tiny modules — no external dependencies
codesections "do one thing and do it well", and all that
guifa2 They might not run as fast, etc, but you know they'll run anywhere Perl runs
codesections guifa2: yeah. And having a decently large stdlib helps with that 17:27
guifa2 I really thought hard about just wrapping ICU's libraries for the Intl:: modules
codesections I wonder if we should expand the number of Core modules/create a new category of blessed modules 17:28
guifa2 But (a) I've learned *so much* by coding it all up in pure Raku, but (b) as long as Raku can run, there's no worry about having to ensure that ICU is available, compiles, etc
codesections e.g., JSON::Fast
guifa2 You know what needs a Fast variant? XML 17:29
lol
guifa2 I think it's a solid half of the compile time for CLDR is spent doing XML mixin operations 17:29
codesections I thought Raku bundled ICU anyway? Am I confused about that?
summerisle I was working with some of the XML modules a month or so ago and found them to be a little weird
though i think that was just my want for better xpath support
guifa2 codesections: I'm fairly certain samcv++ wrote all the string/Unicode stuff separate to ICU, and just uses the Unicode Database 17:30
codesections er, right. ICU ≠ UCD 17:31
too many TLAs
summerisle gotta love em 17:32
samcv guifa2, yes that is correct
codesections yeah, I knew that – I even wrote a blog post about it! – and was just mixed up 17:33
guifa2 And actually, based on my reading of ICU's change log 17:34
I think I'm pretty confident that we're currently handling unit formatting better than ICU so … huzzah
codesections Ohhh, `make spectest` is fetching new tests from upstream -- so _my_ code isn't breaking random, unrelated areas; I just need to rebase to get the code under test! 17:43
Froogal I'm having problems figuring out the class system in Raku.  I have this Module "ModuleFirst::FirstClass.new(:val("hello, world"));  The class has a single variable and a single method.  The method returns that variable, I want it to return the actual value, but it just returns the type. 23:00
codesections That sounds like the variable (attribute?) isn't being set 23:01
Froogal Ah yes attribute, sorry.  I'm setting it with new(:val('hello, world")) am I not? 23:02
codesections Looks that way, if the Class is something like `class FirstClass { has $.val }` 23:03
Froogal yes it word for word it says FirstClass { has Str $.someVal; method getSomeVal() { return $!someVal;} 23:05
well im missing "class" and "is export" in the above message but the rest is accurate. 23:07
I think BUILD() is the key... 23:08
codesections oh, if what you have is ^^^^ it's just that you set val not someVal 23:10
(took me longer than it should have to see that) 23:11
Froogal [code]test[/code] 23:12
What are the code tags here?
codesections (also -- and you may already know this and just be trying out the syntax -- but you don't need to write a geter: $.someVal gives you one for free) 23:13
you can start a line with m: to have it evaluated
(There aren't any tags for multi-line code evaluation) 23:14
Froogal Really???  How cool I didn't know that about the free getter.
I access the getter with :m 23:15
codesections m: class FirstClass { has Str $.someVal }; my $first-class = FirstClass.new(:someVal('hello, world')); say $first-class.someVal; 23:17
camelia hello, world
tonyo m: (class :: {has $.sV}).new(:sV<hello world>).sV.say; 23:57
camelia (hello world)