»ö« 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.
00:00 djbkd joined 00:01 WAAM811 joined 00:04 Matthew[m] left, ilmari[m] left, tadzik left, Matias[m] left, scott left, M-Illandan left 00:13 djbkd left 00:14 MasterDukeLaptop joined 00:15 djbkd joined 00:16 itaipu joined 00:22 Juerd_ joined 00:27 djbkd left, djbkd joined 00:33 Juerd_ is now known as Juerd, Xliff joined
Xliff \0 #perl6 00:34
Oh my word, the Luke Cage show is awesome. Only watched ep 1
But it was guuud
00:35 mcmillhj left 00:37 RabidGravy left 00:41 djbkd left 00:43 zakharyas joined, kent\n left 00:44 mempko left 00:45 djbkd joined 00:52 wamba left 00:57 djbkd left 00:58 djbkd joined 01:00 grondilu left 01:10 djbkd left 01:15 djbkd joined 01:21 Dunearhp left 01:24 eliasr left 01:28 djbkd left 01:32 itaipu left 01:33 djbkd joined 01:34 itaipu joined 01:42 mcmillhj joined 01:46 ilbot3 left 01:47 ilbot3 joined 01:49 djbkd left 01:51 baest left 01:52 djbkd joined, mcmillhj left 01:53 baest joined, ilmari[m] joined 01:57 AlexDaniel left 02:02 user9 left 02:03 noganex_ joined 02:06 pierre_ joined
seatek eeuw. perl6 --doc output is ... flat 02:06
02:07 djbkd left, noganex left 02:10 djbkd joined 02:14 bstamour joined
dalek c: 09662f5 | (Tom Browder)++ | doc/Language/grammars.pod6:
add missing results for examples
02:17 djbkd left, bstamour left 02:18 bstamour joined 02:19 bstamour left 02:20 bstamour joined, djbkd joined 02:23 labster left 02:34 djbkd left 02:40 djbkd joined 02:41 sufrostico left 02:48 nadim left 03:03 rgrinberg joined 03:07 BenGoldberg left 03:08 pierre_ left, MasterDukeLaptop left 03:09 pierre_ joined 03:13 pierre_ left 03:47 djbkd left 03:53 djbkd joined 04:10 djbkd_ joined, pierre_ joined 04:11 itaipu left 04:13 djbkd left 04:17 pierre_ left 04:30 Zoffix joined, Zoffix left 04:41 canopus left 04:46 canopus joined 04:50 kaare_ joined 04:58 Cabanossi left 05:01 Cabanossi joined 05:36 wamba joined 05:49 skids left 06:14 pierre_ joined, canopus left 06:16 domidumont joined 06:19 pierre_ left 06:20 domidumont left, rgrinberg left 06:21 tadzik joined, Matias[m] joined, M-Illandan joined, scott joined, Matthew[m] joined, domidumont joined 06:22 canopus joined 06:28 domidumont left 06:37 djbkd_ left 06:41 TEttinger left, djbkd joined 06:44 seatek left 06:49 setty1 left 06:53 setty1 joined 06:55 wamba left 06:59 djbkd left 07:01 djbkd joined 07:02 pierre_ joined 07:04 pierre_ left 07:12 darutoko joined 07:19 pierre_ joined, domidumont joined 07:22 pierre_ left 07:24 pierre_ joined, pierre_ left, buggable left 07:27 robertle joined 07:30 pierre_ joined 07:43 pierre_ left 07:45 imcsk8 joined 07:51 FROGGS joined
FROGGS o/ 07:53
psch o/ 07:54
08:11 domidumont left 08:12 domidumont joined 08:20 labster joined 08:22 rindolf joined 08:24 pmurias joined 08:51 domidumont left 08:54 domidumont joined 08:57 nadim joined 08:59 domidumont left 09:21 Dunearhp joined, Dunearhp left 09:42 RabidGravy joined 09:47 pierre_ joined 09:48 mniip joined 09:52 kurahaupo left 09:56 FROGGS left 09:57 shadowpaste left 09:59 aindilis left 10:00 aindilis joined
RabidGravy boom! 10:04
10:09 pierre_ left 10:10 domidumont joined 10:17 grondilu joined 10:21 labster left 10:22 pecastro left, pecastro joined 10:41 mcmillhj joined 10:46 iH2O joined, mcmillhj left 10:48 iH2O left, domidumont left 10:51 wamba joined 10:55 zakharyas left, zakharyas joined 10:56 MARTIMM joined
grondilu wonders why `prove` doesn't accept `plan *` 10:59
or rather prove -e perl6
11:00 zakharyas left
psch grondilu: isn't it Test.pm should would have to support it? also, what is it supposed to mean? afaik TAP supports either a fixed number of tests or done_testing 11:07
where "done_testing" means a message over the protocol that all tests have been executed
grondilu psch: yes, it's about Test.pm, my bad. 11:08
11:09 pierre_ joined
grondilu and what I meant is that if I do : $ PERL6LIB=lib prove -e perl6 t/, it will fail with 'no plan' if one of the test files has 'plan *' 11:10
psch m: use Test; say plan *
camelia rakudo-moar 46e0ed: OUTPUT«1475320238.58462␤»
psch m: use Test; say (plan *).WHAT
camelia rakudo-moar 46e0ed: OUTPUT«(Num)␤»
psch i actually don't know what &plan returns
grondilu forcing me to manually count the tests I do in the file and put the actual count in the plan. 11:11
11:11 pierre_ left
psch m: use Test; ok 1; ok 1; ok 1; done-testing 11:11
camelia rakudo-moar 46e0ed: OUTPUT«ok 1 - ␤ok 2 - ␤ok 3 - ␤1..3␤»
psch grondilu: that's what done-testing is for
grondilu oh, ok. I did not know that done-testing was a thing. 11:12
psch++ thanks 11:13
grondilu will have to read S24 again one day 11:14
miniPerl, a Turing-complete subset of Perl compiling to javascript: 11:15
11:16 Khisanth left
psch grondilu: fwiw, 'plan *' is equivalent to no &plan call and you can use it the same, i.e. with &done-testing 11:17
which might be a good idea for explicitness
11:21 itaipu joined 11:23 djbkd left 11:26 djbkd joined 11:29 Khisanth joined 11:34 grondilu left 11:35 andrzejku joined 11:39 djbkd left, andrzejku left 11:40 andrzejku_ joined, andrzejku_ left, andrzejku joined 11:41 andrzejku left, djbkd joined 11:45 pierre_ joined 11:47 andrzejku joined 11:48 andrzejku left, pierre_ left 11:49 andrzejku joined, andrzejku left 11:50 andrzejku joined, itaipu left 11:52 domidumont joined, djbkd left 11:56 djbkd joined, grondilu joined
pmurias grondilu: you want to grow miniPerl into something bigger or will it stay in it's current lambda calculus form? 11:57
grondilu I want to try anyway 11:58
pmurias grondilu: have you looked at the nanopass compilers? 11:59
grondilu no
12:00 pierre_ joined 12:02 kaare_ left, domidumont left
pmurias it's in scheme but they seem to be using the have a bazillion intermediate languages/passes approach you where proposing 12:03
grondilu yeah, I've just read the description and indeed that looks like what I was talking about. 12:04
I know close to nothing about Scheme, though.
pmurias has only used it for writing gimp extensions 12:05
(a long time ago)
12:05 shadowpaste joined
grondilu I can extend grammars in Perl 6, can't I? So I guess I can stick to perl. 12:05
pmurias having the intermediate expressions in tree/s-expr for seems much more saner then having them textual 12:06
grondilu did not think about using s-expr 12:07
12:08 djbkd left 12:10 djbkd joined
pmurias grondilu: is your goal more to explore the multi pass idea or get a perlish language that compiles to javascript? 12:12
grondilu honestly I don't quite understand how they work. For instance what is the s-expr for sub {}() ?
pmurias: both
or rather, a perlish language that compiles to lambda-calculus.
12:14 KotH is now known as Gandalf 12:15 Gandalf is now known as KotH
tbrowder good morning (US CDT), #perl6, anyone awake? 12:18
timotimo greetings tbrowder
pmurias tbrowder: hi 12:19
lizmat is awake fsvo
pmurias grondilu: s-exprs are a notation for writing lists
tbrowder hi! I am ready to release a new P6 module and would appreciate anyone who can take the time to check it: see github.com/tbrowder/Net-IP-Lite-Perl6
hi all! 12:20
i'll let it percolate a day or two... 12:21
grondilu I thought they could be used to writing programs as well. I guess they can with if you add a "call" function or something. 12:22
but that looks like a hassle.
12:23 Ven_ joined, djbkd left
grondilu thought about generating actual lambda-calculus expression but couldn't quite cope with parenthesis rules. 12:24
12:25 djbkd joined
pmurias grondilu: when you are writing lisp you are basically writing programs as lists 12:29
12:30 Ven_ left 12:34 pierre_ left 12:37 djbkd left 12:39 djbkd joined
grondilu correct me if I'm wrong. The s-exp for sub {} is (() ()) and the one for sub {}() is (call (() ())) 12:39
12:41 BenGoldberg joined 12:42 itaipu joined 12:51 djbkd left
arnsholt Depends on the exact Lisp you're programming in 12:52
In CL declaration is (defun subroutine (args) ...) and call is (subroutine ...)
12:52 djbkd joined
arnsholt If you have a varaible containing a function, you need to do (funcall var ...) because CL is a Lisp-2 12:53
13:01 noninc joined
noninc hello! I am pondering on the possibility to make a portable version of perl6+moarvm on windows. It seems the rakudo binaries have a hardcoded prefix. 13:03
Is there a sensible / simple way of making rakudo use relative paths? 13:04
13:05 djbkd left 13:08 djbkd joined, kent\n joined
dalek pan style="color: #395be5">perl6-examples: 2bb7126 | (Mathieu Gagnon)++ | categories/interpreters/lisp.pl:
Fix lisp interpreter test

