»ö« Welcome to Perl 6! | perl6.org/ | evalbot usage: 'p6: say 3;' or rakudo:, or /msg camelia p6: ... | irclog: irc.perl6.org or colabti.org/irclogger/irclogger_logs/perl6 | UTF-8 is our friend!
Set by moritz on 22 December 2015.
gfldex s34n_: as requested: docs.perl6.org/language/typesystem...8method%29 00:12
s34n_ gfldex: thanks 00:17
s34n_ As a little dink around to explore Perl 6, I'm playing with github.com/smcmurray/Mesquite/blob...squite.pm6 00:19
I'm sure it's doing almost everything wrong. But I'd appreciate learning all the things it does wrong and how to do them right.
BenGoldberg s34n_, It looks like your method next clears out the @!middleware array. This means that every time .run is called on your App object, you'll need to repopulate it. 00:30
s34n_ BenGoldberg: right 00:34
s34n_ BenGoldberg: So you could write a PSGI app like github.com/smcmurray/Mesquite/blob...s/app.psgi 00:40
gfldex m: my $sig = :( $a: @b, %c); 00:42
camelia rakudo-moar 373634: OUTPUT«5===SORRY!5=== Error while compiling <tmp>␤Can only use the : invocant marker in the signature for a method␤at <tmp>:1␤------> 3my $sig = :( $a: @b, %c7⏏5);␤ expecting any of:␤ constraint␤»
gfldex any reasons why this might not be a bug? 00:43
s34n_ gfldex: should you be able to alias the invocant on non-methods? 00:44
gfldex i can't alias anything with a Signature instance 00:45
m: my $m = method($a: $b){}; say $m ~~ :($a: $b);
camelia rakudo-moar 373634: OUTPUT«5===SORRY!5=== Error while compiling <tmp>␤Variable '$a' is not declared␤at <tmp>:1␤------> 3my $m = method(7⏏5$a: $b){}; say $m ~~ :($a: $b);␤»
timotimo oh, interesting 00:46
gfldex m: my $m = method m($a: $b){}; say $m ~~ :($a: $b);
camelia rakudo-moar 373634: OUTPUT«5===SORRY!5===␤Can only use the : invocant marker in the signature for a method␤at <tmp>:1␤------> 3= method m($a: $b){}; say $m ~~ :($a: $b7⏏5);␤ expecting any of:␤ constraint␤Other potential difficulties:␤ Useless dec…»
gfldex m: my $m = method ::($a: $b){}; say $m ~~ :($a: $b);
camelia rakudo-moar 373634: OUTPUT«5===SORRY!5=== Error while compiling <tmp>␤Unable to parse expression in indirect name; couldn't find final ')' ␤at <tmp>:1␤------> 3my $m = method ::($a:7⏏5 $b){}; say $m ~~ :($a: $b);␤ expecting any of:␤ colon pair␤»
timotimo yeah, a free-standing signature is a bit different from a signature on an explicit sub
gfldex m: my $m = method ($a: $b){}; say $m ~~ :($a: $b);
camelia rakudo-moar 373634: OUTPUT«5===SORRY!5=== Error while compiling <tmp>␤Can only use the : invocant marker in the signature for a method␤at <tmp>:1␤------> 3 = method ($a: $b){}; say $m ~~ :($a: $b7⏏5);␤ expecting any of:␤ constraint␤»
gfldex grabs a rakudobug form 00:47
s34n_ gfldex: can you walk me through $m ~~ :($a: $b); ? 00:49
starting with :($a: $b) ?
gfldex :() is a Signature literal, see docs.perl6.org/type/Signature 00:50
(reading /type/Signature.pod6 should be mandatory)
timotimo yeah, probably 00:51
s34n_ remembering what you read might also be helpful :)
s34n_ To be honest, I'm still confused at the difference between object types Method, Routine, and Sub 00:58
Subs can be used as methods
Methods can be created outside Classes 00:59
m: say sub{}.WHAT 01:00
camelia rakudo-moar 373634: OUTPUT«(Sub)␤»
s34n_ m: say {'hi'}.WHAT
camelia rakudo-moar 373634: OUTPUT«(Block)␤»
s34n_ neither Sub nor Method define any methods of their own? They both inherit from Routine? They have no other roles or mixins, etc? 01:05
timotimo methods mostly gain their magic by being returned from the find_method metaobject method 01:06
s34n_ I get defining them with different keywords inside a Class. But why make them different classes themselves? 01:07
timotimo method derives from routine, but has its own method gist, it seems like 01:09
s34n_ BenGoldberg: As a Plack app, exhausting @!middleware will cause problems between requests, won't it? 01:11
BenGoldberg That's what I was thinking... I think you want a for loop, instead of repeatedly shifting. 01:12
s34n_ timotimo: doesn't gist come from Mu?
BenGoldberg Something like, for @!middleware -> $n { self.&$n() } 01:13
timotimo yeah, it should be defined in Mu
but Method also has it
s34n_ BenGoldberg: thanks. Actually, I don't want a for loop because I want each middleware to be able to call next
timotimo if you have a for loop, each middleware can just "next" 01:13
s34n_ timotimo: please explain the for next thing 01:15
timotimo well: next, last, redo, ... those are all control exceptions 01:16
i.e. they travel up the stack; they are dynamically scoped
and the for you have for your middlewares can react to that
s34n_ run() returns a sub. Each time that sub is invoked, I want next() to start from the beginning of @!middleware 01:19
s34n_ timotimo: so I have to put a for loop in run, somehow? 01:21
gfldex s34n_: there are a few traits that only work on methods, they are MMDed via trait_mod:<is>(Routine:D \m, :$foo)
s34n_: there are quite a few things in the compiler that check for Routine:D 01:22
err Method:D
timotimo huh, next will start from the beginning of @!middleware? 01:23
not really what "next" would let you do, i think
s34n_ timotimo: for @!middleware {.next} instead of just $.next ? 01:24
timotimo uuuh
sorry, i don't know enough about your use case to answer that
also, that doesn't look like what i wanted to suggest
s34n_ timotimo: how does next travel up the stack? 01:25
actually, nm, I don't want that, I think
timotimo m: sub something { say "something."; next }; for ^10 { say "before $_"; something(); say "after $_" }; say "done"
camelia rakudo-moar 373634: OUTPUT«before 0␤something.␤before 1␤something.␤before 2␤something.␤before 3␤something.␤before 4␤something.␤before 5␤something.␤before 6␤something.␤before 7␤something.␤before 8␤something.␤before 9␤something.␤done␤»
timotimo you see how it doesn't output any "after" lines? 01:26
s34n_ yes 01:27
I don't understand why 01:28
timotimo it's dynamic
the for loop installs a handler, like a CATCH would
s34n_ oh. yeah. I see it. hmm 01:30
yeah. that's not what I want, because I want to process more after next(). I want to yield to next, then continue. 01:32
timotimo OK
s34n_ yield to the next midlleware, I mean
can next() determine the identity of the caller, then find the index of that caller in @!middleware? 01:35
s34n_ nm. bad idea 01:39
gfldex m: sub one-arg (@) { }; use MONKEY-SEE-NO-EVAL; EVAL 'one-arg(5, 6, 7);'; CATCH { when X::TypeCheck::Argument { put .^name } }; say 'alive' 01:43
camelia rakudo-moar 373634: OUTPUT«X::TypeCheck::Argument+{X::Comp}␤»
gfldex any way to get the alive? 01:44
geekosaur m: sub one-arg (@) { }; use MONKEY-SEE-NO-EVAL; EVAL 'one-arg(5, 6, 7);'; CATCH { when X::TypeCheck::Argument { put .^name; resume; } }; say 'alive' 01:45
camelia rakudo-moar 373634: OUTPUT«5===SORRY!5=== Error while compiling <tmp>␤Undeclared routine:␤ resume used at line 1. Did you mean 'rename', 'reduce'?␤␤»
geekosaur whoops
gfldex geekosaur: that would be .resume, if you could resume compile time exceptions 01:46
geekosaur yeh
m: sub one-arg (@) { }; {use MONKEY-SEE-NO-EVAL; EVAL 'one-arg(5, 6, 7);'; CATCH { when X::TypeCheck::Argument { put .^name; .resume } } }; say 'alive' 01:47
camelia rakudo-moar 373634: OUTPUT«X::TypeCheck::Argument+{X::Comp}␤Too many positionals passed; expected 1 argument but got 3␤ in sub one-arg at <tmp> line 1␤ in block <unit> at EVAL_0 line 1␤ in block <unit> at <tmp> line 1␤␤»
geekosaur derp
m: sub one-arg (@) { }; {use MONKEY-SEE-NO-EVAL; EVAL 'one-arg(5, 6, 7);'; CATCH { when X::TypeCheck::Argument { put .^name } } }; say 'alive'
camelia rakudo-moar 373634: OUTPUT«X::TypeCheck::Argument+{X::Comp}␤alive␤»
timotimo s34n_: when handling the "next" control exception, it can grab a stacktrace and inspect things that way 01:50
gfldex geekosaur: thanks 01:55
s34n_ better?: github.com/smcmurray/Mesquite/blob...squite.pm6 02:10
BenGoldberg: I think that ^^ should fix the middleware exhaustion 02:11
BenGoldberg It looks like it should work. 02:16
s34n_ To use the Plack stuff I would need to Inline::Perl5? 02:20
and I need a unit module declaration, right? 02:24
s34n_ or not? 02:37
s34n_ docs.perl6.org/language/modules.ht...ng_Modules isn't really clear on whether I should actually declare a module with the 'module' keyword 02:38
dalek c: 22408a8 | (Wenzel P. P. Peppmeyer)++ | util/extract-examples.p6:
allow to provide individual files for extraction
02:44
doc: 13745bf | (Wenzel P. P. Peppmeyer)++ | util/extract-examples.p6:
doc: make calculations with abspath
s34n_ found Crust. Does it have traction as a successor to Plack? 03:03
s34n_ when I sudo panda install whatever, I get 'Found no writable directory into which panda could be installed' 03:34
holyghost why do you sudo ? 03:43
s34n_ because I thought it would install into system directories that require privs 03:44
but I did try without sudo, too, and got a different error 03:45
holyghost Try to install perl6 in $HOME
then you don't have such problems
change the prefix in your install script to /Users/s34n or /home/s34n 03:46
piece of cake
ubumtu ? 03:47
s34n_ fedora
holyghost ok, do you need an install script ? 03:48
s34n_ so panda doesn't have a fixed location for installing modules? it's relative to p6's install location?
holyghost yes
you need panda and .../install/perl6 in your $PATH
s34n_ I'm using perl6 from stock fedora repo right now
holyghost but it tells you so
which for now is no good 03:49
s34n_ I have both in my path
holyghost wait a minute, I'll try something
s34n_ without sudo I got "moar: src/gc/collect.c:537: MVM_gc_collect_free_nursery_uncopied: Assertion `item->sc_forward_u.forwarder != ((void *)0)' failed." 03:50
looks like this is a pre-Christmas release of perl6 03:51
So I guess I better ditch the repo version
is panda recommended over zef? 03:52
holyghost_ Does the link work ? 03:52
In that script change prefixes of perl6 03:53
webstrand s34n_: Is it? my impression was that panda was dead, and zef was its successor
holyghost_ a prefix is an install dir
holyghost_ so chmod 744 get_rakudo.sh as your common user 03:54
then run it
with argument 2016 04 and you have post-Xmas perl6
s34n_ holyghost_: what link?
holyghost_ gomez.yellowcouch.org/get_rakudo.sh 03:55
it's atext file
s34n_ holyghost_: no offense, but I'm pretty reluctant to run shell scripts downloaded off the internet
holyghost_ just read it then 03:56
gfldex panda is still shipped with Star but may be replaced with the next release.
holyghost_ It comes from the perl6 mailing list that's all
s34n_ I know I'm pretty ignorant. I admit that I have no idea what yellowcouch is or why I should trust them..
holyghost_ it's my server
Do you want me to give you the link in the mailing list archives or something ? 03:57
anyway, try installing perl6 yourself 03:58
else noone can be of much use here
this is a channel for current perl6 :-/
s34n_ holyghost: I got it. give me a minute 03:59
holyghost ok
I am no evil cracker but that script is pretty nifty 04:00
s34n_ holyghost: without arguments 2016 04, do I get 201607? 04:01
holyghost I don't know
try 04
07 in development versiob
*07 is devel version I mean
It changes too much to do any actual work 04:02
gfldex since the last release at least 20 bugs where fixed. You may do better fetching rakudo from github. 04:04
holyghost true 04:05
s34n_ gfldex: last release being 2016.07? 04:23
why is it downloading and installing Template::Mojo? 04:26
and DBIish...? 04:27
holyghost s34n_: if you mean the script, it installs several base mdules
so panda works better
s34n_ why are those base modules?
oh
holyghost your panda is installed from source, then it just updates itself, it's not the script but the install of rakudo 2016 04 04:28
no worries about it
s34n_ ya. I understood that
I was just wondering why those would be part of the base install 04:29
holyghost perl6 hackers :-)
s34n_ um.. mysql?
Pg? 04:30
holyghost I don't know, many things you need for further installation as I said
s34n_ just part of DBIish?
holyghost mysql, and PostGres
s34n_ mysql and Pg are not small things
holyghost yes
it's just a .pm6 text file 04:31
AFAIK these things are available on your system
CStructs 04:34
s34n_ does zef update itself?
holyghost no idea
s34n_ holyghost: no panda 04:41
holyghost set you $PATH
s/you/your 04:42
it tells you at the end
\/install dir blurb 04:43
s34n_ holyghost: thanks 04:53
holyghost np
Now you can hack
s34n_ hmm. it looks like install of HTTP::Server::Tiny fails because its tests fail. 05:00
jeek This guy fucks!
dalek k-simple: 8a6d92a | (Jonas Grabber)++ | / (3 files):
Fix DLL bundling by using %?RESOURCES
05:57
k-simple: 64ffdab | jgrabber++ | Build.pm:
Interpolate ALL the $f ile variables
k-simple: 0920f5f | jgrabber++ | appveyor.yml:
Fix and extend Appveyor CI

