»ö« Welcome to Perl 6! | perl6.org/ | evalbot usage: 'p6: say 3;' or /msg camelia p6: ... | irclog: irc.perl6.org or colabti.org/irclogger/irclogger_log/perl6 | UTF-8 is our friend! 🦋
Set by Zoffix on 25 July 2018.
00:03 dolmen left 00:07 Manifest0 left 00:13 Manifest0 joined 00:14 Cabanossi left 00:25 Cabanossi joined 00:26 Manifest0 left 00:31 Manifest0 joined 00:32 farcas82regreg left 00:48 Manifest0 left 00:51 skyte joined 00:53 Manifest0 joined 01:15 Manifest0 left 01:20 Manifest0 joined 01:25 Manifest0 left, vrurg joined 01:30 Manifest0 joined 01:37 skyte left, molaf left 01:38 noisegul_ joined 01:41 noisegul left 01:49 Manifest0 left 01:50 molaf joined 01:55 Manifest0 joined 01:57 noisegul_ is now known as noisegul 02:04 Manifest0 left 02:09 Manifest0 joined 02:13 aborazmeh left 02:14 Manifest0 left 02:18 k-man left 02:20 k-man joined, Manifest0 joined 02:33 Violet_ joined 02:40 Manifest0 left
Kaiepi i'm talking to someone who mainly uses fp about perl 6 and they're wondering why perl 6 doesn't use hindly milner for typing 02:42
02:43 llfourn joined 02:45 Manifest0 joined 02:53 Manifest0 left, Violet_ left 02:59 Manifest0 joined
Kaiepi they hinted that implementing it in dynamic languages wouldn't be perfect, which would mean types' behaviour would be backend-dependent, which i'm guessing is why? idk what to tell him 03:10
03:10 adu joined 03:15 Cabanossi left 03:22 Sgeo left, Sgeo joined, Cabanossi joined 03:23 Manifest0 left 03:28 Manifest0 joined 03:31 molaf left 03:38 Manifest0 left 03:44 Manifest0 joined 03:50 farcas82regreg joined 03:55 molaf joined 03:58 Cabanossi left 04:04 Cabanossi joined 04:34 yht joined 04:46 cpan-p6 left 04:47 cpan-p6 joined, cpan-p6 left, cpan-p6 joined 04:57 abraxxa joined 05:01 abraxxa left 05:02 abraxxa joined 05:09 Manifest0 left 05:14 Manifest0 joined 05:23 Manifest0 left 05:25 adu left 05:27 nadim_ joined 05:29 Manifest0 joined 05:36 Manifest0 left 05:37 jmerelo joined 05:38 domidumont joined 05:40 Manifest0 joined 05:41 sauvin joined
jmerelo releasable6: status 05:54
releasable6 jmerelo, Next release will happen when it's ready. 6 blockers. 258 out of 640 commits logged (⚠ 3 warnings)
jmerelo, Details: gist.github.com/ebac4d6ddb9868ea74...5c0b66dad6
05:59 Manifest0 left 06:00 farcas82regreg left 06:02 [particle]1 left 06:04 Manifest0 joined 06:12 domidumont left 06:22 [particle]1 joined 06:24 Manifest0 left
holyghost m: my @l=1,2; my @l2=3,4; @l <<[]>> @l2; 06:26
camelia 5===SORRY!5=== Error while compiling <tmp>
Missing infix inside HYPER
at <tmp>:1
------> 3my @l=1,2; my @l2=3,4; @l <<[7⏏5]>> @l2;
expecting any of:
bracketed infix
infix
infix stopper
holyghost ^^ I need to index @l in @l2 or vv. 06:28
So return index 1 and 2 in @l2 06:29
06:29 Manifest0 joined
holyghost (or 0,1) 06:30
06:30 domidumont joined 06:38 jmerelo left 06:46 molaf left
timotimo Kaiepi: i would guess not eing able to tell at compile time what a method call will resolve to gives you some amou t of difficulty with that type system 06:47
yoleaux 20 Jun 2019 21:37Z <nadim_> timotimo: hi, if you have 5 min could you point at where this DDT speed demon spends 10 secs to generate 1000 line (dd is 150 times faster), gist.github.com/nkh/f8d41e0748c325...b0f24f142. install the latest
07:18 eseyman left 07:22 eseyman joined 07:23 o_ joined
o_ p6: say 3 07:24
camelia 3
o_ p6: say lick me 07:25
camelia 5===SORRY!5=== Error while compiling <tmp>
Undeclared routines:
lick used at line 1. Did you mean 'pick', 'link'?
me used at line 1
o_ p6: say pick link
camelia Too few positionals passed; expected 2 arguments but got 0
in block <unit> at <tmp> line 1
07:25 o_ left 07:36 Manifest0 left 07:38 molaf joined 07:39 rindolf joined 07:43 Manifest0 joined 07:50 ChoHag left 07:53 Manifest0 left 07:56 dolmen joined 07:58 Manifest0 joined 08:02 Manifest0 left 08:07 Manifest0 joined 08:12 Manifest0 left 08:17 Manifest0 joined 08:25 ravenousmoose_ joined 08:28 ravenousmoose left 08:36 rindolf left, ChoHag joined 08:37 SJM_UK joined 08:49 rindolf joined, Manifest0 left 08:53 cpan-p6 left 08:54 Manifest0 joined 09:01 cpan-p6 joined, cpan-p6 left, cpan-p6 joined, Manifest0 left 09:06 Manifest0 joined 09:21 Guest42753 left, AlexDaniel joined 09:23 Manifest0 left 09:27 Manifest0 joined 09:33 rindolf left
lizmat weekly: www.youtube.com/watch?v=VYjiHU7axUI 09:39
notable6 lizmat, Noted!
09:42 noisegul left 09:51 rindolf joined 09:53 ravenousmoose_ left 10:01 sena_kun joined 10:06 domidumont left 10:08 SJM_UK left 10:09 reach_satori joined 10:18 Wahnberger joined 10:20 farcas82regreg joined
Wahnberger Hello, I have a more general question about performance. I have meanwhile some perl6 stuff for internel use in my company: simple websites mit database connections and a set of crawlers..all shit is running in openbsd vms with a reasonable setup of cpu power and ram. However, compared to my older Vms with Perl the Perl6 stuff is very slow. 10:20
yoleaux 5 Jun 2019 17:06Z <Kaiepi> Wahnberger: did you try passing the html version as 1.1?
Wahnberger yoleaux: wow..:D Yep I did 10:21
So my question is there anything I can do about performance? 10:22
Or I am the only one claiming about performance....then I would need to get back to my code :D 10:23
jast yoleaux is a bot who just replayed that message to you from the person mentioned
generally speaking, from what I know, Perl 6 performance improvements are ongoing - but it's also possible your specific code can be tuned to make things faster, in which case don't ask me because I don't know much about this :) 10:25
jnthn Wahnberger: Certainly Perl 6 performance is an area of ongoing development, though often slowness turns out to be use of a construct that isn't optimized well by the compiler/runtime yet, or a module that isn't optimized well.
For example, a while back I found DBIish was doing some rather inefficient things, dealt with that, and got a bit query performance speedup 10:26
*big
Wahnberger for same querys - is DBIish faster than DB::Pg? 10:28
jnthn I don't know; DB::Pg is better engineered in general, though. 10:29
But I've not done any comparisons on performance.
(The work I did on DBIish was for a project that uses SQLite) 10:30
Wahnberger currently i am using DB::Pg with some cursor to hash querys on just one table with ~ 1600 entrys..it takes sometimes about 10 seconds to load
jnthn And while I do have things using DB::Pg, they just don't do the kind of query throughput that it mattered.
sena_kun I wouldn't say performance is a local issue, looking from our latest survey at docs.google.com/forms/d/e/1FAIpQLS...g/viewform a lot of people want more performance. at the same time, there is progress in this area and some benchmarks seem to be very neat speed-wise. 10:31
jnthn 10 seconds for 1600 entries sounds pretty glacial; there's surely some notable speedup opportunity there 10:32
Also, see if `moar --version` mentions JIT support; I've heard the OpenBSD port they ship it without that 10:35
10:36 dolmen left
Wahnberger yep, i have build several data endpoints by using Cro and psg as the backend..output through Cro is fine..its really the query time :/ 10:37
10:39 reach_satori left
Wahnberger mhm.. i will move the whole thing to a linux box and check it again..and than maybe another check on native hardware 10:39
no mention of JIT support 10:40
jnthn Ah, then it's probably without 10:42
Wahnberger nice survey..it seems perl6 is an old fart language :D
scnr 10:43
jnthn huh, I'd completely missed the survey somehow :)
tadzik are the results in?
10:43 Cabanossi left 10:44 reach_satori joined
sena_kun not yet, we are still collecting... and it would be nice to get more results. :) 10:44
Wahnberger got one more :) 10:46
the are about 150 when i remember correctly 10:47
sena_kun nice. :)
Wahnberger youre right - improving perfomance seems to be major 10:48
10:49 reach_satori left 10:51 natrys joined
Kaiepi Supply.schedule-on($*SCHEDULER).serialize along with Lock/Lock::Async sped up my chat bot's parser quite a bit 10:53
compared to just using a straight Supply 10:54
10:56 molaf left
jnthn Kaiepi: That's just escaping the "sender pays" model, really? 10:58
(Which one can do, but then no back-pressure...) 10:59
Kaiepi wdym 11:01
11:02 reach_satori joined
jnthn Normally, when you emit a value then you pay the costs of processing that value, and so don't get control back to emit another one until that's happened 11:04
If you .schedule-on then you're pushing the processing costs off onto other threads
That means the sender won't pay for it...but a very fast sender could fill up the scheduler queue (and thus memory) 11:05
11:06 yht left
Kaiepi yeah, i was specifically trying to avoid that since certain commands could take up to 30 seconds to complete and it needs to still be able to parse while the command is getting evaluated 11:08
jnthn Yeah, then how you did it will work; just pointing out what you lost along the way :) 11:11
lunch & 11:15
11:18 Black_Ribbon left 11:19 natrys left 11:23 maettu left 11:26 natrys joined 11:33 Wahnberger left 11:36 pecastro joined 11:41 ravenousmoose joined 11:53 Manifest0 left 11:56 dolmen joined, reach_satori left 12:01 Manifest0 joined
woolfy weekly: perlconference.us/tpc-2020-hou/ 12:02
notable6 woolfy, Noted!
12:07 scimon joined, natrys left 12:09 voodooanon joined 12:10 mowcat joined 12:11 domidumont joined
voodooanon p6: say 3; 12:12
camelia 3
Altreus how do I map over @array.kv ? 12:13
12:13 voodooanon left
Altreus m: my @a = 1,2; say @a.kv.map: { $^a * $^b } 12:14
camelia (0 2)
moritz m: for [1, 2, 5].kv -> $k, $v { say "$k: $v" }
camelia 0: 1
1: 2
2: 5
Altreus eh that works, what did I do wrong
12:14 natrys joined
Altreus m: my @a = 1,2; say @a.kv ==> map { $^a * $^b } 12:14
camelia (0 1 1 2)
Too few positionals passed; expected 2 arguments but got 1
in block <unit> at <tmp> line 1
Altreus hrm
that's what I did wrong
12:18 epony left 12:19 ilogger2 joined, ChanServ sets mode: +v ilogger2 12:22 molaf joined
nadim_ m: sub x {dd @_} ; my @a = 1,2; say @a.kv ==> x 12:35
camelia (0 1 1 2)
Array element = [Bool::True]
Altreus what 12:36
Bool::True? 12:37
nadim_ my guess is that piping doesn't put the elements of the pipe in the variable as .kv -> $k, $v does 12:38
12:38 noisegul joined 12:39 maettu joined, Manifest0 joined 12:41 ChoHag joined, pmurias joined 12:43 noisegul left 12:44 dolmen joined, noisegul joined, ChoHag left 12:50 pmurias left 13:01 ChoHag joined
tobs m: sub x {dd @_} ; my @a = 1,2; say @a.kv ==> x() 13:07
camelia (0 1 1 2)
Array element = [Bool::True]
tobs ah, heh 13:08
m: sub x {dd @_} ; my @a = 1,2; say ( @a.kv ==> x )
camelia Array element = [0, 1, 1, 2]
Nil
tobs the feed operator binds very loosely 13:09
m: my @a = 1..4; @a.kv ==> map { $^a * $^b } ==> say() 13:12
camelia (0 2 6 12)
tobs Altreus: ^ the same reason why it didn't work earlier and "too few positionals" were passed
Xliff m: say try require ::("Test") 13:13
yoleaux 20 Jun 2019 09:12Z <jnthn> Xliff: I'm pretty sure I didn't put those there, so no idea; sorry
camelia (Test)
Xliff m: my $a := require ::("Test"); $a.HOW.say
camelia 5===SORRY!5=== Error while compiling <tmp>
Undeclared routine:
require used at line 1
Xliff m: my $a := try require ::("Test"); $a.HOW.say
camelia Perl6::Metamodel::ModuleHOW.new
13:22 vrurg joined 13:23 epony joined 13:24 pamplemousse joined 13:25 dolmen left
Altreus huh 13:28
m: my @a = 1..4; @a.kv ==> map { $^a * $^b } ==> sum() ==> say() # ? 13:29
camelia 20
Altreus m: my @a = 1..4; @a.kv ==> map { 10**$^a * $^b } ==> sum() ==> say() # ?
camelia 4321
Altreus :o
tobs seems correct to me 13:30
alas you won't get rid of the parentheses in-between 13:31
Altreus it's OK, now it's just part of the symbol instead of something you have to mentally match across the entire line
oo I can ==> return 13:33
I like this
13:34 dolmen joined 13:42 lucasb joined 13:44 zakharyas joined 13:58 thundergnat joined
thundergnat m: say sum (1..4).kv.map: 10 ** * * *; # 13:58
camelia 4321
13:59 thundergnat left 14:14 oodani joined
Xliff Can I define packages with exports in the same compunit as a class? 14:21
vrurg Xliff: yes 14:22
Xliff If so, do I need to "use" that class?
s/class/package/
vrurg use 'import' for those
Xliff Ahhh.
14:23 Manifest0 left
Xliff m: package A { class B is export { }; }; package B { import A; class C is B { } }; import B; say C.new.^name 14:24
camelia 5===SORRY!5=== Error while compiling <tmp>
Undeclared name:
C used at line 1
Xliff m: package A { class B is export { }; }; package B { import A; class C is B is export { } }; import B; say C.new.^name
camelia B::C
Xliff m: package A { class B is export { }; }; package B { import A; class C is B is export { } }; import B; my $c = ::("B::C"); say $c.^HOW.name 14:25
camelia 5===SORRY!5=== Error while compiling <tmp>
Cannot use .^ on a non-identifier method call
at <tmp>:1
------> 3mport B; my $c = ::("B::C"); say $c.^HOW7⏏5.name
expecting any of:
method arguments
Xliff m: package A { class B is export { }; }; package B { import A; class C is B is export { } }; import B; my $c = ::("B::C"); say $c.HOW.^name
camelia Perl6::Metamodel::ClassHOW
Xliff m: package A { class B is export { }; }; package B { import A; class C is B is export { } }; import B; my $c := ::("B::C"); say $c.HOW.^name
camelia Perl6::Metamodel::ClassHOW
vrurg why ::() instead of just C? 14:26
Xliff vrurg: Testing a larger use case
vrurg Ah, ok.
14:28 Manifest0 joined
Kaiepi m: package MY { our A = 1; }; say A 14:33
camelia 5===SORRY!5=== Error while compiling <tmp>
Cannot use pseudo package MY in package name
at <tmp>:1
------> 3package MY7⏏5 { our A = 1; }; say A
expecting any of:
generic role
Kaiepi damn 14:34
14:34 SJM_UK joined, Manifest0 left 14:38 SJM_UK left 14:39 ChoHag left 14:40 zakharyas left 14:43 SJM_UK joined 14:44 Manifest0 joined 14:49 vrurg left 14:57 noisegul left 14:58 noisegul joined 15:06 Manifest0 left, vrurg joined 15:08 ChoHag joined 15:10 Manifest0 joined 15:25 Manifest0 left
nadim_ Woodi: I put together a HTML tree renderer with DOM::Tiny. here's what it can do kind-johnson-fbf795.netlify.com/. the first part (80%) is the rendering of the Dom::Tiny tructure, the other part is after some munging to only show the HTML. It's far from perfect, there are a few node types that are nothandled 15:30
15:31 Manifest0 joined 15:38 Manifest0 left 15:41 molaf left, natrys joined 15:43 Manifest0 joined, SJM_UK left 15:44 mowcat joined 15:46 dolmen left 15:50 vrurg_ joined 15:51 vrurg left, vrurg_ is now known as vrurg 16:00 molaf joined 16:08 Manifest0 left 16:13 Manifest0 joined 16:25 Manifest0 left 16:28 nadim_ joined 16:33 Manifest0 joined 16:40 Manifest0 left 16:41 pamplemousse left 16:42 nadim_ left 16:44 nadim_ joined 16:45 Manifest0 joined 16:54 Manifest0 left 16:55 nadim_ left 16:56 nadim_ joined 17:05 Manifest0 joined
Kaiepi m: class Foo { also does role { method foo() { 1 } } if 1; }; say Foo.foo 17:11
camelia 5===SORRY!5=== Error while compiling <tmp>
Invalid typename 'role'
at <tmp>:1
------> 3class Foo { also does role7⏏5 { method foo() { 1 } } if 1; }; say Foo
Kaiepi m: class Foo { role Bar { method foo() { 1 } }; also does Bar if 1; }; say Foo.foo
camelia ===SORRY!===
Cannot find method 'ann' on object of type NQPMu
17:15 nadim_ left
Kaiepi m: class Foo { method BUILD { self.^mixin: role { method foo() { 1 } } if 1; } }; say Foo.new.foo 17:16
camelia 1
Kaiepi *submethod
17:17 mowcat left
Kaiepi wait if method BUILD works how do submethods and methods differ? 17:17
17:17 Cabanossi joined
ugexe because a subclass cannot call self.BUILD on a submethod 17:20
well, rather a subclasses BUILD won't clobber a parent's BUILD
m: class Foo { submethod BUILD() { say 42 } }; class Bar is Foo { }.new 17:21
camelia 42
ugexe m: class Foo { method BUILD() { say 42 } }; class Bar is Foo { }.new
camelia 42
42
Kaiepi ohh 17:22
vrurg thinks that non-submethod constructors and destructors should at least produce a warning. 17:25
17:26 pamplemousse joined 17:31 pamplemousse_ joined
Kaiepi is there a way to conditionally install a module? like, say, install one when a module's installed on windows, but another on any other os? 17:34
17:35 pamplemousse left 17:36 Manifest0 left
vrurg Kaiepi: no way, AFAIK. 17:37
Kaiepi damn
i want to split Net::Telnet into Net::Telnet, Net::Telnet::UNIX, and Net::Telnet::Windows, but i want Net::Telnet to be the module people actually go and install, which would depend on either of the other two conditionally, rather than having to install all three 17:38
vrurg Kaiepi: Install them all. Make Net::Telnet the frontend which woud import depending on the platform and the re-export all symbols. 17:39
Just have one module package, like Perl 5 File::Spec does. 17:40
17:43 Manifest0 joined
Kaiepi huh, so what i'm trying to do isn't that crazy after all 17:43
17:44 pamplemousse_ left
b2gills BEGIN $*DISTRO.is-win ?? require Net::Telnet::Windows !! require Net::Telnet::UNIX 17:45
17:51 Manifest0 left 17:55 molaf left 17:57 Manifest0 joined
ugexe you *can* actually declare that in meta6 data 18:00
github.com/niner/Inline-Python/blo...on#L13-L22 18:01
although honestly including them both in the same package is better
"depends" : [ {"name" : { "by-distro.name" : { "windows" : "Foo::Bar::Windows", "" : "Foo::Bar::UNIX } }, "version" : "1.2.3" } ] 18:08
18:08 Manifest0 left 18:13 Manifest0 joined 18:14 SJM_UK joined 18:19 SJM_UK left 18:20 Manifest0 left 18:25 Manifest0 joined 18:37 Manifest0 left 18:42 Manifest0 joined 18:49 Manifest0 left, pamplemousse_ joined 18:51 lucasb left 18:54 Manifest0 joined 19:01 vrurg left 19:03 Marcool joined
Marcool Hi all, I'm wondering how to solve this: I have a sub with a signature, and I'm trying to build an array to pass it as arguments, the issue being that it gets treated as one single arg, rather than a list of args and the signature isn't matched. 19:07
For example:
sub s(Str $str, *@other) { say "$str", " and ", @other } 19:08
my @a = ("a", "b")
s(@a) -> Type check failed in binding to parameter '$str'; expected Str but got Array ($["a", "b"])
guifa There are two ways you can do it. One is to pass the array as a slip
s(|@a)
Marcool guifa: oh thanks for the ultra-fast reaction! :)
guifa the | expands it so that you’ve technically called s(@a[0], @a[1], … ) 19:09
Marcool ok I'm with you
Kaiepi is there a better way i could be handling the oop here? i feel like the way i'm doing it is a bit weird fpaste.scsys.co.uk/585044
guifa The other way is to use the “single argument rule slurpy” 19:10
so you define your signature as
sub s(Str $str, +@other) { … }
if you call
s($foo, @bar) 19:11
Then @other is set to be @bar (because it recognizes you passed a single iterable)
If you call s($foo, $bar-1, $bar-2, $bar-3, $bar-4), then it’ll slurp the $bar variables into your @other array 19:12
Marcool right, I only knew about the *@other type slurpy arguments 19:13
guifa Actually ignore all that, I see what the issue is.
Marcool reading about slip
guifa Because you defined your sub as taking $str — and then @other — you do need to pass at least two arguments 19:14
That’s why the slip works — it effectively creates as many arguments as elements
Marcool I see, that's what I can see from testing it
El_Che That's what I call good service 19:15
Marcool and I like that trick here, I'd rather not change the signature if I can, and I feel like there shouldn't be any risk to using the slip in this case
19:15 irced joined
Marcool El_Che: I second that! :D 19:15
irced clears his throat.
guifa Another option might be to just use a single slurpy, but ensure that it has at least two elements (if that’s what you want)
19:15 MasterDuke joined
irced spits out an alien slug. 19:16
guifa something like sub s(*@strings where * > 1)
19:16 MasterDuke left, MasterDuke joined
El_Che or out of the box, use multi signatures 19:16
irced watches in amazement as the slug waddles across the floor under and beyond a door.
El_Che depending on the usecases
guifa ^^ that too
El_Che personally I find multi easier to read
irced takes a deep breath before announcing the reason for his appearance. 19:17
aaahhhhemm
19:18 vrurg joined
guifa covers floor with salt to protect the channel from slugs 19:18
irced Hey all, the modules.perl6.org I'm feeling lucking button is broken. I get a 404 -- Page Not Found
Marcool guifa: a million thanks for you :) 19:19
irced having done his duty, slouches deeply back and blends in with an old brown tattered chair.
irced is not feeling so lucky. 19:20
19:20 pamplemousse_ left
AlexDaniel irced: yeah github.com/perl6/modules.perl6.org/issues/124 19:21
irced raises his hand to high five AlexDaniel but then mysteriously aborts. 19:22
yep
thanks for confirming.
AlexDaniel is still there with his hand up and mouth open
guifa Marcool: in general when deciding how to set up the sub definition, I like to ask myself how users will use it (that is, what is the intuitive way), and the code the subs/methods accordingly. Part of the design pattern of P6 is to shift a bit more of the work on core/module developers, and less on the end users.
alexdaniel: careful, a flying slug might swoop in. Salt can’t save you from those buggers. 19:23
irced looks around furtively.
AlexDaniel
.oO( nom nom, food of the future )
irced who's ever heard of a flying slug.
irced acts inconspicuously.
guifa irced: www.belch.com/the-horrible-world-of...ing-slugs/ 19:24
irced guifa: noted
irced digests the report of "hypothetical" flying slugs. 19:26
19:29 Manifest0 left, pamplemousse_ joined 19:30 nadim_ joined 19:34 Manifest0 joined
irced guifa: ok. flying slugs. now I've heard of them. thanks. 19:34
alexdaniel: thanks for the github bug report link, looks like there's slug slime on it. gotta get some bats on that page. 19:35
irced has recognized the Acme::Insult::Lala a crowning achievement of the module sphere. Only a queasy sour-faced gull-catcher would dissent. 19:40
irced or a jarring rug-headed waterfly. 19:41
19:41 molaf joined
irced p6: say 'what' 19:44
camelia what
irced p6: use Acme::Insult::Lala;
camelia ===SORRY!===
Could not find Acme::Insult::Lala at line 1 in:
inst#/home/camelia/.perl6
inst#/home/camelia/rakudo-m-inst-2/share/perl6/site
inst#/home/camelia/rakudo-m-inst-2/share/perl6/vendor
inst#/home/camelia/rakudo-m-inst…
19:45 adu joined 19:48 Cabanossi left 19:52 Cabanossi joined
irced appears to shrink in size whilst sitting in an oversized brown tattered sofa chair. 19:53
20:08 pamplemousse_ left 20:13 Marcool left
TreyHarris How can I put a demo/testing MAIN into a .pm6 so it's runnable? With 'unit module' it doesn't seem possible at all; with a scoped module, I can put a MAIN after the closing `module` bracket, but it doesn't have any access to the scope. So I tried: `module Foo { sub MAIN() is export { ... } } sub MAIN(*@_) { Foo::Main() }`, but then I get `Could not find symbol '&MAIN'` from the line where Foo::Main() is 20:33
called.
(It's nothing special to do with the name `MAIN`; when I change it to `sub This-MAIN is export` and `Foo::This-Main()`, I get `Could not find symbol '&This-MAIN'` 20:35
(leaving the MAIN outside the module scope called MAIN, of course) 20:36
irced i'm a neophyte but can you post the script commands you are invoking along the way on like a paste bin or git gist? 20:37
TreyHarris I'd just have bare lines of code but I don't want them to run when the pm6 is used by another file
20:38 vrurg left
TreyHarris irced: not easily, it's a pretty big module doing things that have nothing to do with this particular wrinkle. Let me try to write a minimal example if my words aren't clear enough 20:38
irced TreyHarris: cool
TreyHarris: that might help you debug anyway 20:39
TreyHarris gist.github.com/treyharris/4c5983b...e30235defd 20:43
irced: ^
irced TreyHarris: k, thanks, let's see :-)
TreyHarris I just updated it, but in two commits that should have been one, so reload--you may have seen a version that included a say in the outer MAIN but no evidence in the output that it was run (it was as you can see if you reload) 20:48
irced i see
20:48 vrurg joined
irced not clear to me but I am still trying some things :-) 20:52
TreyHarris irced: oh, and because I was sloppy i the update, the actual call changed briefly from `::MAIN` to `.MAIN`, but that was never intended
irced cool, looking now 20:53
20:53 Manifest0 left
irced and normally you would have the sub MAIN() in a pl6 file right? 20:53
TreyHarris a "pl6 file"? If I were on Windows I suppose I would, but I usually use no file extension at all for executables 20:57
Added a second pm6 slightly different, with the same result (output now pasted to a comment at the end) 20:58
irced anyway, I think i see a solution
prefix sub with the our keyword, as in our sub MAIN($x) {...
at least that is one solution, exploring others now 20:59
20:59 Manifest0 joined
irced TreyHarris: the "our declarator" "means that in addition to being lexically scoped it is aliased in the module's symbol table" vs using "is export" which registers in the "caller's table when the module is imported". but these differences may not be important in this context. I am trying now with export. 21:01
TreyHarris: please confirm you can get it to work with the our declarator. 21:02
TreyHarris irced: yes, that does it. interesting; I apparently misunderstood what `is export` does 21:04
thanks
(I still don't understand what `is export` actually does, I guess) 21:05
irced TreyHarris: is export can work too, I am looking to see why it isn't it this case.
ugexe what is your question irced?
irced ugexe: I am helping TreyHarris debug module issues :-) 21:07
TreyHarris See, I actually tried that first, sorta--I thought that putting "our sub MAIN" in this case would mean you could use it even in the "unit module" case.
irced ugexe: I don't have any questions at the moment, but I do have ideas :-) 21:08
TreyHarris But once I got rid of "unit module" I got rid of the "our" too. Shouldn't have done that
Is there _any_ way to get RUN-MAIN handling in a 'unit module'?
21:09 nadim_ left
irced hold up, let me explain the differences i referred to earlier concerning our and is export 21:09
ugexe TreyHarris: yes
TreyHarris: github.com/ugexe/zef/blob/master/bin/zef 21:10
`our` will allow you to call My::Module::MAIN(...); `is export` allows you to just call `MAIN(...)` 21:11
irced TreyHarris: ugexe is right, it exports to symbols to be lexically scoped to the caller block's symbol table
TreyHarris: naturally, symbols can't have the same name, btw.
ugexe however MAIN is not the same as other exports. the mainline only gets created once, so only the first module that exports MAIN will have their candidates available
or if your module has MAIN but also the script calling it... only one of them will be used 21:12
TreyHarris ugexe: the `proto MAIN(|) is export` at github.com/ugexe/zef/blob/e7389737...LI.pm6#L22 is key here? Because just slapping "multi" in front wouldn't solve this
ugexe you could `is export` each `multi MAIN` if you want
TreyHarris irced: "symbols can't have the same name, btw"... what do you mean by that?
irced TreyHarris: I suppose multi is one way to prevent conflicts.
TreyHarris: same signature anyway or two subs instead of multi 21:13
TreyHarris irced: Was there a place I was doing that inadvertently? 21:14
irced TreyHarris: and export should be coupled with import (or implicitly imported if you were to "use" the .pm6 file of the same name as the module from a separate .pl6 file. That's why I was drawing attention to your extension 21:15
TreyHarris: anyway, if you use is export in the same file as you are apparently doing, your sub MAIN will need to import My-Modules-Script and call "is exported" subroutines defined in the same module but directly and not via name::space (since it becomes part of the caller's symbol table) 21:17
TreyHarris irced: But my use case was specifically wanting to use a single file for both code, and a demo MAIN using that code
irced TreyHarris: the caller in this case being your sub MAIN($) {...
ugexe only one files MAINs will be used 21:18
its not like other multi subs in this way
irced ugexe: good observation 21:19
ugexe if your script is providing its own multi MAIN then you cannot use a module providing it own multi MAIN
irced TreyHarris: I haven't actually tried to export the MAIN yet, but I think ugexe is right. testing now.
ugexe it would be great if it DID
irced TreyHarris: actually there is no conflict! 21:20
TreyHarris: do this in sub. import My-Modules-Script; now call MAIN from MAIN! as in MAIN("something");
TreyHarris If you reload the gist, there's a 'Third' file that fails oddly now 21:21
irced TreyHarris: and define MAIN in the module with is export!
ugexe proto MAIN($) is export { ... } is wrong
that is a role interface requirement
proto MAIN($) is export {*}
21:22 irced left 21:23 cpan-p6 joined, cpan-p6 left, cpan-p6 joined 21:24 irced joined
irced TreyHarris: so you have two solutions, the first we examined with the our declarator most closely matches your requirements. 21:24
TreyHarris: and what I said about conflicting symbols seems more advisory than anything as per testing and demonstration. 21:25
TreyHarris: but if you insist on using is export you need to import (explicitly in the same file) 21:29
TreyHarris `My-Fourth-Modules-Script` is interesting; it looks like the change ugexe just suggested, but it fails very differently 21:30
irced TreyHarris: new problem?
ugexe thats pretty obvious :) 21:31
TreyHarris irced: I don't "insist" on is export, I just believe Zef's solution can't be achieved without it or with a 'unit' file
ugexe you are proto MAIN($) is export { * } in a script (pointless to export). and you are not exporting the MAIN in the module. so where should it get usage from?
irced TreyHarris: did I not show how is export can work 21:32
TreyHarris ugexe: ah, that was just a silly mistake and I didn't see the line was misplaced. Rather than continuing to reload, here's a new URL with a new (old) error: gist.github.com/treyharris/d6660bf...47dc277ae2 21:35
ugexe m: package Foo { multi MAIN($x) is export { say $x }; }; import Foo; @*ARGS = "42"
camelia 42
TreyHarris irced: With 'unit'?
ugexe because you have not declared an `our` scoped MAIN 21:36
our proto MAIN($) is export { * }
irced TreyHarris: Can you put your current issue code on a new page?
TreyHarris irced: put my current issue code on a new page? I don't follow 21:38
irced TreyHarris: a new gist 21:39
TreyHarris irced: The URL isn't working for you?
irced TreyHarris: aesthetically no
TreyHarris I'll have to clone it (it's working for me) and re-gist it, hold on
wait... "aesthetically"? 21:40
irced TreyHarris: yep
TreyHarris irced: no, I mean, I need more detail, because if I just recreate that gist on a new hash URL it's not going to look any different
irced TreyHarris: ok, so which file is the issue file then?
TreyHarris irced: huh? There's just one file 21:41
irced TreyHarris: I see 4 files
ugexe i already told you what is wrong
TreyHarris ugexe: yes, gist.github.com/treyharris/d6660bf...47dc277ae2 works, but I don't see how you modify that to work with "unit package"? 21:42
irced TreyHarris: ok, that's the link 21:43
TreyHarris irced: I only see one: photos.app.goo.gl/4cW4k1BV2QL7e1vE6
21:43 Marcool joined
irced TreyHarris: k, I see now. 21:43
ugexe 16:36:47 <ugexe>our proto MAIN($) is export { * } 21:44
TreyHarris irced: No, the link I just posted is a working version, the prior gist was the one that screenshot was of. You get 4 files at that URL, gist.github.com/treyharris/d6660bf...47dc277ae2 that I sent at 35 minutes after the hour?
irced TreyHarris: ok, anyway, let me know which file you want us to look at if any now 21:45
TreyHarris: or discuss anyway 21:46
Marcool guifa: (sorry I was away for awhile) thanks for the advice and help, I see what you're saying about the sub definition. Will give it a think. 21:47
TreyHarris ugexe: I must have misunderstood you, as I took that to mean this: gist.github.com/de46c7af3fb780838c...9ab69fb8d7
irced: ^ latest gist, one file
ugexe you wouldnt run it like that 21:48
perl6 -M Foo::Bar -e ''
`perl6 -M Zef::CLI -e '' install Foo::Bar --debug` is the same as `zef install Foo::Bar --debug` 21:49
TreyHarris ugexe: that gives me "Usage:␤ -e '...' <x>" 21:50
ugexe: oh, I see, the argument has to go after the -e. Okay 21:51
(after the `-e ''`, I mean) 21:52
(That's at gist.github.com/78a2e0db94597ed592...70bec95c77 btw if anyone cares.) 21:55
Thanks, ugexe, sorry I was so slow on the uptake
21:56 kiwi_0 joined 21:57 vrurg left, vrurg joined
kiwi_0 Hi, I have a question tangentially related to perl6. I have seen in the docs the ouptut of a command to be written as `# OUTPUT: «Hexadecimal 10␤» ` with guillemets and that newline character. Is there a specification for this somewhere? 21:58
timotimo m: say "hexadecimal 10" 22:00
camelia hexadecimal 10
timotimo you mean like that? :)
irced blinks in disbelief.
m: say "I have accepted Cthululu as the underworld's lord and savior." 22:05
camelia I have accepted Cthululu as the underworld's lord and savior.
irced becomes increasingly concerned about camelia.
TreyHarris I was almost there at the very first, but then I went down the garden path. gist.github.com/eba1752c6a59a17fb5...fbfb236ef0 shows the minimal fixed example; you must use 'is export' and you have to call it with `perl6 -M Package-Name -e '' <args>`
timotimo yeah, you can't currently run only a module as code without also an "empty" snippet of code 22:06
TreyHarris and `our` is insufficient in this case.
timotimo we could put in a special case that skips loading the grammar for -e '' 22:07
TreyHarris timotimo: As long as you're thinking along those lines, I was thinking a few hours ago that I'd also like a flag to perl6 that makes the REPL run at the end of normal execution--presumably just before endtime phasers are run 22:08
kiwi_0 yes like that 22:09
thanks!
so that is the output of the `say` method? 22:10
TreyHarris kiwi_0: someone answered you? or did you figure out where to look at camelia's source code?
kiwi_0 i haven't figured it out
still trying to find it
TreyHarris kiwi_0: docs.perl6.org/language/101-basics...ics%29-say
the guillamets and the newline symbol are something camelia does to make output run in the channel IRC-friendly 22:11
kiwi_0 thank you!
TreyHarris I think for my use-case -- demos and example code of individual lib files -- multi is wrong, since there's no way (I think?) to barricade a multi MAIN defined in this way from participating in multi dispatch when using the lib as part of a larger application 22:18
timotimo export tags is a way 22:20
or put the "use" inside an inner scope with curlies
ugexe mainline only gets built once, so this doesnt really apply to MAIN
first files MAINs are the only candidates
so there can be no conflict 22:21
22:21 noisegul left
TreyHarris ugexe: oh, of course. that makes sense. I wouldn't want real app multi MAIN's like in Zef::CLI included in any packages that have API logic to demo, anyway--they're basically disjoint 22:22
irced stares at his shoes. 22:25
22:36 Marcool left 22:42 Black_Ribbon joined 22:55 natrys left
TreyHarris oh, shoot... when you do it this way, the module's MAIN gets used whenever you `use` it (unless you specifically use it in a different scope, like inside the sub MAIN's curlies). So if you `use Package-Containing-Main; ... sub MAIN...` you get a redeclaration error asking if you meant to use a multi, and if you do `use Package-Containing-Main; ... multi MAIN...`, same thing. `unit sub MAIN... use 22:57
Package-Containing-Main;` works, as does `sub MAIN() { use Package-Containing-Main;...`. But if the Package-Containing-Main decalares `multi MAIN`, and you `use Package-Containing-Main; multi MAIN`, you get the package's MAIN being run again.
So i think this idea was just a bad one... I liked the idea of being able to include running code as self-documentation for each module, and I really disliked having a separate directory tree mirroring lib of examples, but it seems like that's the better choice.
22:58 nadim_ joined
TreyHarris It is an interesting escape valve though: if you wanted to import something like Zef::CLI without actually executing it for some reason, just start your program via 'unit sub MAIN', and then you avoid it without having to specify a later-than-normal phase 23:09
Though I guess any `use` statements following `unit sub MAIN` are in a different phase implicitly, aren't they? 23:11
irced head starts to spin. 23:13
TreyHarris: I dunno, I lost track after you and ubexe started on another discussion. 23:14
TreyHarris huh; I thought there was a $*PHASE or $*PHASER variable that let you check directly 23:23
ugexe fwiw this handling of MAIN wasnt an intentional design decision afaik 23:33
its just a side effect of how mainline is created
23:33 reach_satori joined 23:36 irced left
ugexe i wish they were handled like regular multis 23:37
then bin/zef could contain something like `require bin/zef-get; require bin/zef-test; require bin/zef-install;` 23:38
23:44 nepugia joined 23:45 Manifest0 left 23:51 Guest64 joined, Guest64 left 23:52 Guest62 joined
Guest62 Are there any portable version of Perl6 / Rakudo for Windows? Or at the very least, the ability to compile to exe? 23:53
23:53 Manifest0 joined
TreyHarris people were talking about doing that using Docker on this channel just last week 23:54
timotimo Guest62: just recently we finally got relocatable rakudo, which means you can move the exe file around (with the whole rest of rakudo's folder) and it'll still work 23:55
Guest62 Awesome, that'll work.
TreyHarris I think you have to have the very latest pre-release of Windows for that, though? Older Win 10 versions including the current stable channel only has the Linux-ish variant of Windows I think
timotimo until then you could only install to C:\rakudo or so if you used the official rakudo star .msi installation
apart from that, there's also App::InstallMaker::WiX or something similar like that
it'll compile a custom rakudo for you to go into a very specific directory (it was before the relocateable rakudo, that's why) and it'll package the application in question along with it 23:56
and you'll get a .msi that will install your application together with its own rakudo
which can be good if you don't want the users to surprise you with rakudo versions you weren't testing with
either too old or newer 23:57
Guest62 I'll keep that in mind. Which Rakudo is relocatable?
TreyHarris timotimo: how about system dependencies? IIRC, that was the reason folks were discussing Docker
timotimo maximum shrug, what i just explained is pretty much 100% of my windows-related perl6 knowledge 23:58
i just recently finally rebuilt a bunch of DLLs for perl6 modules, GTK and zstd most notably, to put them up on p6c.org
but i didn't take the time to actually update all the modules to fit 23:59