Make `perl6 lisp.pl --test` pass again.
  « is for word quoting with interpolation so changing for q.
[ptc] hey cool! (Mathieu Gagnon)++ 13:10
grondilu arnsholt: I only have anonymous subroutines so far. How do you call an anonymous function in lisp? 13:11
13:11 mohae_ joined
arnsholt grondilu: Depends on the Lisp =) 13:11
But if it's a Lisp-1 (single namespace) It's just ((lambda (@sig) $function-body) @args)
Or you can have a call special form 13:12
grondilu meh, I think I'll stick to ES6
where sub {}() is (_ => null)()
seems simple enough 13:13
13:13 itaipu left, kent\n left 13:15 mohae left
grondilu checked and realizes (() => null) is better for sub {} 13:15
13:15 itaipu joined
dalek c: 5252066 | (Jan-Olof Hendig)++ | doc/ (2 files):
Changed references to deprecated Order::Increase and Order::Decrease to Order::Less and Order::More
13:19 djbkd left 13:22 djbkd joined
pmurias grondilu: how are you going to transform the javascript you produce? 13:23
gfldex for a concurrent File::Find, is $follow-symlink = True a sane default? 13:26
grondilu pmurias: I won't. 13:27
why would I?
13:28 pierre_ joined
pmurias grondilu: you seem to want to have a bunch of passes that feed into each other 13:28
grondilu yes 13:29
pmurias so what will the first pass return?
grondilu but only the last stage will produce javascript. 13:30
the pass in language miniPerl::<n> returns code in language miniPerl::<n-1>
pmurias in string form? 13:31
grondilu yes
13:31 pierre_ left, djbkd_ joined 13:32 djbkd left
dylanwh gfldex: re File::Find, symlinks can form cycles. Do you detect those cycles? 13:33
grondilu for instance miniPerl::II will accept sequences of operations. So 'f(); g();' will become 'sub { g() }(f());' 13:35
13:35 rgrinberg joined
gfldex dylanwh: i would like to but we don't got readlink nor stat (readlink is hard on win32 and stat is pointless) 13:37
dylanwh I would ignore symlinks by default then. 13:38
symlink cycles are not uncommon in my experience.
gfldex they are the default on windows is you start at C:\ 13:39
13:40 pierre_ joined
noninc how would I go about building moarvm, nqp and rakudo all with relative prefixes on windows, so i can move it later? is this possible? 13:43
pmurias grondilu: seems doable but really inconvinient and slow as you will have to reparse everything as opposed to just manipulating s-exprs like the use in scheme (or just ASTs) 13:46
13:46 AlexDaniel joined, djbkd joined 13:47 djbkd_ left
grondilu pmurias: I confess I don't understand how they do it, then. 13:49
pmurias grondilu: have you learned lisp? 13:52
grondilu pmurias: not seriously, and long ago. 13:53
pmurias grondilu: in lisp the program is written as nested lists (with atoms in them) 13:55
grondilu not related: how do I refer to a grammar inside itself? Like with ::CLASS but for grammars?
pmurias with a very thin layer of syntax on top of it
isn't a grammar also a class?
grondilu m: grammar { say ::CLASS }
camelia rakudo-moar 46e0ed: OUTPUT«5===SORRY!5=== Error while compiling <tmp>␤No such symbol 'CLASS'␤at <tmp>:1␤------> 3grammar { say ::CLASS7⏏5 }␤»
grondilu it's supposed to.
m: class { say ::CLASS } 13:56
camelia rakudo-moar 46e0ed: OUTPUT«5===SORRY!5=== Error while compiling <tmp>␤No such symbol 'CLASS'␤at <tmp>:1␤------> 3class { say ::CLASS7⏏5 }␤»
grondilu oh
m: class { say ::?CLASS }
camelia rakudo-moar 46e0ed: OUTPUT«(<anon|60424016>)␤»
grondilu wrong syntax, sorry
dalek c: 4a99a1a | (Jan-Olof Hendig)++ | doc/Type/Str.pod6:
Attempt to fix #923 by exchanging a few =head3 directives with B<>
13:57 djbkd left
grondilu pmurias: I get that in lisp the program is written in nested lists, but I don't know how that can help doing what I'm trying to do. 13:58
13:58 dalek left
grondilu I suppose I should look into how exactly they proceed with nanopass. 13:59
pmurias grondilu: you don't have to reparse it in every stage you just transform lists
13:59 dalek joined, ChanServ sets mode: +v dalek 14:00 djbkd joined
grondilu ok 14:01
but I can't cope with the kind of AST perl6 generates.
pmurias QAST is not very fun true 14:04
14:11 djbkd left 14:12 kaare_ joined 14:13 djbkd joined
dalek rl6-most-wanted: dae00bf | (Tom Browder)++ | most-wanted/modules.md:
add new module to the list (also WIP)
pmurias rakudo.js compiles 56% of the setting before dying 14:15
dalek rl6-most-wanted: bbbbbdd | (Tom Browder)++ | most-wanted/modules.md:
correct typo
rl6-most-wanted: 22dc004 | (Tom Browder)++ | most-wanted/modules.md:
correct entry
14:20 seatek joined 14:25 seatek left, djbkd left, djbkd joined 14:35 kent\n joined 14:39 djbkd_ joined, djbkd left 14:49 djbkd_ left 14:51 kaare_ left 14:52 kaare_ joined 14:53 djbkd joined, pierre_ left 14:57 MilkmanDan left 14:59 MilkmanDan joined
moritz nice commit hash, starting with bbbbbdd 14:59
15:02 khw joined
gfldex is Channel.list eager (given no Promise is involved)? 15:03
noninc okay, my problem seems to be in the nqp::backendconfig<prefix>. Can I change that at runtime between invoking moarvm and bootstrapping perl (when trying to run a perl script)? 15:04
15:04 rmmm joined
dalek rl6-most-wanted: 895e6fb | (Tom Browder)++ | most-wanted/modules.md:
add note about impending review and release
moritz gfldex: yes, it blocks until you close the channel
15:13 Alikzus left 15:15 djbkd left 15:16 djbkd joined
Woodi_ hi #perl6 :) 15:21
is AST eqivalent of s-expressions ?
15:22 pmurias left
mst sorrrt of? 15:22
I mean, both 'yes' and 'absolutely not' depending on how you look at it 15:23
TimToady s-expressions are syntax, and syntax is not...abstract...
unless, of course, it's abstract syntax...
but usually, when people say "s-exprs" they mean Lost In Silly Parens 15:24
15:25 djbkd left
TimToady so I think most people would say s-exprs are one way of representing ASTs 15:26
15:27 djbkd joined
Woodi_ os they are isomorphic or not ? :) 15:29
mst ah, point. I think I tend to think of S-exprs as the list-of-lists structure, and the ((((((())))))) stuff as just a textual representation
TimToady to me, if things look different, they are different :) 15:30
that's probably why I dislike gratuitous abstractions...
Woodi_ I wonder do optimizations done on AST can be done on something more human friendly ;) 15:31
15:31 Ven_ joined
Woodi_ btw. can we just *inline EVERYTHING!* into asm and optimize it as postcompilation ? :) 15:32
mst hrm, i think what I mean is that I think of lisp as an infospace (ala there being an XML infospace, of which the textual representation is merely the usual means for humans to poke it)
it's notable that e.g. symbolics (IIRC) didn't store a textual form at all, and when you went to edit something it formatted it according to whatever your editor/tidy config said 15:33
TimToady but yes, they can generally be considered isomorphic, except insofar as an AST often contains abstractions (cross links and such) that the s-exprs are usually thought of as lower-level than
or however you say that in English
15:34 RabidGravy left
mst hmm, I've always regarded the cross links are more being ... pre-caching of lookups from the surrounding environment 15:34
then again, your "looks different" comment kinda suggests your brain does concrete visual processing in a way mine simply doesn't/can't 15:35
TimToady at some point you're not actually talking about s-exprs anymore, but lisp :)
15:35 djbkd left 15:36 djbkd joined
mst the extent to which s-exprs directly represent the conceptual structure makes that kinda blurred for me, much though I don't disagree 15:36
15:37 Alikzus joined
TimToady on a linguistic side, it comes down to making an etic vs emic distinction 15:37
emically, I meant "on the linguistic side", but etically, it came out the other way 15:38
dylanwh it's cons cells all the way down, man.
TimToady I'm not worried about all the way down, but all the way up. :P 15:39
at some point I punch you in the nose rather than handing you a cons cell :)
15:41 seatek joined
Woodi_ yes, pairs can be used to construct rest data structures but it would be nice to have other data structures natively in Lisp. why torture yourself all the time ? :) 15:41
noninc I'm stuck here :( After building nqp retains nqp::backendconfig()<prefix> and afaik uses that to boot up perl. So if I move the C:\rakudo somewhere else, and change the .bat files accordingly, perl still refuses to run (While looking for 'C:\rakudo/share/nqp/lib/Perl6/BOOTSTRAP.moarvm': no such file or directory). Is there some way I can tell it to look other then by the built-in prefix? 15:42
I'd very much appreciate some help! 15:43
15:44 Ven_ left
TimToady rakudo is not yet relocatable like that, afaik 15:44
15:45 Ven_ joined
TimToady symlinks are the usual remedy 15:45
MasterDuke noninc: i think mst did some work on making the build less dependent on specific paths, but i don't think that's been committed yet
noninc I am quite commited to make that possible somehow, but I have hardly any experience in the moar/nqp/rakudo sources :( Would you want to help me get started? 15:47
psch the biggest issue is that nqp::backendconfig() is compile time afair 15:49
15:49 Ven_ left
psch so either you replace everything that looks there with a check for e.g. an ENV var or $PWD 15:49
noninc yes. That seems to make sense, as it provides info on the specific installation.
psch or you figure out a way to move parts (i.e. probably only prefix) of the backendconfig to runtime
noninc Can I overwrite it befor loading perl's bootstrap into moar 15:50
psch m: use nqp; say nqp::backendconfig().HOW.^name
camelia rakudo-moar 46e0ed: OUTPUT«KnowHOW␤»
psch m: use nqp; say nqp::backendconfig().WHAT
camelia rakudo-moar 46e0ed: OUTPUT«{}␤»
psch ...no idea, honestly 15:51
noninc so best guess would be to rewirte the bootstrap to look somewhere else then just at backendconfig? 15:52
-rewirte +change
I will try that. 15:53
15:53 djbkd left 15:56 djbkd joined
TimToady at one point (don't know if it's still this way), in Perl 5 we put each absolute location into a fixed-size chunk of memory, with spare bytes at the end, so that a program could relocate the perl interpreter by rewriting those chunks in the binary 15:57
noninc I looked at the .moarvm files with a hex editor and the string was not long enough sadly 15:59
MasterDuke noninc: you could see what mst did for Alien::[Rakudo,NQP,MoarVM] 16:00
noninc let me google that 16:01
please excuse my ignorance, but I can only find irc logs when searching for alien::<perl6-stuff> 16:03
mst noninc: trout.me.uk/6dists/
noninc ty
mst noninc: I haven't quite got them cleaned up to where I wanted to inflict them on cpantesters etc.
TimToady: pretty sure activestate's installer still relies on that 16:04
noninc give me a moment please to read up on that
16:05 domidumont joined 16:07 djbkd left 16:08 djbkd joined 16:09 TEttinger joined 16:17 djbkd left
noninc :/ alien::<perl6-stuff> just rebuilds with appropriate prefixes 16:18
-just 16:19
16:20 djbkd joined 16:24 setty1 left 16:25 lucasb_ joined 16:27 djbkd left 16:28 MARTIMM left 16:30 djbkd joined 16:32 jstimpfl1 left
noninc solution symbolic link from C:\perl6prefix\share\nqp\lib to <working directory>\blib 16:36
16:37 djbkd left
noninc because rakudo/src/Perl6/ModuleLoader.nqp line 56 - 59 (github.com/rakudo/rakudo/blob/8cbb...r.nqp#L56) 16:37
?? "blib/$file"
is that blib thing documented somewhere?
tailgate is there an operator for type comparisons? 16:38
gfldex ~~
or .WHAT === .WHAT
sometimes .HOW ~~ Metamodel::* 16:39
16:39 djbkd joined
gfldex tailgate: see introspection sections in docs.perl6.org/language/typesystem 16:39
noninc I think I can rely on perl (moar) looking for itself (BOOTSTRAP.moarvm) in <working directory>/blib/..., can't I? 16:41
BenGoldberg m: class Foo { method posfix:<!>() { say "bang!" } }; Foo.new!; 16:43
camelia rakudo-moar 46e0ed: OUTPUT«5===SORRY!5=== Error while compiling <tmp>␤Negation metaoperator not followed by valid infix␤at <tmp>:1␤------> 3posfix:<!>() { say "bang!" } }; Foo.new!7⏏5;␤ expecting any of:␤ infix␤ infix stopper␤»
BenGoldberg Is there any chance that perl6 will something C++-ish, and allow an operator to be defined either as a method or as a sub? 16:44
(In the future, that is) 16:45
noninc Thank you for your help! cya later
16:45 noninc left
TimToady no, we do not allow other people to change the language in your lexical scope; you must use a sub to delegate to a method in that case 16:46
lucasb_ m: class C {}; multi sub postfix:<!>(C) { say "bang!" }; C.new!
camelia rakudo-moar 46e0ed: OUTPUT«bang!␤»
BenGoldberg How is it different from them exporting operators into your lexical scope when you 'use' a module? 16:47
TimToady those are subs, not methods
BenGoldberg What I mean is, there's more than one way to do it, no?
TimToady always :) 16:48
BenGoldberg Would it be too hard to add to the language? Or is it for a different reason?
TimToady all language change is lexically scoped in Perl 6, and method calls are not lexically scoped 16:49
you cannot add a method in some module and magically change the syntax in a different module 16:50
16:50 djbkd_ joined
TimToady we don't allow magical action at a distance without importing a special name at compile time, in which case it's no longer magical, but desirable 16:51
16:51 djbkd left
BenGoldberg What if it were limited to places where the user has explicitly declared the type of a variable, and the declared type has the specified operator methods? 16:52
TimToady and the whole point of methods is that they're late bound, so you can't predict where the name is to be found
BenGoldberg: as I said, you can easily do that with subs that delegate to methods
they'll even get inlined in most cases 16:53
but language changes are always bound to function names, not method names
because function names are lexically scoped, and method names are not
to do otherwise means you can't actually understand which language you're parsing until you've analyzed the entire program 16:54
which is a form of accidental genericity we don't want to support ever
now, if you say 'use MyTerriblyGenericLanguage;' at the top, of course, you can do whatever you like 16:55
but stock Perl 6 isn't gonna mix up those namespaces
BenGoldberg So if I've got: class Foo { method posfix:<!>() { say "bang!" } }, and then I later write: my Foo $x .= new; then when the compiler later sees '$x!', it says, (at compile time!), $x is of type Foo, and Foo has an postfix<!>, therefore I shall translate this into $x."postfix<!>"(). The actual method lookup and binding would be done at runtime (late binding) just like any other method, but the decision whether $x! is a sub, method, 16:56
or error is done at compile time.
TimToady that would be C++, not Perl :) 16:57
BenGoldberg Yes! :)
TimToady however, does even C++ allow you to add new operators that way? or just rebind existing ones? 16:59
BenGoldberg But it's also a bit like perl5, where if I wrote: package Foo; use overload '+' => 'add'; and later wrote: $x + 2, it would call $x->add(2), a perfectly ordinary method call.
TimToady yes, because Perl 5 suffers the same illness as C++ in terms of not allowing new operators 17:00
BenGoldberg Neither perl nor C++ doesn't let you write wholly new operators, because that would require changing the lexer.
Well, perl you *could*, but it's messy! :)
TimToady yes, because lexers are a form of multi-pass parsing, which we don't do in Perl 6 17:01
having learned bitter lessons about that in Perl 5
so lexically scoped syntax change is fundamentally tied to one-pass parsing in Perl 6 17:02
multi-pass parsing is a form of accidental genericity, because the second pass you're actually parsing a different language 17:03
BenGoldberg The existance or non-existance of a specific operator is something that can be tested for with one pass parsing.
TimToady we made the mistake very large with source filters, but the same principle works at smaller scales as well as larger 17:04
sure, but only if something has been declared ahead of time
BenGoldberg Yes! I only want it if it's been declared ahead of time.
TimToady and methods are not in that category, unless you violate late binding as C++ does, to its shame
so you must declare not only the name but the delegation to a method in Perl 6 17:05
17:05 rgrinberg left
BenGoldberg If someone uses augment class Foo, and adds an operator method, then they should be unsurprised if code which was previously compiled does not call that operator. 17:05
TimToady well, you could redirect the delegation after the fact, but the name of the new operator must certainly be declared up front
BenGoldberg Yes. 17:06
17:06 rgrinberg joined
TimToady you can repeat your statement without "augment" there 17:06
17:06 djbkd joined
BenGoldberg Good point. 17:07
TimToady just because other languages confuse things doesn't mean we have to :)
we actually believe in virtual methods by default in a way that C++ does not
17:08 djbkd_ left
BenGoldberg If someone write: class Foo; my Foo $x .= new; $x!; class Foo { method postfix<!>{ say "bang" } }; it's ok by me if it doesn't compile, because the compiler doesn't yet know of the existance of Foo's"!" 17:08
TimToady won't work in the other order either, and that also should not surprise you 17:09
BenGoldberg Well, won't work now, but I think it could be made to work, keeping with one pass parsing.
TimToady no, because the lexical scope of postfix:<!> is limited to the block in which it's declared, even if we did pay attention to it on method declarations, which I don't believe we do 17:10
BenGoldberg Hmm...
17:11 MARTIMM joined
TimToady m: class Foo { method postfix:<!>() { say self ~ "!" }; method foo { self! } }; Foo.new.foo 17:11
camelia rakudo-moar b77d2b: OUTPUT«5===SORRY!5=== Error while compiling <tmp>␤Negation metaoperator not followed by valid infix␤at <tmp>:1␤------> 3) { say self ~ "!" }; method foo { self!7⏏5 } }; Foo.new.foo␤ expecting any of:␤ infix␤ infix stopper␤»
TimToady yes, we don't
m: class Foo { sub postfix:<!>($x) { say $x ~ "!" }; method foo { self! } }; Foo.new.foo 17:12
camelia rakudo-moar b77d2b: OUTPUT«Foo<95784800>!␤»
TimToady but in any case, the postfix can't leak out of the lexical scope unless explicitly exported and imported 17:13
17:13 cyphase left
TimToady it's simply not allowed in Perl 6 for you to mess with someone else's lexical scope like that 17:13
BenGoldberg What prevents someone from writing a multi sub trait_mod:<is>( Class $c, :$overloaded! ), which looks at the names of methods of $c, and for any whose name starts with postfix, infix, prefix, circumfix, etc, generates an appropriate multi sub, and further declares those generated subs as exported? 17:14
TimToady to paraphrase one of our slogans, "All is fair if and only if you predeclare."
17:15 bstamour left
timotimo BenGoldberg: that still needs those multis to be imported into the right scopes 17:15
17:15 cpage left
TimToady that's fine, as long as the user says "use ThatCrazyModule;" 17:15
17:15 cpage_ joined
TimToady it's no different than importing new sytactic functions that happen to delegate to methods, which we allow 17:16
BenGoldberg grins. 17:17
17:17 djbkd_ joined, djbkd left
BenGoldberg So the important thing is that the user be able to easily choose whether or not that behavior's imported. 17:17
TimToady Perl 6 doesn't mind if you declare 'use ShootMeNow;', just as long as it's explicit 17:18
BenGoldberg Ok, got it :)
17:18 cyphase joined, cyphase left
grondilu .tell pmurias you're right, passing text between stages is not the way to go. 17:18
yoleaux grondilu: I'll pass your message to pmurias.
17:19 cyphase joined, cdg joined
lucasb_ m: my &c = { * + 10 and * + 20 }; say c()(1) 17:24
camelia rakudo-moar b77d2b: OUTPUT«21␤»
lucasb_ I saw this ticket about multiple whatevercode in closures 17:25
I'm wondering if this snippet will fail next time camelia is recompiled
I'll wait :) 17:26
BenGoldberg m: my &c = { * + 10 and * + 20 }; say c()(0, 2)
camelia rakudo-moar b77d2b: OUTPUT«Too many positionals passed; expected 1 argument but got 2␤ in block <unit> at <tmp> line 1␤␤»
BenGoldberg m: my &c = { * + 10 and * + 20 }; say c()(-10) 17:27
camelia rakudo-moar b77d2b: OUTPUT«10␤»
17:27 nadim_ joined, djbkd_ left
BenGoldberg m: my &c = { * + 10 and * + 20 }; dd &c; 17:27
camelia rakudo-moar b77d2b: OUTPUT«Block &c = -> ;; $_? is raw { #`(Block|60885600) ... }␤»
lucasb_ I know, the snippet doesn't make sense. I was just testing the presence of the error or not
17:28 nadim left, TakinOver joined, djbkd joined
lucasb_ just to clarify: in 'sub foo($a where {* < 5 and * > 9})', the where clause will always evalute to true, right? 17:29
it's not the case that the where clause is getting ignored
BenGoldberg I suppose that the real question is: If there are N *s in one expression, should the resulting block take one parameter or N parameters? 17:30
lucasb_ i think the answer always was "N parameters"
each star is a different paramenter... maybe that is the confusion in the ticket
BenGoldberg m: my &c = { * + 10 and * + 20 }; dd c(); 17:31
camelia rakudo-moar c4c071: OUTPUT«5===SORRY!5=== Error while compiling <tmp>␤Malformed double closure; WhateverCode is already a closure without curlies, so either remove the curlies or use valid parameter syntax instead of *␤at <tmp>:1␤------> 3my &c = { * + 10 and * + 20 }7…»
lucasb_ that's why "* + *" sums two numbers, not just one
BenGoldberg m: my $c = { * + 10 and * + 20 }; dd $c; 17:32
camelia rakudo-moar c4c071: OUTPUT«5===SORRY!5=== Error while compiling <tmp>␤Malformed double closure; WhateverCode is already a closure without curlies, so either remove the curlies or use valid parameter syntax instead of *␤at <tmp>:1␤------> 3my $c = { * + 10 and * + 20 }7…»
BenGoldberg m: my $c = { * + 10 and * + 20 };
camelia rakudo-moar c4c071: OUTPUT«5===SORRY!5=== Error while compiling <tmp>␤Malformed double closure; WhateverCode is already a closure without curlies, so either remove the curlies or use valid parameter syntax instead of *␤at <tmp>:1␤------> 3my $c = { * + 10 and * + 20 }7…»
BenGoldberg m: my $c = * + 10 and * + 20;
camelia rakudo-moar c4c071: OUTPUT«WARNINGS for <tmp>:␤Useless use of "+" in expression "* + 20" in sink context (line 1)␤»
BenGoldberg m: my $c = (* + 10 and * + 20); dd $c;
camelia rakudo-moar c4c071: OUTPUT«WhateverCode $c = { ... }␤»
BenGoldberg m: my $c = (* + 10 and * + 20); say $c(32);
camelia rakudo-moar c4c071: OUTPUT«52␤»
lucasb_ so, ok. it's confirmed. with this new revision, my previous snippet fails 17:33
BenGoldberg m: my $c = (* + 10 and * + 20); say $c(-10);
camelia rakudo-moar c4c071: OUTPUT«10␤»
BenGoldberg bisectable6: my $c = (* + 10 and * + 20); say $c(-10, 13);
BenGoldberg wonders where's the bot. 17:34
grondilu ls 17:35
17:35 mempko joined
grondilu ^sorry wrong window 17:35
BenGoldberg huggable, bots 17:36
huggable BenGoldberg, nothing found
BenGoldberg huggable, bots is The #perl6 irc channel normally hosts several helpful bots. I am a bot, and camelia, SourceBaby, yoleaux, Bisectable, Commitable, Benchable, Evalable are other bots who are usually here. 17:40
huggable BenGoldberg, nothing found
BenGoldberg huggable, bots :is: The #perl6 irc channel normally hosts several helpful bots. I am a bot, and camelia, SourceBaby, yoleaux, Bisectable, Commitable, Benchable, Evalable are other bots who are usually here. 17:42
huggable BenGoldberg, Added bots as The #perl6 irc channel normally hosts several helpful bots. I am a bot, and camelia, SourceBaby, yoleaux, Bisectable, Commitable, Benchable, Evalable are other bots who are usually here.
17:43 mempko left
BenGoldberg huggable, author 17:43
huggable BenGoldberg, nothing found
BenGoldberg huggable, author :is: was written by Zoffix++. 17:44
huggable BenGoldberg, Added author as was written by Zoffix++.
17:44 djbkd left 17:45 seatek left, nadim_ left 17:47 Actualeyes left, nadim_ joined, djbkd joined, seatek joined
TimToady BenGoldberg: note that 'and' is a short-circuit op and thus is really control flow 17:48
m: my $c = (* + 20 if * + 10); say $c(32); 17:49
camelia rakudo-moar c4c071: OUTPUT«52␤»
TimToady you've essentially said that
BenGoldberg Sure, I know that.
The important thing I'm taking away is that I can't write: 17:50
m: my $c = (* + *); say $c( 10, 20 );
camelia rakudo-moar c4c071: OUTPUT«30␤»
BenGoldberg Err
Ok, now I'm confused.
m: my $c = (* and *); say $c( 10, 20 ); 17:51
camelia rakudo-moar c4c071: OUTPUT«No such method 'CALL-ME' for invocant of type 'Whatever'␤ in block <unit> at <tmp> line 1␤␤»
TimToady we do not try to apply autopriming to control flow, it's only for simple expressions
BenGoldberg m: my $c = (* ?? * !! *); say $c( True, 10, 20 ); 17:52
camelia rakudo-moar c4c071: OUTPUT«No such method 'CALL-ME' for invocant of type 'Whatever'␤ in block <unit> at <tmp> line 1␤␤»
TimToady same deal
lucasb_ I found this interesting:
my &c = { $_ + * }; say c(2)(3) # this works
my &c = { $^a + * }; say c(2)(3) # this doesn't work
BenGoldberg m: my $c = (* ?? * !! *); dd $c;
camelia rakudo-moar c4c071: OUTPUT«Whatever $c = *␤»
17:52 nadim_ left 17:53 AlexDaniel left
lucasb_ should the two snippets both fail or both work? :) 17:53
or maybe it's ok for $_ to be "more special" than $^a 17:54
17:54 nadim_ joined
grondilu m: dd foo => "bar" 17:55
camelia rakudo-moar c4c071: OUTPUT«block <unit>␤»
grondilu ^wat
m: say foo => "bar"
camelia rakudo-moar c4c071: OUTPUT«Unexpected named argument 'foo' passed␤ in block <unit> at <tmp> line 1␤␤»
BenGoldberg In the absence of an EVAL, it should be almost impossible to distinguish betwen a block which uses $_ and one which uses a single positional parameter
TimToady I think they should both fail, because they almost certainly show confusion on the part of the programmer 17:56
BenGoldberg m: my &c = -> $a { $a + * }; say c(2)(3);
camelia rakudo-moar c4c071: OUTPUT«5␤»
BenGoldberg m: my &c = { $^a + * }; say c(2)(3);
camelia rakudo-moar c4c071: OUTPUT«5===SORRY!5=== Error while compiling <tmp>␤Malformed double closure; WhateverCode is already a closure without curlies, so either remove the curlies or use valid parameter syntax instead of *␤at <tmp>:1␤------> 3my &c = { $^a + * }7⏏5; say c…»
BenGoldberg m: my &c = { $_ + * }; say c(2)(3);
camelia rakudo-moar c4c071: OUTPUT«5␤»
TimToady though one could argue that use of $_ is "valid parameter syntax"
and hence so is $^a 17:57