Fixes Appveyor builds and also builds with latest moar. Zef is used instead of panda to build Build.pm before testing. Running zef with '--debug' to be more verbose.
k-simple: f6e5990 | azawawi++ | / (4 files):
Merge pull request #59 from jobegrabber/fix-appveyor-builds

WIP: Fix appveyor builds
05:58
k-simple: 4e6eb61 | (Jonas Grabber)++ | / (3 files):
Fix DLL bundling by using %?RESOURCES
06:02
k-simple: 17518de | jgrabber++ | Build.pm:
Interpolate ALL the $f ile variables
k-simple: 7b29e8c | azawawi++ | /:
Merge pull request #56 from jobegrabber/fix-dll-bundling

Fix DLL bundling by using %?RESOURCES
pmurias konobi: re the moving us up to ecmascript 6/etc. branch, it still should be possible to compile that down to ecmascript 5 without loosing (significant) performance? 08:16
yoleaux 30 Jul 2016 23:09Z <konobi> pmurias: yeah, there seems to be some mismatch between the code-ref.js and the Operations.nqp
smls "Zero to the zeroeth power" seems inconsistent between Complex and other numeric types: rosettacode.org/wiki/Zero_to_the_ze...wer#Perl_6 09:06
Is that a problem?
TEttinger what's the square root of i? 09:08
smls Compare the Perl 5 and Python results, where (0+0i) ** (0+0i) == (1+0i)
psch www.wolframalpha.com/input/?i=(0+0i)+**+(0+0i)
TEttinger is that i to the i, psch?
oh nvm 09:09
smls psch: Right, there seems to be disagreement among mathematicians whether 0**0 is 1 or undefined. 09:09
But whatever Perl 6 chooses, it should be the same for all Numeric types, no? 09:10
psch ah
well, if there's no striking maths reason why Complex should be different, i'd agree 09:11
i don't know of any such reason, but i'm also definitely no maths buff :)
psch well, it has been like that since 2011-12-12 apparently 09:20
and it's hardcoded, so probably easy to change if we were so inclined 09:22
smls m: say (0+0i) ** 0 09:28
camelia rakudo-moar 373634: OUTPUT«NaN+NaN\i␤»
smls ^^ also interesting...
TEttinger m: say (0+1i) ** (0+1i) 09:39
camelia rakudo-moar 373634: OUTPUT«0.207879576350762+0i␤»
TEttinger wasn't expecting that
smls I wrote up an RT for this: rt.perl.org/Ticket/Display.html?id=128785 10:00
ufobat m: my $w = (Buf.new(66), Buf.new(67)).reduce: sub {$^a.decode ~ $^b.decode}; $w.WHAT.say 11:11
camelia rakudo-moar 6972d5: OUTPUT«(Str)␤»
ufobat m: my $w = (Buf.new(66,67)).reduce: sub {$^a.decode ~ $^b.decode}; $w.WHAT.say
camelia rakudo-moar 6972d5: OUTPUT«(Buf)␤»
ufobat :-(
psch m: my $w = (Buf.new(66,67)).reduce: sub ($a, $b = Buf.new()) {$a.decode ~ $b.decode}; $w.WHAT.say 11:12
camelia rakudo-moar 6972d5: OUTPUT«(Buf)␤»
ufobat I could add a Buf.new() to the list and then i would get a String.. but thats not elegant at all 11:16
psch ufobat: why is the default i demonstrated not good enough? 11:17
ufobat: you're reducing a one element list with a 2-ary function otherwise
ufobat well, first i am looking for the Str 11:18
psch oh right
i didn't actually help
sorry, nevermind :)
ufobat and when i do
m: my $w = (Buf.new(65)).reduce: sub {$^a ~ $^b}; $w.say
camelia rakudo-moar 6972d5: OUTPUT«Buf:0x<41>␤»
ufobat its working fine even with your $b = Buf.new()
i will do it in 2 steps, first reducing, then .decode 11:19
psch m: sub f($, $) { die }; (1).reduce: &f
camelia ( no output )
psch m: sub f($, $) { die }; (1,).reduce: &f
camelia ( no output )
psch m: sub f($, $) { die }; (1,2).reduce: &f
camelia rakudo-moar 6972d5: OUTPUT«Died␤ in sub f at <tmp> line 1␤ in block <unit> at <tmp> line 1␤␤»
ufobat it seems that there is no need to reduce a list with less then 2 elements 11:20
psch i don't know if there's no need, but we definitely don't even call the reducer on a single element or a one-element list 11:21
"return op.count <= 1 ?? op.(first) !! first if second =:= IterationEnd;" is what we do in METAOP_REDUCE_LEFT 11:25
m: (sub ($,$) { }).count.say
camelia rakudo-moar 6972d5: OUTPUT«2␤»
psch so, yeah, first is the single element, second is IterationEnd, the reducer is 2-ary, so we get first back
...probably sensible
m: (sub ($,$?) { }).count.say 11:26
camelia rakudo-moar 6972d5: OUTPUT«2␤»
psch m: (sub ($,$?) { }).arity.say
camelia rakudo-moar 6972d5: OUTPUT«1␤»
psch hm, or should that actually be .arity and not .count?
so we could reduce a one-elems list with a sub that takes two args but has one with default..?
moritz we could. Not sure it#s a good idea 11:32
psch well, it's consistent across 2-county and more-county reducers at least 11:34
and, well, reducing a single-element-list is kind of a thinko i guess
smls psch: Wouldn't it be a little confusing since the optional element has to be the second one in the signature... 11:37
...whereas the identity element should come *before* the first real element? 11:38
ufobat Private multi-methods are not supported <- why? 11:40
psch smls: maybe? i don't have that much inside into reduce as an algorithm, i was mostly just poking at the source to see how we do what we do 11:42
s/inside/insight/
ufobat it seems that there is no need to reduce a list with less then 2 elements 11:59
oups!
wrong terminal, i am sorry!
moritz ufobat: re private multis: because nobody implemented them yet 12:00
ufobat i miss them :-)
moritz ufobat: submit a patch!
santhosh_k What is pod2onepage? How do I install that command?
moritz santhosh_k: I've never heard of that 12:01
santhosh_k: where did you come across a reference to that?
ufobat erlangen.pm perl6 workshop topic: writing a patch for private multi methods
;p 12:02
santhosh_k When I ran "make html" inside the source code from "github.com/perl6/doc" , I got the error message pod2onepage command not found.
santhosh_k moritz, Exactly in this file: github.com/perl6/doc/blob/master/Makefile 12:05
dalek sectbot: 4f3a756 | (Daniel Green)++ | benchable.pl:
Add --no-merges to the git bisecting when "zoom"ing in on performance changes

