»ö« 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.
jimav Hello World... Is it possible to disallow undeclared named args to methods? By default $obj.meth(misspelled=>42) succeeds silently. 00:27
rouking When I try to install rakudo-star to target the jvm (and moarvm), `make install` tries to cd into modules/panda, which doesn't exist. Any clues? Is this referring to the deprecated module manager? 00:29
jimav m: pastebin.com/raw/gPdbrNYU 00:30
camelia 5===SORRY!5=== Error while compiling <tmp>
Confused
at <tmp>:1
------> 3https:7⏏5//pastebin.com/raw/gPdbrNYU
expecting any of:
colon pair
jimav Hmm I thought that would work... 00:31
buggable New CPAN upload: Concurrent-Trie-1.0.tar.gz by JNTHN cpan.metacpan.org/authors/id/J/JN/...1.0.tar.gz
Zoffix Is there some sane way to in-place replace an attribute in a class to a native type during instantiation? class Foo { has $.foo } having foo a native int if `Foo.new: :42foo` is called or having it an Int if `Foo.new: :44000000000000000000000000000000000foo` is called? I don't want to have more than one attr in the class 00:34
(kinda clutching at straws with this idea, but figured I'd ask anyway) 00:35
MasterDuke m: class A { method foo(*%n where !%n) { say "here" }; }; say A.foo(method=>42)
camelia Constraint type check failed in binding to parameter '%n'; expected anonymous constraint to be met but got Hash (${:method(42)})
in method foo at <tmp> line 1
in block <unit> at <tmp> line 1
MasterDuke jimav: ^^^ like that perhaps? 00:36
Kaiepi how can i write the proto method for this to work? when i try calling Net::LibIDN::TLD.check_8z('com', $errpos, $code), it expects a Positional as the third argument hastebin.com/etuzeqonit.pl 00:37
jnthn Zoffix: No; numerous things depend on an attribute's kind being stable. 00:38
Zoffix rouking: presumably it's a bug you could report ( github.com/rakudo/star/issues ).
jnthn Zoffix: for a given type, that is
Zoffix jnthn: thanks.
Kaiepi nm, proto method check_8z(Str, Int, | --> Bool) works
jnthn Zoffix: Role and then two classes implementing it, perhaps? 00:39
Zoffix Yeah, that's what I'm gonna go with. 00:42
Well, draft at least. Go run by TimToady first to see how he feels about MidRat (and likely MidRatStr) for Rat/FatRat allomorph, 'cause I'm not really a fan of making RatStr doing that job. 00:43
s/Go/Gonna/;
trial impl appears to work, but I just can see people complaining about proliferation of Numeric/Rational types :} 00:44
(and I don't wanna lock Rat to full Int denominator for this purpose, 'cause then we miss out on any potential wins for native-type denominators) 00:45
Zoffix rouking: submitted a potential fix: github.com/rakudo/star/pull/109 00:50
jnthn wanders off to sleep 00:55
Zoffix m: sub is-empty { %^_ and die "Unknown named args: %_.keys().sort().map('"'~*~'"')"; }; class Foo { method xxx(:$argname) { is-empty %_; say "xxx called" } };Foo.xxx(misspelled => 42); 00:57
camelia Unknown named args: "misspelled"
in sub is-empty at <tmp> line 1
in method xxx at <tmp> line 1
in block <unit> at <tmp> line 1
Zoffix m: sub is-empty { %^_ and die "Unknown named args: %_.keys().sort().map('"'~*~'"')"; }; class Foo { method xxx(:$argname, *%_ where &is-empty) {say "xxx called" } };Foo.xxx(misspelled => 42); 00:58
camelia Unknown named args: "misspelled"
in sub is-empty at <tmp> line 1
in method xxx at <tmp> line 1
in block <unit> at <tmp> line 1
Zoffix m: sub trait_mod:<is> (Routine:D \r, :$locked!) { r.wrap: -> *%_, | { %_{r.signature.params.grep(*.named).map: *.usage-name}:delete; %_ and die "Unknown named args: %_.keys().sort().map('"'~*~'"')"; }}; class Foo { method bar(:$meows) is locked {} }.bar: :42meows 01:05
camelia ( no output )
Zoffix m: sub trait_mod:<is> (Routine:D \r, :$locked!) { r.wrap: -> *%_, | { %_{r.signature.params.grep(*.named).map: *.usage-name}:delete; %_ and die "Unknown named args: %_.keys().sort().map('"'~*~'"')"; }}; class Foo { method bar(:$meows) is locked {} }.bar: :42meowss
camelia Unknown named args: "meowss"
in block at <tmp> line 1
in block <unit> at <tmp> line 1
Zoffix hehe, neat :)
oh, forgot to nextsame outta the wrap 01:06
m: m: sub trait_mod:<is> (Routine:D \r, :$locked!) { r.wrap: sub (*%_, |) { %_{r.signature.params.grep(*.named).map: *.usage-name}:delete; %_ and die "Unknown named args: %_.keys().sort().map('"'~*~'"')"; nextsame }}; class Foo { method bar(:$meows) is locked {say "we're in!"} }.bar: :42meows
camelia we're in!
Zoffix m: m: sub trait_mod:<is> (Routine:D \r, :$locked!) { r.wrap: sub (*%_, |) { %_{r.signature.params.grep(*.named).map: *.usage-name}:delete; %_ and die "Unknown named args: %_.keys().sort().map('"'~*~'"')"; nextsame }}; class Foo { method bar(:$meows) is locked {say "we're in!"} }.bar: :42meowss
camelia Unknown named args: "meowss"
in sub at <tmp> line 1
in block <unit> at <tmp> line 1
et09 there was some cool new technique perl 6 uses for inheritance, what was it again? 01:48
Zoffix et09: no idea... do you mean roles (aka traits in some other languages). Far from new. 01:53
et09 i guess so, hm
i thought there was something cooler 01:54
Zoffix m: class A {}; class B {}; class C {}; class D {}; class E {}; class K1 is A is B is C {}; class K2 is D is B is E {}; class K3 is D is A {}; class Z is K1 is K2 is K3 {}; say Z.^mro;
camelia ((Z) (K1) (K2) (K3) (D) (A) (B) (C) (E) (Any) (Mu))
Zoffix This is the standard inheritance we have; the C3 resolution
et09 what's the very last thing mean, ,say Z.^mro?
Zoffix et09: `$foo.^bar($ber)` is short for `$foo.HOW.bar($foo, $ber)` which is a method call on the metaobject 01:55
m: say True but False
camelia False
et09 what is HOW ?
Zoffix ^ we also have that; mix-in-a-role-into-an-object thing; No idea what other "cool" things you could be talking about :)
et09 oh sorry
Zoffix et09: .HOW gives the metaobject responsible for the object 01:56
et09 phew
Zoffix m: put 42 but 'forty-two'
camelia forty-two
et09 i hate how every language has its own terms for syntax
Zoffix :)
"metaclass"? I think that's what Python uses too 01:57
et09 i guess that's vaguely like a haskell typeclass
i don't know python that well 01:58
what's the 10k foot view of perl6 outlook, what do you think 02:03
it fascinates me a little but feel scared to use it at work
Zoffix I'm too deep in to have a clear view, even from 10k foot, but I if performance gets better the outlook would be good. Currently we win in saving programmer's time; once we also start saving computer time, the choice to use the language would be more enticing. 02:06
Current state is A LOT better than in 2016. I recall being frustrated hitting compiler bugs any time I tried to write a program. Now, it's mostly smooth sailing. 02:07
et09 what's an example of really great elegant perl6 code
Zoffix m: dd FatRat.new(1,2) + 0e0;
camelia 0.5e0
Zoffix Hm, I thought FatRats were the most infectious of types and kinda expected above to give me a FatRat. 02:08
et09 wow
Zoffix et09: hmm, that's a bit of a vague question. I think one of the programs I wrote that I was really impressed with the language was my Z-Script tool to assist with builds for a project. It has a ton of commads, but it was supper-fast to write them all thanks to automatic help USAGE message generation and multi-dispatch on sub MAIN: github.com/zoffixznet/z/blob/master/bin/z (and rest of code is in 02:10
github.com/zoffixznet/z/blob/maste...b/RDev.pm6 )
et09: if I had to pick the quintessential example of elegant piece of perl 6 code it'd be counting letters/chars in a sentence
m: say "This is some sentence".comb.Bag 02:11
camelia Bag( (3), T, c, e(4), h, i(2), m, n(2), o, s(4), t)
Zoffix .Bag is a "count this stuff" sort of type
et09 m: "foo bar bag".comb(/a-h/) 02:12
camelia 5===SORRY!5===
Unrecognized regex metacharacter - (must be quoted to match literally)
at <tmp>:1
------> 3"foo bar bag".comb(/a7⏏5-h/)
Unable to parse regex; couldn't find final '/'
at <tmp>:1
------> 3"foo bar bag".comb(/a-7…
et09 m: "foo bar bag".comb(/[a-h]/)
camelia 5===SORRY!5===
Unrecognized regex metacharacter - (must be quoted to match literally)
at <tmp>:1
------> 3"foo bar bag".comb(/[a7⏏5-h]/)
Unable to parse expression in metachar:sym<[ ]>; couldn't find final ']' (corresponding starter …
timotimo perl6 regex syntax is different, you need to spell it <[a..h]> 02:13
et09 whaaat
Zoffix et09: and for a larger piece that I consider elegant, but a tad dirty is ignore/admin feature for my bot. It creates a subset of a generic IRC::Client message that matches the host against hosts in a config file and multi-dispatch on methods for event handling just automagically receives the messages from right users:
github.com/zoffixznet/perl6-ZofBot...pm6#L6-L21
et09 m: "foo bar bag".comb(/[a..h]/)
camelia ( no output )
timotimo m: "foo bar bag".comb(/<[a..h]>/).say
camelia (f b a b a g)
timotimo and you need to .say at the end or say in front so it'll output anything
et09 that's amazing
m: "foo bar bag".comb(/[a..h]/).reverse
camelia ( no output )
et09 m: say "foo bar bag".comb(/[a..h]/).reverse
camelia ()
Zoffix et09: we invented a new regex language. It's a lot more readable than the status quo PCRE stuff (e.g. (?<=foo) is spelled <after foo>) 02:14
timotimo you forgot the < > around it
et09 m: say "foo bar bag".comb(</[a..h]/>).reverse
camelia ()
Zoffix Though Perl 5 regexes are available too if you use the :P5 adverb
timotimo perl6.org/archive/doc/design/apo/A05.html - this is a (very old) document explaining the ideas behind the regex syntax and semantics redesign
et09 that's mind boggling
Zoffix m: dd "foo bar bag".comb(rx:P5/[a-h]/)
camelia ("f", "b", "a", "b", "a", "g").Seq
timotimo sorry, that's one layer too far outside :)
Zoffix ZofBot: mind boggling is what we do! 02:14
ZofBot Zoffix, Lots of people wrote to the magazine to say that Marilyn vos Savant was wrong, even when she explained very carefully why she was right
timotimo ooh, is that from the "three doors and one goat" thing? 02:15
Zoffix Nope: en.wikipedia.org/wiki/The_Curious_...Night-Time
et09 "The Apocalypse on Pattern Matching" lol
Zoffix Ahh
timotimo: but yes, the book mentions the three doors and one goat problem and how many people didn't get it :)
I totally forgot that it did :)
timotimo i love that story 02:16
et09 also larry wall reminds me of the guy from back to the future
timotimo not the dog incident one, i don't know that one
Zoffix :)
Zoffix I guess I was mis-remembering (about FatRat infectiousness). Now that I think of it, it don't make much sense to have FatRat + Num produce a FatRat, as depending on values, a lot of the "extra precision" in that FatRat would be bogus 02:19
oh
m: say .1 + .2 == .3
camelia True
tobs et09: if you do numbers, the "... *" syntax for sequences is nice
Zoffix et09: ^ another sample I'd add into "elegant" pile. The above gives False in many mainstream languages (they use floating points for such literals, but we use Rational types)
tobs m: my @p = 2, 3, -> *@p { (@p[*-1]..*).first: none(@p) R%% * } ... *; @p[^25].say 02:20
camelia (2 3 5 7 11 13 17 19 23 29 31 37 41 43 47 53 59 61 67 71 73 79 83 89 97)
tobs one-line sieve of eratosthenes (ignoring Int.is-prime)
Zoffix m: say (2, 6, 18 … ∞).head: 100
camelia (2 6 18 54 162 486 1458 4374 13122 39366 118098 354294 1062882 3188646 9565938 28697814 86093442 258280326 774840978 2324522934 6973568802 20920706406 62762119218 188286357654 564859072962 1694577218886 5083731656658 15251194969974 45753584909922 1372…
et09 wow 02:21
Zoffix m: say (1, 1, *+* … ∞).head: 100
camelia (1 1 2 3 5 8 13 21 34 55 89 144 233 377 610 987 1597 2584 4181 6765 10946 17711 28657 46368 75025 121393 196418 317811 514229 832040 1346269 2178309 3524578 5702887 9227465 14930352 24157817 39088169 63245986 102334155 165580141 267914296 433494437 70…
Zoffix Fibonacci numbers
(*+* is a closure that takes two args; the `*` are the arg placeholders, not multiplication)
timotimo m: say (20, 35, *%* ... 0) # euclid's algorithm for greatest common denominator 02:22
camelia (20 35 20 15 5 0)
tobs haha, that's great 02:23
timotimo grab the second-to-last number as the result
m: say ([1], -> @a { [flat(0, @a) Z+ flat(@a, 0)] } ... *).head(4) 02:24
camelia ([1] [1 1] [1 2 1] [1 3 3 1])
timotimo m: say ([1], -> @a { [flat(0, @a) Z+ flat(@a, 0)] } ... *).head(10)
camelia ([1] [1 1] [1 2 1] [1 3 3 1] [1 4 6 4 1] [1 5 10 10 5 1] [1 6 15 20 15 6 1] [1 7 21 35 35 21 7 1] [1 8 28 56 70 56 28 8 1] [1 9 36 84 126 126 84 36 9 1])
timotimo pascal's triangle
the sequence operator in general is just brilliant
i need to go to bed %) 02:25
Zoffix ZofBot: big brother has quit! Let's get crazy 02:46
ZofBot Zoffix, ” And she said, “Perhaps your father just doesn’t like Mr
TEttinger ZofBot: once upon a time, 02:47
Zoffix :) 02:48
ZofBot: good robot!
ZofBot Zoffix, Your father is a much more pacient person
TEttinger aw
pacient heh
it should be spelled like that, shouldn't it
Kaiepi m: say (2419872,984522,*%*...0).tail(2)[0] 03:03
camelia 42
Kaiepi is there a shorter way to get the second last element?
Zoffix .tell TimToady I thought about it and kinda hate RatStr being the type for high-precision literals. `my Str $x = 1.1111111111111111111` is a typecheck error, but `my Str $x = 1.11111111111111111111 isn't` and it's hard to say what a numeric literal has to do with a `Str` object. I drafted the latest version of the proposal to implement a `MidRat` instead that's literally a `Rat`/`FatRat` allomorph (and its 03:04
yoleaux Zoffix: I'll pass your message to TimToady.
Zoffix `Str` allomorph `MidRatStr` is). I don't really like the overkill of introducing two new types to solve this, but I like all the other ideas even less. I updated the proposal doc and there's a crude trial impl in `ratlab-fattish-rat` branch ; what do you think on this? github.com/rakudo/rakudo/blob/mast...tionals.md
.tell TimToady `Str` allomorph `MidRatStr` is). I don't really like the overkill of introducing two new types to solve this, but I like all the other ideas even less. I updated the proposal doc and there's a crude trial impl in `ratlab-fattish-rat` branch ; what do you think on this? github.com/rakudo/rakudo/blob/mast...tionals.md 03:05
yoleaux Zoffix: I'll pass your message to TimToady.
Zoffix m: say (2419872,984522,*%*...^0).tail
camelia 42
Zoffix "and its `Str` allomorph `MidRatStr` is"... Looks like sleep deprivation turned me into Yoda 03:06
m: say (2419872,984522,*%*...0)[*-2] 03:07
camelia 42
Zoffix Kaiepi: ^ the first one is specifically for … op, the …^ version excludes endpoint and then you just do a `tail` on it. The second one is a generic one to get $nth element from the end
Though writing .tail(2).head can betterer as this doesn't cache, while the [...] thing caches 03:08
ZzZombo Kaiepi, just using subscripts is shorter, `(...)[2]`. 03:10
Kaiepi, just using subscripts is shorter, `(...)[*-2]`.
I mean the latter.
Kaiepi ah
thanks
Zoffix .tell TimToady I slept on it and decided I hate MidRat. It's totally an overkill. Got a new idea tho: when making a Rat, if denomunator is too big, mix in a role with Int denominator. Basically this: `role ExtPrecisionRational { has Int $.denominator }; role Mouse does Rational[Int,Int] { method new(\nu, \de) { my \r := nqp::create(self); r does ExtPrecisionRational if reduced-de-is-over-64-bit; 04:06
yoleaux Zoffix: I'll pass your message to TimToady.
Zoffix p6bindattrinvres(...) }` Thinking it'd be a private role tho. Gonna try a trial impl on on Mar 10th weekend
.tell TimToady p6bindattrinvres(...) }` Thinking it'd be a private role tho. Gonna try a trial impl on on Mar 10th weekend
yoleaux Zoffix: I'll pass your message to TimToady.
Zoffix re-beds
perlUser Hi can I use perl 5 modules in perl 6 06:35
trying to learn perl6
perlUser exit 06:37
Geth Pod-To-HTML: JJ++ created pull request #32:
Tested with htmlify.p6
06:50
Geth doc/master: 5 commits pushed by (JJ Merelo)++ 07:19
ufobat good morning :) 08:01
moritz \o ufobat 08:20
masak good antenoon, #perl6 08:40
moritz \o masak 08:41
still morning here :-)
masak you have a point 08:59
masak is reading about Go pseudo-assembly 09:00
for some reason I've become very hungry for the low-level details of bytecode interpreters/runtimes/VMs recently 09:01
maybe I should blog about this
masak most interesting thing I learned so far is that in Go, the _caller_ is responsible for managing the callee's stack frame 09:05
not sure how common that is, but it seems to me that'd be problematic in the face of multimethod dispatch (which Go doesn't have AFAIK)
masak does anyone know how close Go is to previous Rob Pike languages, such as Alef and Limbo? 09:09
oh, Alef wasn't Pike's. but Newsqueak was.
masak at Wikipedia, both the Limbo and the Newsqueak articles mention "first-class channels" and distributed programming. the Limbo article mentions strong typechecking, GC, and portable object code. so it sounds pretty similar 09:12
masak (I once heard it said, meant as a nasty criticism I'm sure, that Pike has been re-implementing the same antiquated language over and over for the past few decades) 09:13
El_Che masak: interesting take 10:01
masak: it's true that go doesn't feel modern, but at the same type not archaic.
stmuk I really like Go although its pretty much at the opposite end of the "syntax complexity" spectrum to Perl 6 10:04
El_Che also on speed :P 10:05
masak I haven't programmed in Go. but I'm reluctantly attracted to the minimalist philosophy it expresses, where you're expressly given a "good parts" subset to work with, instead of All The Things 10:06
El_Che I should register a p6p6 domain :)
masak enjoyed commandcenter.blogspot.se/2012/06/...-more.html
though "no generics" still feels like a very trivial hill to die on to me 10:07
El_Che masak: in my opinion, the syntax doesn't offer much. What it does however is simplicity (e.g. reading other projects), safety, easy concurrency, speed and easy deployment
stmuk Go "Interfaces" are nice
El_Che masak: what's annoying in go is the repeat yourself part (partly to the lack of generics and compact standard lib) 10:08
stmuk the Go team are asking for generic use cases for Go 2.x
El_Che and they are fixing the awful lib versioning 10:09
(or better: the lack of)
stmuk you can fudge generics but Go is probably a bit too "static" for it TBH
jast I don't really like Go that much, but I guess that's because minimalism is the hardest thing and people prefer different ways of reducing things 10:10
stmuk www.youtube.com/watch?v=rFejpH_tAHM dotGo 2015 - Rob Pike - Simplicity is Complicated 10:13
masak cf "I didn't have time to write a shorter letter" ;) 10:14
stmuk :)
jast exactly
masak it's funny -- I'm just back from teaching Git for the umpteenth time. I'm experimenting right now with focusing more on team workflows than on advanced Git commands. it's a big shift in how I teach Git. 10:15
jast and reducing something is always a trade-off
masak and every time I do it, I can feel how I get a little closer to the core of what I want to say, and how I get there quicker
masak it's amazing to me how much that kind of teaching also becomes an act of *discovery* for me, the teacher 10:16
jast yeah, IMO team workflows are much more central to using git successfully
for advanced commands you can always go ask in #git after all ;)
masak it's like I'm amortizing the cost of finding out what I want to say over dozens of clients :P
it's also my thesis lately that everyone wants continuous integration, whether they know it or not 10:17
jast absolutely... you're building up experience about what matters most, what the most common problems and gotchas are, and so on 10:17
I've been running the #git gauntlet for like ten years now... I can do almost arbitrary git talks without any preparation now :) 10:18
masak well, I know what I want to convey, I'm just not used to overcoming the Curse of Knowledge and explaining it well to people who need to hear it 10:19
jast this is why I like very interactive workshops, makes it much easier to see where people are at and tailor-fit explanations 10:20
masak yesterday I ended up building a shopping cart in ES6+, gradually migrating from committing directly on master via feature branches to PRs 10:21
the culmination was when I reviewed my own PRs, fixed the problems, and then had the merge of one cause conflicts in another so it needed rebasing/model changes
it came together quite nicely <3 10:22
masak biggest hurdle this time was that eslint was overconfigured and wouldn't shut up about complete inessentialities :P 10:24
"hey, this function is empty!" -- I know. -- "you didn't use `this` in this method!" -- I know. -- "you didn't use that parameter!" -- I'm doing TFD, OK? 10:25
jast linting is the worst :) 10:27
masak I disagree :)
but it makes a big difference if you opted in to rules or not
jast well it depends
if you take the time to set up the right ruleset for the linter, sure, why not
masak also, it's not that those rules are bad or wrong, but they are just over-eager and don't make sense in the middle of the branch 10:28
I'd like two modes: "lint before commit" and "lint before merge"
jnthn Was gonna say, the things I want a linter to tell me in the middle of developing something aren't the ones I'd want at commit time
jast I don't think I even have a commit-time linter, but my editor does linting in the background 10:29
masak maybe even a third: "lint during authoring" -- mostly because JS is still JS. but that one can be swapped out for a decent modern IDE.
jnthn The default sets of rules are often a bit over-eager, I find, though. Perhaps 'cus linter developers want to show off all their hard work. :-)
And yeah, in JS, linters are more useful than in many other languages, because they tell you stuff the compiler does in other languages. :P 10:31
jast some of them do style-related things, too, like warning about long lines... yeah, I know exactly how long my lines are, thank you very much
masak some eslint rules simply make absolutely no sense, like eslint.org/docs/rules/no-param-reassign 10:33
if you read the linked article that motivates that rule, there are some solid points about `arguments` aliasing 10:34
but the rule also forbids you to change *properties* of arguments, which is completely fine
jnthn wat?
:) 10:35
masak oh, that's opt-in... but still.
jnthn I was about to write "Perl 6 actually enforces a rule like that" until you said the last part :-)
jast the example in the linked article is a classic example of shooting yourself in the foot, anyway 10:36
El_Che feet are overrated
jast you'd only do this if you didn't know how arguments works in JS
the 'arguments' keyword/fake variable, that is
masak guess that's the point, yes 10:37
jast IMO the goal of a linter shouldn't be to protect yourself against people who don't understand the language, it should be to catch things that might happen to someone who knows what they're doing
masak +1 10:38
masak this explains why I hate linter rules about parentheses for clarity (instead of relying on precedence) and against using bit ops (because it could be a typo) 10:40
jast one case where I like parentheses for clarity is 'if (foo = bar)' in C and friends 10:42
masak if I get you right, I believe those are necessary...? 10:44
or did you mean `if ((foo = bar))` ? 10:45
jast the latter
I suppose in some cases it's clear from the context that it's a deliberate assignment, though
masak reminds me of github.com/masak/007/issues/279 which I'm mulling over right now 10:48
(and I just learned that in Go, assignment is not an expression. figures.) 10:49
jast I tend to be in the "everything is an expression" camp 10:54
masak aye -- I understand that stance quite well. and note that 007 currently behaves like C and Perl there 10:57
but as a language designer, I feel I have to argue the other side too ;) 10:58
in a sense, for any "everything is an X" stance, you have to do a certain amount of violence to things which aren't _really_ an X
"everything is an object" -- except for primitives, methos invocations, the call stack itself, properties, reprs, and object code 11:00
method*
"everything is a sexpr" -- except for... almost everything :P 11:01
Geth Pod-To-HTML: 413a5f2cf4 | (Juan Julián Merelo Guervós)++ (committed by Zoffix Znet) | 2 files
Tested with htmlify.p6 (#32)

  * Adds precomp everywhere
  * Avoid errors in documentation
  * Comment out debug
  * Fix that works refs perl6/doc#561
synopsebot DOC#561 [open]: github.com/perl6/doc/issues/561 [big][docs][site] Lots of broken links, invalid HTML and so on (checklink)
Pod-To-HTML: b8d03a0c75 | (Zoffix Znet)++ (committed using GitHub Web editor) | .gitignore
Simplify rule
11:02
masak "everything is an associative array" -- so I can store a key "foo" in my integer-indexed array? gee, thanks.
Geth Pod-To-HTML: 5864afc79c | (Zoffix Znet)++ (committed using GitHub Web editor) | META6.json
Bump version
jast of course "everything is an X" isn't universally sensible 11:03
but for expressions specifically I have yet to see any real problem
masak Rakudo had performance problems for a while because loops spat out all their iterations somehow 11:04
or, more generally, because routines returned things when that wasn't the intent
jast well, if you went the expressionist route you'd have optimizations for expressions where the resulting value isn't used
(ideally) 11:05
masak "sufficiently smart compiler", aye
for a brief while I had a fork of 007 called "george-lazenby" where I intended to make everything an expression just to try it out. never got the tuits, though 11:06
jast if you account for this in the design up front it shouldn't actually be too hard
very much an FP mindset: track which expressions have side effects and reduce the emitted code if you find pure elements that don't get used 11:07
masak in general, a callee does not know about all its callers. at least not before "link time", let's say 11:24
and in a setting with method dispatch, an optimizer might have to be pessimistic when optimizing 11:26
jast yeah, this a whole-program optimization thing 11:28
jast or you can generate two versions of each dispatch: one that does yield a result and one that doesn't 11:30
that bloats up the generated code something awful, of course, but depending on your target platform it might not matter that much ;)
masak yes, this is a good point 11:32
jast many years ago I had this idea for a language/compiler that is extremely trigger-happy on generating many different versions of routines
jast the idea being that you could write untyped code and it would generate a type-specific compiled version whenever one was needed 11:32
probably terrible for CPU caching, but oh well :) 11:33
masak sounds like a JIT to me :)
jast yeah, except it would actually do this ahead-of-time
timotimo rpython does something very much like this, actually 11:34
jast basically an IR layer, and whenever you compile a full program, the correct native code would be generated from that for each type of invocation actually used
timotimo it does whole-program type-inference 11:34
it generates versions of all functions for all types that it could receive
masak in the preface of my still-only-theoretical book on compilers, I point out how compilers prefer almost all of the things we dislike as humans: code duplication, massive inlining, feature envy, etc...
timotimo it is also somewhat slow
jast and the whole language was designed for this kind of approach, where the compiler would trace back and forth to determine which types were used in any given place 11:35
but I never actually implemented it to see if it was possible :)
oh, theoretical books... I have a bunch of those, too 11:36
the kicker about my design (which I didn't fully figure out how to implement) is that it would do compile-time type checking, too, even without any type annotations whatsoever 11:37
and unlike, say, OCaml, it wouldn't have type-specific operators
timotimo rpython does this with assertions; partially explicit, partially implicit or transitive
jast the only limitation this imposes is that you need to be clear about which types are coming in via I/O
basically typed interface, inferred anything-else 11:38
the extreme version would be that you could write methods that aren't actually tied to any class, and it becomes available automatically if an instance can deliver whatever the method needed. I was kind of thinking that might be a little too laissez-faire in general, though. 11:39
timotimo hm, what difference between methods and subs is left if it just "becomes available" like that? 11:41
jast just syntax 11:42
pmurias Just having a "my $foo = new;" construct and infering the type of the object created based on what methods are called on it is an approach use in a code-completion oriented language by Sean McDirmid (would have too look more for the exact paper language) 11:52
pmurias (Escaping the Maze of Twisty Classes) www.microsoft.com/en-us/research/w...rmid12.pdf 11:57
jast that's likely to be ambiguous if you use a lot of inheritance and roles/mixins and such 12:01
timotimo if you don't use many methods on the object, maybe it doesn't matter which class you get :) 12:01
jast maybe the siblings differ only in implementation of various methods 12:02
e.g. ElementLookup has descendants CSSElementLookup and XPathElementLookup 12:03
jast not to mention it might make code hard to read, because then *you* have to infer the type from the methods being used, too 12:24
unless you start being extremely careful with variable names, and then maybe it's a better idea to have a shorthand construct in which variable name =~= class name 12:25
pmurias jast: re *you* have to infer, it's part of the live programming movement so it assumes you are using and IDE which does that for you rather then a dumb text editor 12:52
jast: and it seems they allow you to specify the base class and infer traits
jast if the IDE shows me the class without me having to hover over it or anything, it might as well add it to the code 12:53
pmurias the IDE editing code on it's seems like potentially super annoying 12:57
jast either way, I'd rather have these essential bits of information in my code
I mean, I wouldn't want the type to magically change just because I implement a new method in some other class 12:58
pmurias jast: I'm not a (strong) proponent of that approach, I just think it's an interesting radical idea (and the paper likely does it justice better than me giving it mine impression over irc ;) 13:14
jast pmurias: oh, I missed the link. I'll take a look later. 13:17
Geth doc: 5bd17409c5 | (Will "Coke" Coleda)++ | doc/Language/regexes.pod6
avoid 'or so on', which doesn't read right to me.

  ("and so on" which reads fine, didn't quite fit here)
13:59
synopsebot Link: doc.perl6.org/language/regexes
masak [Coke]: I'm always reminded of an early table in Korzybski's book 14:02
the book is about how language can affect thought. he feels a need to introduce half a dozen new types of punctuation (!) 14:03
timotimo interrobang?
masak nonono, nothing as frivolous as that
masak digs it out to have a look
masak I'm not sure if I find the whole idea of "non-Arestotelian" things incredibly fascinating or dangerous and corrosive 14:04
ok, first off, he says "non-arestotelian" so much that he abbreviates it early on as "Ā" 14:05
masak (similarly for "non-euclidian" and "non-newtonian", both of which terms I have a much easier time grokking) 14:06
masak oh! here we go: ".," for "etc.,", ",." for ",etc.", ".;" for "etc.;", ".:" for "etc.:", ".?" for "etc.?", and ".!" for "etc.!" 14:07
guy really wants to be able to say "etc." a lot
Zoffix .tell TimToady never mind. I'm back on MidRat wagon (which is the latest work draft). Both fatty RatStr and mixing-in-a-role for boosted precision force us to use $.denominator instead of $!denominator in all Rational methods, which is 5.5x slower for native attributes and 4% slower for non-native.
yoleaux Zoffix: I'll pass your message to TimToady.
masak I wish this was more off-topic, but this is a Perl channel :P
[Coke] :) 14:16
Zoffix m: class Foo { has uint64 $.x = 42 }; with Foo.new -> \F { for ^1000_000 { F.x; Nil }; say now - ENTER now } 14:20
camelia 0.34139625
Zoffix m: class Foo { has Int $.x = 42 }; with Foo.new -> \F { for ^1000_000 { F.x; Nil }; say now - ENTER now }
camelia 0.10212501
Zoffix Is it expected for native one to always be slower or is this just lack of things to make it fast? 14:20
jnthn Zoffix: Lack of optimization 14:21
Zoffix *phew* :)
jnthn It's one of the things on my spesh hit list for the not too distant future
Zoffix \o/
timotimo is it about NativeRef not being turned into direct local/lexical access even after inlining? 14:23
Geth perl6-most-wanted: 50f16f72d6 | (Curt Tilmes)++ (committed using GitHub Web editor) | most-wanted/bindings.md
Add link to LibGit2 WIP
14:24
jnthn timotimo: Yes. At the moment we don't do anything in spesh like that 14:32
timotimo: But post-inlining is exactly the time for it
timotimo aye, i've dreamt about this moment for quite some time :)
masak does the optimization require escape analysis? 14:38
lichtkind greetings masak 14:40
Zoffix: do you mind some pull requests for math vector? 14:41
Zoffix has no idea what "math vector" is... 14:43
masak lichtkind: ahoy, fellow grey one :>
Geth doc: titsuki++ created pull request #1836:
Fix link positions in the FAQ
doc: 0782b5a4f0 | (Itsuki Toyota)++ | doc/Language/faq.pod6
Fix link positions in the FAQ
doc: e00a78f5dd | (Itsuki Toyota)++ (committed using GitHub Web editor) | doc/Language/faq.pod6
Merge pull request #1836 from titsuki/fix-pos

