»ö« 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.
gdonald my spiral thingy: gist.github.com/gdonald/28750b8e6a...a2b2df20b8 01:58
discord6 <RaycatWhoDat> Dumb question: What could be considered a low-level module for Perl 6 programmers if NQP isn't it? 04:20
Xliff RaycayWhoDat: What do you mean? 04:22
NQP is definitely "low-level".
discord6 <RaycatWhoDat> NQP says you shouldn't rely on it. 04:23
Xliff Perl6 is based on NQP
Well... you shouldn't!
.... until you have to!
discord6 <RaycatWhoDat> o
Xliff And then you need to keep track of what you use in case things change.
What are you trying to do? 04:24
discord6 <RaycatWhoDat> I was under the impression that it was black magic that should never be touched
<RaycatWhoDat> unless you're a core dev
Xliff Yes. Tell that to the necromancers.
They know who they are.
discord6 <RaycatWhoDat> timotimo <_<
Xliff The fact that the word "necromancer" exists should tell you everything.
Hence my admonishment: '... keep track of when things change!' 04:25
NQP is stable enough, as it has to track the MoarVM opcodes.
discord6 <Rogue> Damian used a bit of it to add for/else
Xliff github.com/perl6/nqp/blob/master/d...s.markdown
Those are fairly stable up and until MoarVM is updated or changed. 04:26
discord6 <RaycatWhoDat> Ah. Got it. 04:27
Xliff Last time that was updated was August 4th.
You don't need to be a core dev to use NQP. It's there to be used! 04:28
Just no one wants to support it with relation to Perl6. If you have issues, you are better off taking them to #nqp
Be prepared to stand firm and ask the right questions, and you should be fine. 04:29
discord6 <RaycatWhoDat> Understood.
Xliff So....
What are you trying to do?! :> 04:30
I was about to go to bed, but I can stay up for something juicy! :D
discord6 <RaycatWhoDat> The honest answer? Trying to reason myself out of using Perl 6.
Xliff *gasp* 04:31
discord6 <RaycatWhoDat> D:
Xliff Whyyyy?!
discord6 <RaycatWhoDat> I know, I know.
Xliff The "honest answer" wasn't much of one. :q
discord6 <RaycatWhoDat> I feel like I have too many daggone options and I am not very good at convincing other people to use "less-popular" languages. 04:32
Xliff Ah. Yes. That's an occupational hazard when using a Perl.
Again. What. Are. You. Trying. To. Do?
discord6 <RaycatWhoDat> Personally, make a game with Perl 6. Professionally, try to replace a Java microservice with Perl 6. 04:33
Xliff RaycatWhoDat: Are you staring down a rabbit hole and looking for a place to grab on to? 04:34
Aahhh....
Yes. Well...
timotimo is the person to talk with there.
And... well... me.
With respect to microservices, the default answer is always "use CRO" 04:35
TBH, these days, when you say "microservice" everyone screams "Go!" 04:36
discord6 <RaycatWhoDat> Yeah. That's my competition.
Xliff Depends on what you are trying to do. I still have yet to figure out Go's popularity.
Yeah, well the only way you beat Go with Perl6 is flexibility.
discord6 <Rogue> I don't think Go ever got much enduring popularity
Xliff You will NOT beat it, performancewise.
discord6 <Rogue> it just had its moment of being the topic of conversation, and then the hype died down with few people actually using the language 04:37
<RaycatWhoDat> Really? I thought people were still big on Go.
<Rogue> Honestly it's been ages since last I saw a discussion about Go on my normal programming forums 04:38
<Rogue> i.e. the Programming discord server and /r/perl6 (which wouldn't have anything about Go anyway) 04:39
<Rogue> lol
<RaycatWhoDat> wait a second
Xliff Take the example Go program on the bottom of this page... blog.golang.org/examples
discord6 <RaycatWhoDat> I feel like I've seen you before, now that you mention that Discord
<Rogue> Please tell me it wasn't in a political discussion lol. 04:40
<RaycatWhoDat> Were you like the one guy who was big on Perl 6 over there when I came through
<Rogue> Oh yeah yeah
Xliff For all that syntax, I bet a Perl6 solution would be cleaner and easier to read.
discord6 <Rogue> those were the days, evangelizing as hard as I could go
<RaycatWhoDat> I agree with you, Xliff
<RaycatWhoDat> Honestly, I need to stop waffling on these things and just experiment. This "Ready-aim-aim-aim" disease is killing my potential. 04:42
<RaycatWhoDat> I should just make the thing and let the code speak
Xliff RaycatWhoDat: Hear, hear! 04:44
gist.github.com/Xliff/9fb038df877e...c6bf8be7e8 04:48
discord6 <RaycatWhoDat> Bless, Xliff 04:54
<RaycatWhoDat> This is a good starting point to build a case
Xliff :>
Also, the .map calls are there to help new users follow what's going on. They are NOT necessary. 04:56
.str should handle the conversion.
.Str or .gist -- I think its the latter.
Ah. It's .gist! 04:58
discord6 <RaycatWhoDat> Interesting. 04:59
Xliff And with that... I depart for the soft cushions of me bed. 05:09
discord6 <Rogue> sounds fantastic
Xliff I'm still wondering about the nqp.... 05:10
RaycatWhoDat: Do I need to bring out the feathers and whipped cream?
discord6 <RaycatWhoDat> wait, what 05:14
Xliff Why. NQP? 05:15
I'm still wondering what made you think in that direction.
Coz... once you start dealing with NQP, there's no going back. 05:16
I'm thinking about taking the plunge. So I'm curious as to why you thought of it.
discord6 <RaycatWhoDat> Oh, I wanted to see if NQP was within a stone's throw of D and C++. shrug Nothing concreate
<RaycatWhoDat> concrete*
Xliff Hmmm.... 05:17
More like a boulder.
It's actually closer to Lisp
discord6 <RaycatWhoDat> I had a dream of a pure-Perl-ish ecosystem using NQP, Perl 5, and Perl 6. 05:17
<RaycatWhoDat> But, alas.
<RaycatWhoDat> "ecosystem" in this case, meaning having 99% of my use cases covered 05:18
<RaycatWhoDat> Which is a bit like asking for the moon, I think
Xliff Could work at it. 05:21
You should start by listing your use cases! 05:22
discord6 <RaycatWhoDat> Game development, shell and automation scripting, string transformations and a bit of analysis. 05:24
<RaycatWhoDat> Web development, professionally. But I know JavaScript so I wouldn't use Perl.
Xliff Can do all that, although game development is best left to C, and managed by NativeCall 05:25
Web Dev, although you need to be a little specific. Web Dev requires JS. Can't get around it.
discord6 <RaycatWhoDat> Game development in C sounds... rough.
Xliff Still, on the server-side, Perl6 can handle a bit.
C/C++ -- NativeCall should be able to deal with it. 05:26
Most engines are written in one or the other.
And C# can be made to speak C for NativeCall purposes.
Anything done in Java can be done in Perl6 if you don't mind the performance hit. 05:27
discord6 <RaycatWhoDat> Mm. 05:29
Xliff Wow! Quantum Break was done in D? Who knew? 05:30
discord6 <RaycatWhoDat> Okay. This is a lot to digest but it's a good start.
<RaycatWhoDat> Yeah.
<RaycatWhoDat> I think Contact has bits in D too.
Xliff Contact or Control?
discord6 <RaycatWhoDat> The latter.
<RaycatWhoDat> Thanks.
Elronnd @RaycatWhoDat I'm currently running my game engine in d, but with perl6 for scripting
Xliff :)
Currently playing both.
discord6 <RaycatWhoDat> how
Xliff Elronnd++ !! 05:31
Elronnd: Lemme guess... NativeCall?
Elronnd actually, the perl6 scripting part isn't done yet--using a scheme thing atm--but will be done soon. And is oss so can be integrated
Xliff: yah. NativeCall + embedding moarvm
Xliff Ooh!
Code anywhere? 05:32
discord6 <RaycatWhoDat> I have to look into this NativeCall stuff
Elronnd perl6 is probably fast enough for basic or 2-d stuff, but I wouldn't use it for anything big or 3-d
github.com/elronnd/libport
Xliff Elronnd: I've got COGL running with a Perl6 fronting.
discord6 <RaycatWhoDat> On the flip side, oh boy, back up to five langauges
Xliff Still early days, but it does workl.
discord6 <RaycatWhoDat> languages*
Elronnd I actually have a couple of questions about nativecall, if anyone is knowledgeable about it
Xliff Elronnd: I can take a shot. What's up? 05:33
Elronnd so basically
discord6 <RaycatWhoDat> Aight, thanks for the info, I'm outta here
Xliff 'nn Raycat
discord6 <RaycatWhoDat> Go to sleep Xliff
Elronnd I have a class declared as repr('CStruct'). It has some member variables--say, an int64. The problem is that when I try to instantiate that class from the p6 side, it makes it a *pointer* to int64
night raycat
Xliff LOL
Xliff Elronnd: You sure its a pointer? 05:34
Elronnd well
Xliff Is that online, somewhere?
Elronnd when I pass it from p6 to c, it looks like a pointer from the c side. I can't actually demo any code right now because I'm in the middle of a system migration 05:35
Xliff So you have to deref on the C side to get the value set in P6?
Elronnd backing up $HOME and it's about halfway done, so I don't want to disturb it. Plus, I wiped out my p6 install which was in $HOME
yes
Xliff -weird-
I have not had that problem. 05:36
At least, not yet.
Which version of Perl6?
Elronnd so if I have on p6 side class foo is repr('CStruct') { has int64 $.whatever; } foo.new(whatever => 5), then on the c side I have to say struct foo { int64_t *whatever; }
latest git as of a couple weeks ago
Xliff See.... int64 is a concrete type, so it should NOT do that.
Elronnd ah, worth mentioning 05:37
Xliff Sounds like your 'CStruct' is acting like the pointer. Not the int64
Elronnd this is returning an instance of foo from a perl6 callback
which may change the calculus
Xliff Yeah. I would look at how that callback is returning foo. 05:38
Cirno-ne-baka Ohayo
Xliff Cirno-ne-baka: Ohayo! 05:39
Elronnd ohai Cirno-ne-baka
Xliff: will you be around in a couple of hours? It's probably better if I get my thing figured out so I can give you actual code to chew on
Xliff Will probably be dosing, but I will be more than happy to help out when I wake back up.
Elronnd aight, thanks! 05:40
Xliff Elronnd: Have you seen my github page?
github.com/Xliff
Cirno-ne-baka example from perl6intro `class bar-chart { has Int @.bar-values; method plot { say @.bar-values; }}class line-chart { has Int @.line-values; method plot { say @.line-values; }}class combo-chart is bar-chart is line-chart { method plot { say @.bar-values; say @.line-values; }}my $actual-sales = bar-chart.new(bar-values =>
[10,9,11,8,7,10]);my $forecast-sales = line-chart.new(line-values => [9,8,10,7,6,9]);my $actual-vs-forecast = combo-chart.new(bar-values => [10,9,11,8,7,10], line-values => [9,8,10,7,6,9]);say "Actual sales:";$actual-sales.plot;say "Forecast sales:";$forecast-sales.plot;say "Actual vs
Forecast:";$actual-vs-forecast.plot;`
Elronnd you made the gtk stuff, right?
Xliff Feel free to peruse my project code. Maybe something there will help.
Much of it deals extensively with NativeCall
Elronnd will take a look
Cirno-ne-baka give me output `Actual sales:[10 9 11 8 7 10]Forecast sales:[9 8 10 7 6 9]Actual vs Forecast:[10 9 11 8 7 10][]` 05:41
Xliff Yes. I made the "gtk stuff" LOL
Elronnd :)
Xliff OK. Off to bed. o7
Elronnd cya
Cirno-ne-baka but must be like this `Actual sales:[10 9 11 8 7 10]Forecast sales:[9 8 10 7 6 9]Actual vs Forecast:[10 9 11 8 7 10][9 8 10 7 6 9]`
what i`m going wrong? 05:44
Cirno-ne-baka but with `role` work exactly 06:01
Kaiepi "... that's pretty cool, i'll look into perl. ..." 06:14
this was just from mentioning the async support perl 6 has alone
Geth_ problem-solving/path-to-raku: e0185a4a78 | (Elizabeth Mattijsen)++ | solutions/language/PATH-TO-RAKU.md
Settle on .raku / .rakumod / .rakudoc / .rakutest
07:51
Geth_ problem-solving/path-to-raku: 9bcb834ec9 | (Elizabeth Mattijsen)++ | solutions/language/SWOT-TO-RAKU.md
Added "no longer linked to *good* reputation of Perl as weakness
07:59
sena_kun m: msub f { say 42 }; &f.wrap(sub () { callsame; say "Before second call"; callsame; }); f 09:33
camelia 5===SORRY!5=== Error while compiling <tmp>
Undeclared routines:
f used at line 1
msub used at line 1. Did you mean 'msb'?
sena_kun m: sub f { say 42 }; &f.wrap(sub () { callsame; say "Before second call"; callsame; }); f 09:34
camelia 42
Before second call
sena_kun bisectable6, sub f { say 42 }; &f.wrap(sub () { callsame; say "Before second call"; callsame; }); f;
bisectable6 sena_kun, On both starting points (old=2015.12 new=565b2ac) the exit code is 0 and the output is identical as well
sena_kun, Output on both points: «42␤Before second call␤»
sena_kun am I missing anything?
timotimo hm, is there something like "nextcandidate" for "same"? 09:40
it's possible that callsame clears the piece that saves away what's going to get invoked 09:41
sena_kun has no idea
timotimo with the takedispatcher op
sena_kun is that a bug or?
timotimo m: sub f { say 42 }; &f.wrap(sub () { {*}; say "before 2nd"; {*} }); f 09:50
camelia 5===SORRY!5=== Error while compiling <tmp>
{*} may only appear in proto
at <tmp>:1
------> 3sub f { say 42 }; &f.wrap(sub () { {*}7⏏5; say "before 2nd"; {*} }); f
expecting any of:
horizontal whitespace
term
timotimo ah
Geth_ problem-solving/path-to-raku: 69786a25f2 | (Elizabeth Mattijsen)++ | solutions/language/PATH-TO-RAKU.md
Fix typo
10:36
Geth_ doc: 6c71f0e958 | (JJ Merelo)++ | 7 files
Fixes #3024 and adjusts regex
11:10
doc: 1589642efb | (JJ Merelo)++ | doc/Language/testing.pod6
Eliminates meta-ok, which wasn't there anyway
synopsebot Link: doc.perl6.org/language/testing
SmokeMachine Elronnd: are you usin HAS instead of has? 11:21
timotimo i think the problem has more to do with "typedef struct { int64_t number } the_struct; the_struct *foo" being indistinguishable from "typedef struct { int64_t *number; }; the_struct; the_struct foo;" 11:23
SmokeMachine One question: would that be possible to make a module that introduce a slang that makes every block that comes after a term mean “,” and the block? I mean: `func 42 {;}` mean `func 42, {;}` and `func 13 -> $bla {;}` mean `func 13, -> $bla {;}` 11:53
Is it possible? Would it break anything? 11:54
timotimo would surely be possible to make, not saying how hard it'll be :)
SmokeMachine timotimo: I think I would be cool... what do you think? 11:57
timotimo well, it'll be a valid use of TTIAR, which is usually one of our better ways to figure out that someone has made a mistake 11:58
like forgetting a semicolon after a sub call when followed by a block
SmokeMachine timotimo: you mean it would make worse job finding errors? 12:03
timotimo only in some circumstances 12:04
Xliff . 14:30
How would you invoke a function pointer from C? 14:36
SmokeMachine m: my Supplier $supplier .= new; { my $*a = 42; $supplier.Supply.tap: { say $*a } }; { my $*a = 13; $supplier.emit: $_ for ^10 } # Is that expected? I would expect that to print 42... 19:14
camelia 13
13
13
13
13
13
13
13
13
13
SmokeMachine why is that printing 13?
sena_kun it is expected 19:16
because scope is dynamic in this case
blocks from taps are executed from `emit` position 19:17
SmokeMachine sena_kun: yes, the `emit` really calls the tab block?
s/tab/tap/
sena_kun SmokeMachine, I did not see the implementation, but it is written that code that calls `emit` pays for execution 19:20
SmokeMachine, 6guts.wordpress.com/2017/11/24/a-u...ncy-model/ <- read the "Backpressure" part
>The general principle with Supply is that the sender of a message pays the cost of its processing. 19:21
SmokeMachine sena_kun: yeah... that would make sense...
SmokeMachine almost there... www.irccloud.com/pastebin/7mozd53M/ 19:33
Elronnd timotimo: hmm, I think you are right (re. nativecall) 19:48
Xliff Elronnd: Yeah. That's what I was trying to get at earlier. 20:14
timotimo: Does native call handle the ability to invoke a C function pointer? 20:17
s/handle/have/
timotimo yeah 20:23
i think it does
Xliff timotimo: Can you link to a good example? 21:28
I've been trying to find one with no luck.
timotimo no :( 21:32
SmokeMachine is there any map-ish List method that accept multiple blocks and uses it as candidates for each run? 21:33
Xliff SmokeMachine: Um... I don't understand what you are thinking, here. 21:34
SmokeMachine: .dumpmap evaluates based on a condition. 21:36
So I would think that, run through a given/when in the block, might do what you want.
timotimo i think the question is for a kind of round-robin map maybe? 21:38
SmokeMachine I mean something like: (1, 2, 3, 4, 5, "a", "b", "c", "d", "e").map: -> Int $a { $a * 2 }, -> Str $a { $a xx 2 }
Xliff Exactly. 21:39
(1, 2, 3, 4, 5, "a", "b", "c", "d", "e").map({ when Int $a { $a * 2 }; when Str { $a xx 2 };}).say
m: (1, 2, 3, 4, 5, "a", "b", "c", "d", "e").map({ when Int $a { $a * 2 }; when Str { $a xx 2 };}).say
camelia 5===SORRY!5=== Error while compiling <tmp>
Missing block
at <tmp>:1
------> 3"a", "b", "c", "d", "e").map({ when Int7⏏5 $a { $a * 2 }; when Str { $a xx 2 };}).
expecting any of:
block or pointy block
infix
Xliff m: (1, 2, 3, 4, 5, "a", "b", "c", "d", "e").map({ when Int { $a * 2 }; when Str { $a xx 2 };}).say
camelia 5===SORRY!5=== Error while compiling <tmp>
Variable '$a' is not declared
at <tmp>:1
------> 3, "b", "c", "d", "e").map({ when Int { 7⏏5$a * 2 }; when Str { $a xx 2 };}).say
Xliff m: (1, 2, 3, 4, 5, "a", "b", "c", "d", "e").map({ when Int { $_ * 2 }; when Str { $_ xx 2 };}).say 21:40
camelia (2 4 6 8 10 (a a) (b b) (c c) (d d) (e e))
lizmat weekly: www.youtube.com/channel/UCDkz-__gl...LexukpG0DA # Perl 6 tutorials
notable6 lizmat, Noted! (weekly)
SmokeMachine yes, makes sense! thank you Xliff!
Xliff :)
SmokeMachine Xliff: the nearest I've got from function pointer on native call was this... I don't think it could help... but take a look and let me know if something there could help you, please... 21:44
github.com/FCO/bernalang/blob/mach...t.pm6#L351
Xliff SmokeMachine++ 21:51
I was hoping for something simpler, but I will take a look.
SmokeMachine Xliff: The wrapper for GccJit (without the BernaLang) is here if you like: github.com/FCO/GccJit/blob/master/...GccJit.pm6 21:55
Xliff .tell jnthn What's the best way to invoke a C function pointer using NativeCall? 21:56
tellable6 Xliff, I'll pass your message to jnthn
SmokeMachine Xliff: I just saw you helped me with that code a few months ago... colabti.org/irclogger/irclogger_lo...01-08#l484 22:06
Xliff Yup! I remember that! :) 22:07
Xliff SmokeMachine: So if you are returning a Function class from gcc_jit_context, how are you invoking the returned Function? 22:37
SmokeMachine Xliff: That's the problem... I don't tall them... :( github.com/FCO/bernalang/blob/mach...t.pm6#L410 22:50
call
Xliff Ahh... you get gcc_jit to call them. 22:51
SmokeMachine yes...
Xliff OK. Thanks, SmokeMachine 22:56
m_v_m Hi. I have a strange error with 2d arrays. I would like to create 2d array like that: pastebin.com/Mw9vtW3m and I have error: expected Array[Array[Int]] but got Array ($[]) 23:35
To be honest...I really don't know why.
timotimo two things: 23:37
declaring a "Foo @bar" gives you an "array of Foo", so you're asking for Positional[Array[Array[Int]]], so a 3d array basically 23:38
if you put [] around something, it will be iterated into an array, which means [[]] will just turn into a 1d array (you can get a depth-two array with [[],]) 23:39
m: my Array[Int] @t_map; @t_map[1][2] = 99; say @t_map.perl
camelia Type check failed in assignment to @t_map[1]; expected Array[Int] but got Array ($[])
in block <unit> at <tmp> line 1
timotimo m: my Array[Int] @t_map = Array[Int].new; @t_map[0][1] = 99; say @t_map.perl 23:40
camelia Type check failed in assignment to @t_map[0]; expected Array[Int] but got Array ($[])
in block <unit> at <tmp> line 1
timotimo m: my Array[Int] @t_map = Array[Int].new,; @t_map[0][1] = 99; say @t_map.perl
camelia Array[Array[Int]].new(Array[Int].new(Int, 99))
timotimo did the same thing wrong that you did, lol
time for bed
m_v_m: does that help?
m_v_m Yes, but why it is so strange ...
Perl6 is really nicely done..but that kind of behaviour is really strange. 23:41
timotimo you can use [] around something to get an array of items from something, for example [<foo bar baz>] or [some-sequence-generating-sub()] 23:42
the thing that requires the comma is the "single-argument rule" where a single iterable thing will be taken as a list of things instead of a single thing
Xliff What? 23:43
timotimo modulo scalar containers
Xliff It's early for you, timotimo.
timotimo psst
Xliff So... nothing more on function pointers from C?
timotimo *shrug*, nativecast it i guess?
Xliff How?
That actually sounds right, for some reason, but I still need a proper signature.
so... 23:44
my $func = nativecast (& (int32, Str --> gdouble), $c-pointer)?
or ... my &func = nativecast (& (int32, Str --> gdouble), $c-pointer)?
timotimo timo@schmand ~> perl6-gdb-m -e 'use NativeCall; nativecast(:(int32, int32 --> int32), Pointer[int64].new(0x1234512345))(1, 2);' 23:45
Xliff You do any more work on live coding, or looking for a missing feature?
timotimo Thread 1 "perl6-m" received signal SIGSEGV, Segmentation fault.
0x0000001234512345 in ?? ()
^^^^^^^^
Xliff O_o 23:46
\o/
Rock on.
timotimo puts a rock on his head 23:47
Xliff :)
timotimo you want to make sure info about casting function pointers lands somewhere you would have looked? 23:52
and no i haven't used the livecoding any more after the hilbert curve a few weeks ago
i should have told m_v_m about the xx operator 23:56
Xliff Yes. I am planning on updating the docs after I get a working use case. 23:57
Thanks.
timotimo sorry that it took me so long to respond
Xliff No worries. Neck deep in another project? 23:58
timotimo moarperf
i would love to reach the grant goal
Xliff Ah. OK. Then I won't keep you any longer. You know where I live. 23:59