There may be a better way to handle merges and the commit history, but at least for now this prevents the bisect from going back in time
12:23
tbrowder back on p6 marketing: how about another bold-face category at bottom-right of p6 home page called something like "Active User Projects" to list such things as the (yet to be started) Lego EV3 API 13:00
In that same light, the canonical docs need to be more obvious than just the first in a list of docs. 13:02
lizmat likes the idea 13:05
tbrowder hm, i should have said the main docs page about the canonical docs... 13:20
lizmat regardless, attracting more attention to user projects is a good thing :-)
tbrowder anyway, you get the idea... 13:21
parabolize m: my $w = Buf.new(); $w.^methods.gist.contains('poop').say; $w.poop() 13:49
camelia rakudo-moar 4c773b: OUTPUT«False␤Method 'poop' not found for invocant of class 'Buf'␤ in block <unit> at <tmp> line 1␤␤»
parabolize m: my $w = Buf.new(); $w.^methods.gist.contains('reduce').say; $w.reduce: {$^a.decode ~ $^b.decode}
camelia rakudo-moar 4c773b: OUTPUT«False␤»
pochi m: class Foo { multi method !foo(4) {} } 13:57
camelia rakudo-moar 4c773b: OUTPUT«5===SORRY!5=== Error while compiling <tmp>␤Private multi-methods are not supported␤at <tmp>:1␤------> 3class Foo { multi method7⏏5 !foo(4) {} }␤»
pochi is that "not yet implemented" or "will never implement"? 13:58
lizmat pochi: not sure what jnthn's ideas about that are 14:01
but I would not expect multi private methods any time soon
jnthn private multis are desirable, though implementing them will want a little refactoring in the MOP code to avoid epic code duplication :) 14:32
zacts perl6 is so so cool 14:41
it's beyond cool. it's awesome for sures
TimToady it's pretty okay in spots 14:47
masak I like the "l" in "Perl 6", and the space between the "l" and the "6" 14:50
lizmat
.oO( but will it break? )
14:52
.oO( or will it be a non-breaking space? )
14:56
dalek c: dacb35d | Altai-man++ | doc/Type/Str.pod6:
Delete a non-existent methods documentation due to github.com/perl6/doc/issues/777
15:04
dalek c: ff7e82b | (Wenzel P. P. Peppmeyer)++ | util/extract-examples.p6:
the empty array is undefined and false
15:18
gfldex o.0 15:19
ENEEDMORETEA
despite the bogus commit message it actually works now 15:21
sena_kun Oh, you've fixed it. gfldex++ 15:22
gfldex having automatic test for examples in docs is pretty unpractical at this point because we use code blocks to list routine definitions 15:25
they tend not to have a body or use { ... } what makes rakudo unhappy
also there are some code blocks that are missused to display tabular content 15:28
see docs.perl6.org/language/regexes#Ba...er_classes 15:29
sena_kun If something is misused, we need to fix it anyway. It's easier to do it with test results, than by lurking around the docs. There are many relatively easy problems like "add ';' to all examples" and such. 15:33
pochi m: class Foo { has $.x is required; method foo() { say $.x }; method bar() { say 42 } }; my Foo $a; $a.bar(); $a.foo() 15:57
camelia rakudo-moar fa84f1: OUTPUT«42␤Cannot look up attributes in a type object␤ in method foo at <tmp> line 1␤ in block <unit> at <tmp> line 1␤␤»
sena_kun pochi, you should create an instance. 15:58
pochi but it still kinda worked for bar()
that's some kind of zombie-state? 15:59
or is bar() static?
sena_kun pochi, you can use plain type object to call methods. Lets see...
pochi, docs.perl6.org/language/classtut.h...with_class 16:00
sena_kun pochi, perl6advent.wordpress.com/2013/12/...pe-object/ - this explains your question in details. 16:00
pochi sounds to me like perl6 needs a static keyword 16:02
ugexe because your signature wasn't ::CLASS:D 16:04
and naturally you cant access a required attribute if its not set
even if you are using ::CLASS:U
pochi signature for bar? 16:05
ugexe m: class Foo { has $.x is required; method foo() { say $.x }; method bar(Foo:D:) { say 42 } }; my Foo $a; $a.bar(); $a.foo() 16:10
camelia rakudo-moar fa84f1: OUTPUT«Invocant requires an instance of type Foo, but a type object was passed. Did you forget a .new?␤ in method bar at <tmp> line 1␤ in block <unit> at <tmp> line 1␤␤»
pochi yes! that's what I want! 16:11
why isn't this default?
when would I ever allow to call methods on a type object unless I wanted the method to be static ... 16:12
dalek c: 91812f0 | Altai-man++ | doc/Language/syntax.pod6:
Radix prefixes are now searchable
mst pochi: because perl family languages are traditionally shotgun-free 16:14
pochi yet I managed to shoot myself in the foot :-) 16:15
pmurias is using ecmascript 6 for the nqp-js/rakudo-js runtime sane? 16:19
BenGoldberg That would mean not being able to run inside of Firefox, MS Edge, Netscape. 16:27
Well, I should say, "not being able to run without shims" ;) 16:28
harmil Afternoon all. Is there a simpler way to say "a non-zero unsigned integer parameter that could be passed as any Cool" than sub foo(Cool $i where {.Numeric.narrow ~~ Int and .sign == 1}) {...}' 16:30
pmurias BenGoldberg: doesn't MS Edge and Firefox support ecmascript 6?
harmil I'm finding myself typing that more than I'd like. 16:31
ugexe Cool(Int)? 16:32
BenGoldberg According to en.wikipedia.org/wiki/ECMAScript Edge uses the Chakra engine, which is 5.1 with some features from 6.
pmurias BenGoldberg: does anyone use the pre Firefox Netscape anymore?
BenGoldberg Dunno. I use google chrome :) 16:33
harmil m: sub foo(Cool(Int) $a) { $a.say }; foo(1); foo(0); foo(-1); foo(0.1) 16:35
camelia rakudo-moar fa84f1: OUTPUT«1␤0␤-1␤Type check failed in binding to $a; expected Int but got Rat (0.1)␤ in sub foo at <tmp> line 1␤ in block <unit> at <tmp> line 1␤␤»
harmil It accepts 0 and -1...
ugexe you still have to put the other constraints on it
pmurias BenGoldberg: I also would use by default only those features that can be efficiently shimmed
harmil m: sub foo(Cool $a where {.Numeric.narrow ~~ Int and .sign == 1}) { $a.say }; foo(1); foo(0); foo(-1); foo(0.1) 16:36
camelia rakudo-moar fa84f1: OUTPUT«1␤Constraint type check failed for parameter '$a'␤ in sub foo at <tmp> line 1␤ in block <unit> at <tmp> line 1␤␤»
harmil m: sub foo(Cool(Int) $a where {.sign == 1}) { $a.say }; foo(1); foo(0); foo(-1); foo(0.1)
camelia rakudo-moar fa84f1: OUTPUT«1␤Constraint type check failed for parameter '$a'␤ in sub foo at <tmp> line 1␤ in block <unit> at <tmp> line 1␤␤»
harmil Okay, that's better
ugexe sub foo(Cool(Int) $i where *.sign == 1) 16:37
harmil m: sub foo(Cool(Int) $a where .sign == 1) { $a.say }; foo(1); foo(0); foo(-1); foo(0.1)
camelia rakudo-moar fa84f1: OUTPUT«1␤Constraint type check failed for parameter '$a'␤ in sub foo at <tmp> line 1␤ in block <unit> at <tmp> line 1␤␤»
harmil ugexe: Thanks. There's no way to construct a type that means the same thing, is there? Because the call (foo("1")) is going to search back in the type hierarchy of Str and not find my type, right? 16:41
ugexe subtype, interface roles, etc
harmil ugexe: If I subtype Cool, then foo(MyType $x) can't accept a Str, can it, because Str isa Cool not a MyType... 16:45
ugexe subset PositiveInt of Cool where { .?Int.?sign == 1 };
psch m: Cool.^can('Int')
camelia ( no output )
psch m: Cool.^can('Int').say
camelia rakudo-moar fa84f1: OUTPUT«(Int)␤»
psch ugexe: i don't think you need those question marks
...well, unless i confuse what it means again
m: class A { }; say A.?Int 16:46
camelia rakudo-moar fa84f1: OUTPUT«Nil␤»
harmil m: subset PositiveInt of Cool where { .?Int.?sign == 1 }; sub foo(PositiveInt $a) { $a.say }; foo(1); foo(0); foo(-1); foo(0.1)
camelia rakudo-moar fa84f1: OUTPUT«1␤Constraint type check failed for parameter '$a'␤ in sub foo at <tmp> line 1␤ in block <unit> at <tmp> line 1␤␤»
psch m: sub f(Cool $x where * > 1) { }; f "foo"
camelia rakudo-moar fa84f1: OUTPUT«Cannot convert string to number: base-10 number must begin with valid digits or '.' in '3⏏5foo' (indicated by ⏏)␤ in sub f at <tmp> line 1␤ in block <unit> at <tmp> line 1␤␤Actually thrown at:␤ in sub f at <tmp> line 1␤ in block <uni…»
harmil Yep, that's the stuff
ugexe: thanks! 16:47
psch yeah, definitely clearer with the constraint failure than with X::Str::Numeric
m: say Str.^can('Int') 16:48
camelia rakudo-moar fa84f1: OUTPUT«(Int Int)␤»
psch but yeah, i'm pretty sure you don't need the question marks, because any Cool type has a method Int
it might throw, yes, but that's not what the methodop .? checks for
psch docs.perl6.org/language/operators#postfix_.? 16:49
ugexe yeah, thats more for the Str bit he mentioned although i'm not sure if he wanted the constraint or not (i.e. `subtype PositiveInt where { .?Int.?sign == 1 }`) 16:56
psch m: say "foo".?Int.?sign
camelia rakudo-moar fa84f1: OUTPUT«Cannot convert string to number: base-10 number must begin with valid digits or '.' in '3⏏5foo' (indicated by ⏏)␤ in block <unit> at <tmp> line 1␤␤Actually thrown at:␤ in block <unit> at <tmp> line 1␤␤»
psch ugexe: that's my point, it still throws
ugexe ugh, i wish there was a way to do that instead of .?Int && .Int.sign 16:57
BenGoldberg Could someone tell me what's causing this error:
m: gist.github.com/BenGoldberg1/147f6...aa8ae9c15a
camelia rakudo-moar fa84f1: OUTPUT«5===SORRY!5===␤Function 'say' needs parens to avoid gobbling block␤at <tmp>:7␤------> 3^$!wheel-size.grep: { @!wheel-test[$_] }7⏏5;␤Missing block (apparently claimed by 'say')␤at <tmp>:3␤------> 3my class P does Iterator 7⏏5{␤␤»
psch ugexe: i think you're expecting the .? from C#? 16:58
BenGoldberg m: say Int.?say 16:59
camelia rakudo-moar fa84f1: OUTPUT«(Int)␤True␤»
BenGoldberg m: say "foo".?Int
camelia rakudo-moar fa84f1: OUTPUT«Cannot convert string to number: base-10 number must begin with valid digits or '.' in '3⏏5foo' (indicated by ⏏)␤ in block <unit> at <tmp> line 1␤␤Actually thrown at:␤ in block <unit> at <tmp> line 1␤␤»
BenGoldberg m: my $x = do if "foo".Int -> \ok { ok } else { 0 }; say $x; 17:00
camelia rakudo-moar fa84f1: OUTPUT«0␤»
psch m: ^3.map: *.say 17:01
camelia rakudo-moar fa84f1: OUTPUT«Potential difficulties:␤ Precedence of ^ is looser than method call; please parenthesize␤ at <tmp>:1␤ ------> 3^37⏏5.map: *.say␤WARNINGS for <tmp>:␤Useless use of "^" in expression "^3.map: *.say" in sink context (line 1)␤3␤»
psch BenGoldberg: that ^^^ is an error i would expect
BenGoldberg: not sure where the parser finds a say on line 3 :/
BenGoldberg Me either ;) 17:01
BenGoldberg Ok, I was missing a }, but that was really a less than awesome error message. 17:06
psch ah, the "until @outbuf" wasn't closed, was it 17:07
timotimo you had an unmatched} ?
dalek c/animation-has-gone: d0dfc5a | Altai-man++ | html/js/main.js:
The TOC animation was removed
17:20
cygx ugexe: you're looking for andthen 17:32
m: subset Positive-y of Cool where (.Int andthen $_ > 0); say "foo" ~~ Positive-y; say "0" ~~ Positive-y; say "42" ~~ Positive-y
camelia rakudo-moar fa84f1: OUTPUT«WARNINGS for <tmp>:␤Useless use of ">" in expression "$_ > 0" in sink context (line 1)␤False␤False␤True␤»
psch m: "0" andthen say "foo" 17:34
camelia rakudo-moar fa84f1: OUTPUT«foo␤»
psch m: +"0" andthen say "foo"
camelia rakudo-moar fa84f1: OUTPUT«foo␤»
psch m: subset Positive-y of Cool where { .Int and $_ > 0 }; say "foo" ~~ Positive-y; say "0" ~~ Positive-y; say "42" ~~ Positive-y # huh
camelia rakudo-moar fa84f1: OUTPUT«False␤False␤True␤»
psch oh duh
cygx++ 17:35
travis-ci Doc build passed. Altai-man 'The TOC animation was removed' 17:39
travis-ci.org/perl6/doc/builds/148700280 github.com/perl6/doc/commit/d0dfc5ab6f6f
harmil I was trying to define continuing fractions as a sub-type of Rat (LazyRat: pastebin.com/XfAthmkW) but am running into the strangest thing. Inside of my LazyRat.partial my &.whole-part-op appears to be set to Callable instead of &infix:<+> 17:52
If anyone finds the inspiration to go peering at it and sees my (probably stupid) mistake, I'd be grateful. I have to go visit a friend in the hospital, but I'll check in in a bit. 17:53
tailgate How does one take a List and remove the first element from it? i.e remove the first item from $string.split('') 17:57
MasterDuke tailgate: shiftq 18:00
whoops, that's just 'shift'
and btw, $string.comb will do (nearly) the same things as $string.split('') 18:02
cygx or subscripting with [1..*] if you do not want to modify the original list 18:04
devmikey What is so special about perl6? 18:11
pmurias devmikey: I think the answer is different for everybody interested in the language 18:13
pmurias devmikey: for me it's the attention to detail in all the little things, a hefty bunch of awesome features plus it's something that's fun to work on 18:15
devmikey: do you like Perl 5?
ufobat why is this blocking? gist.github.com/ufobat/9da94ef6d12...04888d5237 i would have expected it differently 18:16
devmikey pmurias: i do like perl 5 for some things, yes 18:20
pmurias devmikey: so the intent of Perl 6 is to preserve the good parts of Perl 5 and get rid of the bad ones and add a bunch of new awesome ones 18:22
AlexDaniel unmatched}: there was also this: www.youtube.com/watch?v=KEal8B_36Ac 18:23
unmatched}: which arguably requires a bit more skill than just getting into the net…
pmurias devmikey: but it's not a Perl 5 replacement (as Perl 5 is not going anywhere soon)
AlexDaniel devmikey: I'd say try it and see yourself 18:24
devmikey I hate it when they try to make languages be Java 18:26
That's what they are doing with php
FROGGS devmikey: Perl 6 does not feel like Java, really :o) 18:29
pmurias devmikey: that's not the direction Perl 6 is going in
devmikey good
FROGGS just as an example: rosettacode.org/wiki/Gray_code#Perl_6 18:32
if you click on the Perl 6 caption you can look at other examples
avar Why is 'say lines + 0' not the same as 'say 0 + lines'? Presumably say has higher precidence? Does perl6 have a -MO=Deparse equivalent? 18:38
Or -MO=Concise|Terse 18:39
BenGoldberg The most java-like aspect of perl6 is that it uses . for calling methods, as opposed to the -> operator of per5. 18:40
cygx avar: lines optionally takes arguments, so the first example gets parsed as `lines(+0)` instead of `lines() + 0` 18:51
pmurias avar: perl6 --target=ast might help 18:52
avar: there doesn't seem to be a -MO=Deparse yet 18:53
ufobat m: my $s = Supplier.new; my $y = $s.Supply; $y.tap(-> $v {$v.say}, done => {say "done"}); $s.emit(42); $s.done; $y.wait' 19:04
camelia rakudo-moar fa84f1: OUTPUT«5===SORRY!5=== Error while compiling <tmp>␤Two terms in a row␤at <tmp>:1␤------> 3 "done"}); $s.emit(42); $s.done; $y.wait7⏏5'␤ expecting any of:␤ infix␤ infix stopper␤ statement end␤ statement modif…»
ufobat m: my $s = Supplier.new; my $y = $s.Supply; $y.tap(-> $v {$v.say}, done => {say "done"}); $s.emit(42); $s.done; $y.wait 19:05
camelia rakudo-moar fa84f1: OUTPUT«(timeout)42␤done␤»
jnthn ufobat: $y.wait is a fresh and independent tapping of the Supply, which comes after the done and so won't see it. 19:08
jnthn (thus the timeout) 19:09
ufobat and the same here? 19:10
m: my $s = Supplier.new; my $y = $s.Supply; $s.emit(42); $s.done; say $y.list.reduce({$^a ~ $^b})
camelia rakudo-moar fa84f1: OUTPUT«(timeout)»
jnthn Yup 19:11
ufobat if a method gets passed a Supply, and i have no control of the Supplier, and i dont know if he has called .done yet?
gfldex ENODALEK 19:12
jnthn In general you don't know whether any supply you're given is infinite or finite 19:13
You can ask if it's live or on-demand
The use cases for live supplies tend to be infinite ones
But stepping back a little further, generally turning a supply (an async thing) into a synchronous thing is something you should be doing very rarely. 19:15
b2gills m: my $s = Supplier.new; my $y = $s.Supply; $y.tap(-> $v {$v.say}, done => {say "done"}); $s.emit(42); my $p = $y.Promise; sleep 1; $s.done; sleep 1; say $p.status 19:16
camelia rakudo-moar fa84f1: OUTPUT«42␤done␤Planned␤»
ufobat so basically i shouldn't use a supply for this scenario?
jnthn The example is way too far abstracted from a real problem for me to be able to suggest what to use or not :)
ufobat the Real World example is p6w 19:17
github.com/zostay/Smack/blob/maste...k.pm6#L167
i can not read from my $connection within the supply {} because of the threadcontext
and i can not use a Supplier, emit all values in this thread, call $supplier.done and get all the values in my webapp 19:18
ufobat i am not sure, but i have a feeling that it's hard or not possible to do p6w with supplies in a non multithreaded way 19:20
jnthn Surely it is, but IO::Socket::Async would be a much more natural starting point. 19:22
Since it's already thread-agnostic and spits data out on a Supply
gfldex sena_kun: problem solved: github.com/perl6/doc/commit/96acaf...b066aae472 19:23
ufobat yeah but then it is multithreaded, isnt it? (which would be better, of course)
zostay just a note that anything smack does currently is not intended to show what is a good way... just an initial JFDI to get started with the handful of tests currently written 19:24
jnthn Yes, as soon as you're using IO::Socket::Async your app is multi-threaded.
Note however that supply/react blocks include doing concurrency control :) 19:25
zostay P6W assumes multi-threading at its heart
sena_kun gfldex, oh, neat. I can use emacs macro to do easy work for test passing, such commits can be pushed into master directly, I suppose?
gfldex sena_kun: yes
ufobat zostay, i am not sure wether it is impossible to do it in a singlethreaded way, if so, souldn't it removed from the spec 19:26
sena_kun gfldex, good.
zostay which part needs to be removed?
ufobat setting 'p6w.multithread' to false? 19:27
jnthn back later
ufobat thank for your help jnthn :) 19:28
zostay p6w.multithread = False does not mean the server is not multithreaded, it's more of a promise that the application won't be run in multiple threads, which might be a server setting admits could set for apps that handle concurrency poorly 19:29
pmurias .tell konobi I'm applying your refactoring piece by piece as there was a bit of things that where breaking stuff and also I prefer run the tests after relatively small changes rather then debug complex interactions 19:31
yoleaux pmurias: I'll pass your message to konobi.
zostay s/admits/admins/ # butterfingers 19:31
ufobat zostay, i c :) 19:33
kalkin-_ why does sub MAIN('foo', :$bar, Bool :$verbose) { say Foo if $verbose; }. Doesn't mach .perl6 bar.pm6 foo foo --verbose? 21:15
Aehm 21:16
Doesn't match perl6 bar.pm foo --verbose
If i execute perl6 bar.pm6 --verbose foo. I get the error: Unexpected parameter verbose passed
--help shows me: foo.pm6 [--bar=<Any>] [--verbose] foo
masak kalkin-_: I get "Undeclared name: Foo" 21:17
kalkin-_ which actually is not what I expect to see. I expect foo.pm6 foo [--bar=<Any>]....
masak: of course say "Foo"
masak kalkin-_: right
kalkin-_ I have to many Foos in my example :) 21:18
masak kalkin-_: when I fix that, it works here
kalkin-_: `perl6 bar.pm6 --verbose foo` works
kalkin-_ masak: perl6 --version?
masak This is Rakudo version 2016.07.1-94-gfa84f13 built on MoarVM version 2016.07-3-gc01472d
kalkin-_ ups 20.16.06 21:19
geekosaur might also have to watch out for wrappers
Zoffix buggable, rt 21:23
buggable Zoffix, TOTAL: 1355, UNTAGGED: 611, BUG: 414, LTA: 90, JVM: 62, NYI: 32, SEGV: 28, UNI: 25, RFC: 24, PERF: 19, POD: 14, CONC: 11, @LARRY: 10, TODO: 9, PRECOMP: 8, GLR: 6, BUILD: 5, STAR: 4, WEIRD: 3, LTA ERROR: 3, MOARVM: 2, OSX: 2, FEATURE REQUEST: 1, CPP: 1, SPEC: 1, LIST: 1, LHF: 1, SPESH: 1, DOCS: 1, NATIVECALL: 1 Details: bug.perl6.party/1470000217.html
Zoffix buggable, rt RFC
buggable Zoffix, Found 21 tickets tagged with RFC. Details: bug.perl6.party/1470000228.html
Zoffix plans to add search later on 21:24
kalkin-_ Hmm I changed to Rakudo version 2016.07.1 built on MoarVM version 2016.07, but still same issue, hmm.. 21:25
kalkin-_ perl6 bar.pm6 foo --verbose just prints out usage 21:26
ugexe what exactly are you trying? you showed both foo --verbose and --verbose foo
kalkin-_ ugexe: well both don't work 21:27
ugexe that doesnt help anyone map your error to what you actually did
kalkin-_ just a second
this is the code gist.github.com/kalkin/579dd6973c8...1e64a3c859 21:28
ugexe `say :$verbose` 21:29
s/://
kalkin-_ ompf. Thanks! 21:30
But still ./mycode foo --verbose doesn't work 21:31
I just get the usage
ugexe it has to be named before positional 21:31
--verbose foo
kalkin-_ ugexe: why? I mean I understand if this is needed in Perl6 code, but why when parsing args from shell? 21:32
Is this a bug, a feature or do I misunderstand some thing important? 21:33
ugexe its designed that way 21:34
kalkin- This design decision complicates writing git like commands 21:34
ugexe so dont use the built in getopts 21:35
gfldex kalkin-: the code that is handling mapping MAIN and command line arguments is incomplete and you are more then welcome to fix it. In the mean time you can use Getopt::Long to handle special cases. 21:36
ugexe gfldex: a PR already exists 21:37
github.com/rakudo/rakudo/pull/688
kalkin- gfldex: this is more what i wanted to hear. I already know where everything is happening. will look into that
ugexe afaik its a decision by TT
kalkin- ohh there are already patches for that 21:38
gfldex having named arguments before positionals is a good default because it plays well with alias
ugexe right. its working as designed right now. its up to TT if it should change
kalkin- gfldex: how do aliases work is this documented some where?
gfldex kalkin-: ss64.com/bash/alias.html 21:39
kalkin- ohh you mean like shell alias
i thought there is a way to specify alias for the parameters read in from the shell
Would be nice to know why TT has so strong opinion about that 21:41
ugexe not all OS use gnu style argument handling 21:42
like bsd
geekosaur because you can't write something sudo-like if you force gnu permute
kalkin- geekosaur: afaik you can always use -- 21:43
geekosaur oh, and you will simplify part of your git-like while breaking other parts if you auto-permute
uyes, you can insist that every sensible usage mode requires --
haskell's tooling does that. ALWAYS have to write cabal exec -- ... or stack exec -- ...
because it does the wrong thing otherwise 21:44
becase, like you, it thinks permute is the only correct way
gfldex kalkin-: the problem is that the change can alter external behaviour of programs. Since we don't know yet how we handle versioning of the language, this change was put on hold.
kalkin- geekosaur: correcty me if i'm wrong, but don't bsd style tools have no long option? (looking at sudo(8) right now)
geekosaur not always true, and in any case gnu style permutes short options as well 21:45
kalkin- geekosaur: yeah that's true
geekosaur bsd just doesn't come with a standard long options function
ugexe its like saying gnu doesnt use --/ 21:46
kalkin- I think I understand the issue
geekosaur consider x11 core programs, many of which predate gnu by some 20 years. in particular consider xterm -e ...
kalkin- hmm i always have to guess that if I put double quote around or do -- or if both works 21:47
geekosaur well, 10 years at least. which is why they do -long_option
b2gills You can modify @*ARGS in the mainline to get it to work like you want it, but it is error prone
kalkin- how does git gets around this problem? As far as I know git allows this kind of options 21:49
IMHO I never had an issue during scripting git
geekosaur I think the main command parser just looks for the first non-option and then checks if it's an external command; at that level it accepts no options at all, so it can just pass the whole mess off. 21:50
if they ever find a need to change that, things will become... entertaining
gfldex lolibloggedalittle: gfldex.wordpress.com/2016/08/01/wa...the-flats/ 22:19
kalkin- Is there something like setup_hooks (Python) in Perl6? setup_hooks allow specifying some key in setup.py for which all installable python modules can register. This simplifies writing stuff for which other people can develop plugins 22:27
MasterDuke gfldex: nice. this bit is a little awkward though: "what includes changes in halve a years time." 22:28
the end should be "half a year's time."
masak gfldex: s/deconstruction/destructuring/
also, `flat` is not a metaop, it's a listop 22:29
gfldex masak: that's not what I meant and hope the added comma helps 22:30
masak it does 22:31
timotimo i'm incredibly lucky 22:32
it's not my laptop that's b0rked, it's my PSU thingie
timotimo and i have something like a replacement 22:32
gfldex the map is slowly filling up: imgur.com/a/DbbM7 23:53