Fix link positions in the FAQ
synopsebot Link: doc.perl6.org/language/faq
masak er, I mean. of course aliens are not among us. that's preposterous.
masak does jedi hand motion 14:44
Zoffix lichtkind: I think you're thinking of colomon 14:49
eco: Math::Vector
buggable Zoffix, Math::Vector 'Vector math class': github.com/colomon/Math-Vector
araraloren HI 16:23
timotimo ohai 16:26
araraloren No appropriate parametric role variant available for 'NativeCall::Native'
I download the module `Digest::SHA1::Native` 16:27
araraloren but installed failed with above error 16:27
the test of the module all passed
araraloren gist.github.com/araraloren/ae4faf6...30e064d155 16:29
some log
araraloren :) anyone can help me 16:34
timotimo could you try running the file it's trying to compile with perl6 --ll-exception? 16:35
sub compute_sha1(Blob, size_t, CArray[uint8]) is native( SHA1 ) { * }
this is the line it's complaining about
oh, it'll want to have a -I . so that it finds the META6.info so %?RESOURCES can work
araraloren -I ? 16:36
timotimo include folder, so that it looks for files in your current folder
araraloren do you mean run like this ? perl6 -Ilib ./t/03-sha1.t 16:37
timotimo yes, but -I. instead of -Ilib 16:39
araraloren not seen any error 16:40
all test can run and passed
timotimo huh, strange
delete the .precomp folders and try again? 16:41
araraloren hmm, I am on fedora 23
but I am not found the prebuild binary package for it, so I am using the rpm of fedora25
is that cause this problem ?
timotimo it's actually compiling its own sha1 library 16:42
araraloren yeah, I see 16:42
ok, maybe I should do a fresh installation 16:43
thanks 16:44
I will try to install from source
El_Che araraloren: fedoraproject.org/wiki/Releases#Cu...d_Releases 16:51
(that reminds me that fedora 25 is out of support, next rakudo-pkg rpms will not include fedora 25 packages) 16:53
araraloren :) thanks 16:55
I was using fedora 26 on my notebook 16:56
That fedora 23 is a virtual machine (dev env )
El_Che I build package for a distro version on the exact same version 16:57
timotimo my desktop is a 27, my laptop might be a 25
El_Che no checking if it works with older of new releases
(some people build on a very old os release and make sure it work on newer releases) 16:58
El_Che I know stmuk experimented with flatpack. That may be an option for out of support distro releases 17:00
timotimo we also have a piece of infrastructure for appimages 17:01
btw, anybody want to build something for dev-assistant?
oh
it's already obsolete
okay
araraloren :( 17:02
I do a fresh installation, still report that error 17:03
Geth doc: bc72bc3c5b | (JJ Merelo)++ | 2 files
Some broken fragments refs #561
17:15
buggable New CPAN upload: Munge-0.1.tar.gz by CTILMES cpan.metacpan.org/authors/id/C/CT/...0.1.tar.gz 17:31
Geth doc: 63b6c5b781 | (Zoffix Znet)++ | doc/Type/Metamodel/ClassHOW.pod6
Fix docs for value of failed .^lookup call
19:35
doc: 07c4c7b3c6 | (Zoffix Znet)++ | 2 files
Fix/clarify value for failed .^lookup/.^find_method

And include examples to test for failed cases.
Fixes github.com/perl6/doc/issues/1837 D#1837 Propspec: github.com/perl6/roast/commit/931e8d0e17
synopsebot Link: doc.perl6.org/type/Metamodel::ClassHOW
synopsebot D#1837 [closed]: github.com/perl6/doc/issues/1837 `lookup` ClassHOW method description is wrong
cfa so, i dug into the whole package vs. module issue a little bit further (following on from a discussion with Zoffix a couple of days back). if the following is correct, i think it would be worth documenting on the modules page? 19:36
it seems that a .pm6 file that doesn't declare itself as a module compunit targets the GLOBAL package (as indicated by $?PACKAGE). since subs without declarators are implicitly `my`, non-exported subs are inaccessible outside of the file (i.e. lexical) scope while exported subs (is export) from these "non module" packages are added to the GLOBAL namespace table---this is all probably in line with user
expectation. 19:37
the surprise comes with `our` subs (or vars): these are also added to GLOBAL since that's the current package. so, writing `our sub say { ... }` in your .pm6 file will clobber the existing builtin.
now, if we declare that the file is a module compunit, we're no longer targeting the GLOBAL package; `our` symbols work as expected as they don't bleed into GLOBAL and can be accessed via the module name.
is the above accurate and if so, do folks agree that we need to document this? 19:38
moritz cfa: 'our sub say { }' also creates a lexical alias, which hides the builtin *inside* the module 19:40
cfa: but if you 'use' that module in your own code, that code's say() calls still use the builtin 19:41
cfa oh, interseting 19:42
interesting*
ah yes, that won't clobber 'say' in the caller context 19:43
robertle can anyone tell me where warn() is defined? I seem to be unable to find it in tghe 19:44
rakudo source
cfa control.pm6
multi sub warn, i think?
moritz yep 19:45
cfa moritz: so, the modules page opens with a very muddled description of modules (usually a file or files, typically packages, etc.)
robertle k, thanks! 19:46
cfa moritz: i'm thinking it would be better to open with a discussion of how one goes about encapsulating code and data, demonstrating the pitfalls of just wrapping things in a .pm6 and then introducing the module compunit and unit keyword 19:46
thoughts?
moritz cfa: I think the modules page should start with a clear explanation of what a module is, and what it's for 19:47
moritz cfa: but modules aren't the only way to encapsulate code (hey, we have classes and roles), so I'm not sure that's the best approach 19:47
robertle what I don't understand is why the exception lists the source location where I called warn(), rather than the location within warn() where nqp::throw is being called. magic? 19:48
moritz robertle: basically the backtrace printer excludes locations from src/core/, because they tend to be not really useful for the user 19:49
robertle: and warn() just takes the first line of the "public" backtrace
cfa moritz: agreed on all points
robertle ah! so if I want to achieve something similar in my custom warning routine, I am out of luck (unless I put it in core)? 19:50
moritz robertle: you can see the full backtrace of any excption with print $ex.backtrace.full
cfa moritz: i guess i'm saying we need a clearer explanation of what a .pm6 file actually is, what can go in there, what different compunits do, etc.
moritz robertle: I don't think so; you might have success with subclassing Backtrace, or some such
robertle I'll play around a bit... 19:51
moritz m: sub f() { die }; try f(); print $!.backtrace.full()
camelia in method throw at SETTING::src/core/Exception.pm6 line 57
in sub die at SETTING::src/core/control.pm6 line 170
in sub f at <tmp> line 1
in code at <tmp> line 1
in block <unit> at <tmp> line 1
cfa moritz: but in the case of just wanting to package up a few functions, there needs to be a warning against doing so without specifying unit, i think
moritz cfa: I don't think so
it's not dangerous 19:52
cfa perhaps not dangerous, but i'd argue surprising
like, this stuff should be obvious
i guess that's all i'm saying 19:53
Geth doc: 0726163793 | (Zoffix Znet)++ | doc/Type/Iterator.pod6
Clarify .count-only/.bool-only…

  …must adjust to account for already-pulled values.
Spotted misinformation:
  www.reddit.com/r/perl6/comments/82...1/dv9hqgl/
Propspec:
  github.com/perl6/roast/commit/88a1...93f2d99b97
synopsebot Link: doc.perl6.org/type/Iterator
cfa i'm speaking from the perspective of having to try stuff out to understand what's going on with namespacing etc.; we just need something in place that obviates that 19:54
moritz cfa: then please add those aspects to the page
cfa so long as you think i've got the important details correct above, i can give it a whirl 19:55
didn't want to add misleading or incorrect documentation
Zoffix robertle: FWIW routines have .line and .file method that can tell you where they're defined. For Rakudo core, there's also CoreHacker::Sourcery module and our SourceBaby bot that wrap .line/.file inside helper routines 19:56
s: &warn
SourceBaby Zoffix, Sauce is at github.com/rakudo/rakudo/blob/2652...l.pm6#L186
Zoffix ^ like that
m: say [.line, .file] with &warn
camelia [186 SETTING::src/core/control.pm6]
Zoffix robertle: and "is from core" magic isn't too big: github.com/rakudo/rakudo/blob/mast...#L144-L161 19:57
for backtraces I mean. Tho it's really hackish 19:58
eco: CoreHackery::Sourcery 20:00
buggable Zoffix, Nothing found
Zoffix eco: Sourcery
buggable Zoffix, CoreHackers::Sourcery 'Helper for showing actual source code locations of core subs and methods': github.com/zoffixznet/perl6-CoreHa...s-Sourcery
cfa moritz: re: 'clear explanation of what a module is', this isn't actually clear to me. it seems to refer to .pm6 contents and module { ... } 20:01
what else does the term cover? 20:02
robertle tried a CONTROL phaser, but that
seems to be fundamentally broken?
cfa (that question's for everyone, not just moritz)
moritz that's the real problem, isn't it? :-) 20:03
cfa yes
compounded for me because i'm going by what the docs say :)
moritz so, a module is a metaclass with certain capabilities
m: module A { }; say A.HOW 20:04
camelia Perl6::Metamodel::ModuleHOW.new
cfa yeah, so .HOW on a 'unit module' is Perl6::Metamodel::ModuleHOW.new
cfa but a package Foo.pm6 without unit isn't even registered as symbol afaict 20:04
moritz the "unit" is just syntactic sugar for putting module foo { ... } around the whole thing, without having to indent everything
cfa yeah
that much i get
but we use 'module' to refer to a .pm6 too, or at least seem to in the documentation 20:05
moritz yes, and that's where the confusion starts
cfa yeah
so i'm calling that a package
but i'm not sure that's correct either
moritz nah, a package is just something of metaclass PackageHOW
a compunit is closer 20:06
cfa so is Foo.pm6 just a file that use/require knows how to locate on disk? 20:06
moritz and to make the confusion perfect, we also say things like "DBIish is a module", but we mean the whole distribution with that
cfa where the contents (does it have module { ... }, class { ... } etc.) really determines its packageness, moduleness, etc?
moritz so all .pm6 files, the META file etc.
cfa aiee 20:07
moritz cfa: sounds about right
cfa okay
cfa i think this is a good starting point 20:07
japhb
.oO( We need sigils to differentiate these meanings! )
cfa the bit in the docs about module meaning different things could probably be saved for later rather than used at the outset
define what a proper module is, refer to slang use later
and by slang i mean slang not slang 20:08
:/
Zoffix robertle: no, it should work fine. What part looks broken? 20:10
m: warn 'meows'; say 42; CONTROL { when CX::Warn { say "Thou shall not $_"; .resume } }
camelia Thou shall not meows
42
Zoffix ain't got much docs for it tho it seems 20:12
robertle m: CONTROL { }; warn ""; 20:14
camelia Warning: something's wrong
MoarVM panic: Trying to unwind over wrong handler
Zoffix Filed as R#1605 20:17
synopsebot R#1605 [open]: github.com/rakudo/rakudo/issues/1605 `CONTROL { }; warn "";` says Trying to unwind over wrong handler
robertle m: warn 'meows'; say 42; CONTROL { when CX::Warn { say "Thou shall not $_"; .rethrow } } 20:18
camelia Thou shall not meows
meows
MoarVM panic: Trying to unwind over wrong handler
robertle .resume works though...
Zoffix Doesn't quite do the trick with CX::Take tho, 'cause .throw/.rethrow unwinds over wrong things 20:19
robertle found another ticket about the same thing: R#572 20:21
synopsebot R#572 [open]: github.com/rakudo/rakudo/pull/572 [has conflicts] Let NativeCall map `int` to `longlong`
robertle no, one moarvm!
Geth doc: 272850d224 | (Zoffix Znet)++ | doc/Language/phasers.pod6
Include rudimentary example for CONTROL phaser
20:22
synopsebot Link: doc.perl6.org/language/phasers
Zoffix M#572
synopsebot M#572 [open]: github.com/MoarVM/MoarVM/issues/572 MoarVM panic with CONTROL block
Zoffix M => Moar, R => Rakudo S => Spec (roast) D => Docs 20:23
robertle I was hoping I could modify the exception and then rethrow it..
Zoffix Along with some variations: github.com/perl6/synopsebot/blob/m...m6#L10-L21 + RT for RT tickets 20:24
Geth doc: 3fcd5c8e88 | (Will "Coke" Coleda)++ | doc/Type/Iterator.pod6
fix typo
21:05
doc: 513c3e80b6 | (Will "Coke" Coleda)++ | xt/words.pws
learn new word
synopsebot Link: doc.perl6.org/type/Iterator
jdv79 timotimo: you think i could just take the Cancellation obj from $sched.cue() to kill a promise i don't need anymore? 22:56
haven't tried it yet but noticed it the other day
of course i'd have to make my own Promise code since Promise never returns that obj.
timotimo i'm not actually sure how cancellations work in general. i know that for IO-related things they translate into a specific function being called from the async task ops table it has attached 22:57
that's how i made signal handler unsubscribable
jdv79 uh ok
i'll test it this weekend 22:58
timotimo it definitely won't cause code that was passed to create the promise in question to stop execution
that sentence was weird
jdv79 huh? 22:59
so if i have a Promise.in().then() it won't cancel the timer and thus abort the then? 23:00
same question regarding Promise.start(...await $chan...)?
oh 6pm - time to bounce 23:01
jnthn You can't "kill a Promise" because a Promise is just a data structure for conveying a result. start { } is a way of scheduling code to run and getting the result conveyed through a Promise. Any cancellation of code needs to be done explicitly and cooperatively. 23:13
Ditto for Promise.start and .then 23:14
Geth doc: gfldex++ created pull request #1839:
tell that whenever reacts to a closed Channel
23:15
gfldex /type/Channel could do with better examples too 23:17