»ö« Welcome to Perl 6! | perl6.org/ | evalbot usage: 'perl6: say 3;' or rakudo:, niecza:, std:, or /msg p6eval perl6: ... | irclog: irc.perl6.org/ | UTF-8 is our friend!
Set by sorear on 4 February 2011.
00:08 stanrifkin joined
pmichaud diakopter: what version of nqp? --target=past works for me 00:15
(it wasn't working as of last week, no) 00:16
you'll need a version of nqp as of 2012.06.1-16-gbec0eba or later. 00:18
afk
00:25 samlt left
diakopter ah 00:39
thanks
oh, maybe the toqast branch (which I'm using) didn't get that patch yet 00:40
diakopter tries just to be sure 00:41
nqp --target=past -e "say(3)" 00:43
dumps some output, but then ends with: 00:44
No method cache and no find_method method in meta-object current instr.: 'parrot;Data;Dumper;Default;pmcDefault' pc 242 (runtime/parrot/library/Data/Dumper/Default.pir:203)
(and a stack trace) 00:49
the output just before the error is: "value" => PMC 'int' 00:50
00:55 seldon left 01:10 mikemol left 01:34 tyatpi joined 01:45 mikemol joined 01:48 Entonian joined 02:08 Guest30914 left, Khisanth left 02:23 Khisanth joined 02:25 Entonian left 02:47 xinming joined 02:48 stanrifkin left 02:50 xinming_ left 02:57 stephenlb left 03:07 adu joined 03:13 kcwu joined 03:31 tokuhiro_ joined
[Coke] ugh. someone borked pugs in roast. 04:19
04:20 tokuhiro_ left
lue rakudo: my int8 $a = 255; say $a; my int8 $b = 256; say $b; # this shouldn't work, should it? 04:23
p6eval rakudo 3e0008: OUTPUT«255␤256␤»
diakopter r: my int8 $a = 3827982735982739482735523; say $a 04:24
p6eval rakudo 3e0008: OUTPUT«522711971␤»
lue r: say 522711971.base(16); 04:25
p6eval rakudo 3e0008: OUTPUT«1F27F3A3␤»
04:26 birdwindupbird joined 04:29 tyatpi left 04:32 _jaldhar left
diakopter r: my int2 $a = 3827982735982739482735523; say $a 04:34
p6eval rakudo 3e0008: OUTPUT«522711971␤»
04:39 jaldhar joined
lue r: my int8 $a = 0xFFFFFFFF; say $a; say $a.base(16); # this is an interesting bug 04:40
p6eval rakudo 3e0008: OUTPUT«-1␤-1␤»
moritz didn't know rakudo implemented int8 04:44
lue in src/core/natives.pm (although it looks a bit terse. I'm digging through rakudo's code to see if I can find what might be going wrong) 04:46
moritz well, what you're doing wrong is assigning a number that's too big to hold in an int8
not much rocket science necessary to diagnose that :-) 04:47
lue Of course, but it's handling that wrongly (unless int8 doesn't mean 8-bit, my int8 $a = 256 should fail) 04:48
moritz but as the comment says, it's stubbed in, not really implemented
diakopter but should it throw an error, always be 255 if it's higher, or do some modulus pretending to rollover 04:49
lue (I found nativesize in NativeHOW, but it doesn't seem to do much there.) 04:50
moritz it is mainly used for NativeCall.pm 04:51
04:52 jaldhar left
lue I just started messing with native types (for no reason) and found these interesting problems, that's all. 04:52
04:55 jaldhar joined 05:18 thelazydeveloper left 05:19 adu left 05:20 adu joined 05:21 adu left, adu joined 05:22 adu left 05:23 adu joined 05:24 adu left, adu joined 05:25 adu left, adu joined 05:26 adu left
dalek ast: 1e47107 | coke++ | / (20 files):
pugs fudge
05:29
gs.hs: 7c05564 | coke++ | t/spectest.data:
these tests have changed too much to run
05:30
[Coke] there, that's a little better. 05:42
r: say 22847 * .4 - 9079 05:43
p6eval rakudo 3e0008: OUTPUT«59.8␤»
06:45 birdwindupbird left 07:12 zby_home_ joined 07:47 fgomez left 07:49 fgomez joined 07:51 GlitchMr joined 08:07 samlt joined 08:14 seldon joined 08:15 seldon left 08:16 seldon joined
sisar hi, maybe someone can help me with C++ structs: ideone.com/o2SlU . Why do line 9 and line 10 both work ? Are the innner braces in line 10 just ignored ? 08:16
seldon Yes and no. What you do in line 9 is inherited from C and generally considered bad style; it fills the POD struct in order of appearance. In this particular case that comes out the same, but if you fill substructs/arrays partially, you'll see differences. 08:24
Compare codepad.org/lu0FnPv3 08:29
sorear huh, wow
a fact about C that I didn't know
I thought you needed the braces 08:30
seldon++
seldon You do not technically need them, but you really should want them there.
Another little-known C fact: char const *foo = "Hello" ", " world."; is the same as char const *foo = "Hello, world."; This is useful for multi-line literals. 08:31
08:32 kaare_ joined
seldon I'm sorry, that's char const *foo = "Hello" ", " "world."; of course. 08:32
shachaf That C fact is much less little-known than the other one. 08:33
It's also used a lot for e.g. preprocessor things. 08:34
seldon Huh. I always thought it was the other way around.
shachaf Well, I didn't know the brace thing, at least.
On the topic of fun C facts: Can you guess what mauke.hopto.org/stuff/c/sizeof.c prints? 08:35
seldon Depends on the platform. How large is int?
And is ASCII assumed?
On x86 and x86-64, it would be the ascii value of e, which is 101, if I'm not mistaken. 08:36
sorear *sequesters*
shachaf seldon: On your platform.
sorear I made the same guess 08:37
shachaf Try it and see!
sorear but I don't really care about behavior in this case 08:38
seldon Ah, wait. sizeof(0) is not int, it's siez_t.
*size_t
shachaf The answer to that puzzle was surprising enough that it made me change my C habits.
seldon So that could be 8.
sorear sizeof(0) is stupid code and I think it's safe to just pretend it's undefined behavior
since 0 doesn't realllly have a type
shachaf shachaf@carbon:~/c$ cc -o sizeof sizeof.c && ./sizeof 08:39
1
sorear the only other circumstance I can think of where the type of 0 actually matters is implicit argument promotions for printf, where 0 is treated as int
seldon 0 is of type int, yes. And the size_t thing I said just now was stupid, please ignore it. 08:40
sorear mmh, stupid precedence.
seldon Oooh.
Right, sizeof binds less strongly than []. I don't think I've ever run into that before, and I've been coding C and C++ for over a decade. 08:41
shachaf sizeof on values doesn't actually use parentheses at all. 08:42
Though I think [] is the only case where that makes a noticeable difference.
Still, I've stopped doing sizeof(val). :-)
seldon en.cppreference.com/w/cpp/language/...precedence <-- there are a few others, but you'd not expect to use them on a size_t. 08:43
Or, if they're unary, the question does not arise. 08:44
Mind you, you don't *really* expect to use [] on a size_t either.
If you use index[array] in production code, you ought to be fired.
shachaf So no use for this fact in the underhanded C contest. :-( 08:46
seldon You can still use that sizeof's argument is not evaluated at runtime. n = sizeof(x++); does not change x.
Nor sizeof x++, if you prefer. 08:47
shachaf (sizeof x)++
seldon That will get you a compiler error about requiring an lvalue. 08:48
shachaf Yes.
sisar back 08:57
seldon++: thanks !
seldon You're welcome.
Bringing the discussion back to perl 6, I have written tests for my little brainfuck module now, and the utility class I wrote to do that has, I think, the potential to be more useful than the actual module. It's modelled after IO but reads/writes from/to a Str -- the idea is akin to C++'s stringstream.
sorear Does n = sizeof(n++) count as a sequence point error? 08:58
seldon No, n++ is never evaluted.
sorear seldon: bear in mind that i/o internals are not at all stabilized 08:59
your module sounds useful today
seldon Well, if it is superceded by something more solid, I have no problems with that. And there are some design issues; mostly how to handle eof and the IO methods a stringstream cannot reasonably support. 09:02
And, you know, it was thrown together in a day by someone who's been writing perl6 for a week, so there *may* be room for improvement in the implementation.
codepad.org/jpcgJTS9 <-- this is what I have now. 09:03
tadzik seldon: I don't quite understand why you have both a public accessor for $.eof and check_eof method 09:06
seldon the check_eof method is meant to set eof to true if $!data is empty, since eof is only reached after you try to read past the end of the file.
eof handling is not really there yet, though.
tadzik I see. I just think it's bound to confuse people, who would call .eof and see a false value where it should really be true, etc 09:07
maybe just go for a private $!eof and a public method eof which does the calculations anyway
seldon Is that consistent with IO?
If I open an empty file, is it eof right away?
tadzik I don't know 09:08
seldon I'll check.
No, it's not. 09:10
It's the same behaviour as in other languages, which I think is good. The eof flag is only set after something has tried to read past the end of the file.
tadzik so you would tell users to always use .eof and the rest of the module is responsible for always keeping it up-to-date? 09:12
seldon I want users to be able to use eof when they'd use eof on an IO object. 09:13
09:13 sergot joined
sergot hi o/ 09:13
seldon Hi
It should be as much of a drop-in replacement as possible.
tadzik hello seldon 09:14
erm, sergot
seldon The main eof design question, I think, is what happens if a StringIO is eof and something writes to it. Does it remain eof or do the write ops unset it? And what if what was written to it is an empty string or suchlike? 09:16
09:23 MayDaniel joined 09:27 nodmonkey joined 09:31 seldon_ joined, seldon left, seldon_ is now known as seldon 09:36 _ilbot joined
seldon r: ''.encode.decode; 09:41
p6eval rakudo 3e0008: ( no output )
seldon r: say ''.encode.decode;
p6eval rakudo 3e0008: OUTPUT«␤»
seldon To the .deb package building cave! 09:43
09:44 Infiltrator joined
Infiltrator Hi all. Could somebody please explain to me what is meant by "perl 6 is the little sister of perl 5"? Is perl 6 not planned to superseed perl 5? 09:45
moritz perl 6 is planned to superseed *all* other dynamic languages :-) 09:46
but the perl 5 folks will continue to develop their language, modules etc.
nodmonkey I take the 'little sister' to mean younger, less mature. I agree it does have connotations that it is or is intended to be 'perl lite' or something. The language and design of the perl6.org site is an interesting one; I hope it's not something that turns people off. 09:51
moritz the idea is to turn off the wrong kind of people 09:52
seldon I have a hard time googling this: In IO.pm I see proto method print(|$) { * }; is this meant to auto-flatten stuff that doesn't fit the other print signatures? 09:53
moritz no
it is supposed to match any possible argument list
the proto re-dispatches to the various multi candidates 09:54
so its signature must allow anything that any of its candidates can match
jnthn good noon, #perl6 :) 09:55
seldon it seems to do that without the proto too, though.
since the other prints are declared with multi
jnthn seldon: A proto like the one you saw in the setting gets auto-generated for you.
09:55 ivan`` joined
seldon Ah. 09:55
sorear good jnthnnoon
jnthn seldon: Or, if you add candidates in a nested scope, the outer proto is cloned. 09:56
hi sorear :)
nodmonkey The risk being you turn off new interest from the 'right kind of people' too because they don't see true objective of having pretty butterflies. 09:57
moritz there's that, yes 09:58
Timbus im more annoyed by the barren wasteland that is the rakudo website 10:01
annoyed is the wrong term 10:02
irked? worried? idk. its deader than a zen rock garden
nodmonkey It keeps away the other wrong kind of person.
Timbus a couple of people offered to make a more modern looking layout for p6.org but never delivered 10:03
not that they were really encouraged to do it anyway :< 10:04
moritz speaking of layouts 10:07
th doc.perl6.org website could use some layout love
Timbus I would do it, if I weren't an awful designer 10:09
my design choice is always 'throw bootstrap.css at it'. working pretty well so far 10:10
seldon Okay, I think I gave the StringIO class reasonably sane eof behaviour. What you write in one end comes out the other, and writing to an eof'd stream uneofs it. StringIO class: codepad.org/yySYEpMX Tests: codepad.org/K0ZNY23d 10:13
moritz seldon: now please put it in a git repo, add a META.info file and make it available as an installable module :-) 10:14
seldon Is there a way to do it with mercurial? 10:15
Timbus blasphemer!!! 10:16
seldon I thought you'd like mercurial, what with the butterfly and all. :o
Timbus hg-git.github.com/
moritz well, we might not want to limit ourself to git and github forever 10:17
so it would be a nice experiement to do it with hg, and tadzik and I will try to patch the ecosystem to make it work
Timbus s' a good idea 10:18
moritz and I think panda is sufficiently modularized that it might not be such a big change 10:19
seldon If that doesn't pan out, I've been meaning to look into git somewhen anyway. That time could be now, I suppose. 10:20
jnthn Timbus: The Rakudo website last got updated just over a week ago. That doesn't feel so dead. What kind of aliveness are you wanting? :) 10:21
More content beyond release announcements? Nicer layout/design? Something as "first post" on the homepage that isn't a release annoncement? I can kinda see the point of all of these... 10:22
Timbus all of those 10:23
yep
seldon More release announcements.
moritz seldon: that's just a question of time :-)
10:23 Patterner left
seldon A higher release announcements / time ratio. 10:24
moritz but why?
dalek c: 5f283aa | moritz++ | / (2 files):
[Positional] method of; indexing is done with postcircumfix; update TODO
seldon Because bleeding edge. :P
moritz for many, one per month is close to too much
if you want more, build stuff from git
seldon I'm not entirely serious.
moritz ok :-)
10:24 Psyche^ joined, Psyche^ is now known as Patterner
Timbus i always enjoyed reading the parrot blogs and stuff a few years ago. why aren't your 6model and advent calendars and perlgeek.de blogs all on rakudo.org? theyre all relevant 10:25
moritz Timbus: there's planetsix.perl.org for getting them all
Timbus yes this is true
moritz nqp: my $x := try { 1 }; say($x) 10:26
p6eval nqp: OUTPUT«1␤»
moritz nqp: my $x := try { 42 }; say($x)
p6eval nqp: OUTPUT«42␤»
Timbus but 'a new month passed heres what changed' is just pretty 'eh'
moritz stupid
Timbus also what happened to try.rakudo.org that was a neato page 10:27
moritz lack of maintainer happened to it
Timbus it needs maintenance? 10:29
moritz yes
seldon Thus spake the master programmer: "Though a program be but three lines long, someday it will have to be maintained." 10:30
shachaf I have a tool that makes sure my three-line-long programs will never have to be maintained.
moritz shachaf: is it called 'rm'? 10:31
huf either that, or a text editor
shachaf Yep!
huf you add more lines to it and maintain that!
Timbus cant you share p6eval's backend
moritz Timbus: p6eval executes each statement in a separate interpreter/compiler 10:32
Timbus: so you can't remember declarations etc.
Timbus bah 10:33
moritz "bah" is a good reaction, yes 10:34
10:49 spaceships joined 11:04 spaceships left
dalek kudo/nom: 9428315 | moritz++ | src/Perl6/World.pm:
make World.rethrow more robust, harmil++
11:10
11:18 samlt left, mikemol left 11:19 MayDaniel left, samlt joined 11:22 whiteknight joined 11:23 whiteknight is now known as Guest46314
moritz any idea why this patch fails? moritz.faui2k3.org/tmp/0001-do-not-...rame.patch 11:26
$ ./perl6 --ll-exception -e 'try { die "foo" }; say $!.backtrace.perl' 11:27
Could not find symbol 'Backtrace::&Frame'
the backtrace points to $new.push: Backtrace::Frame.new( ... ) 11:28
r: my class A::B { }; my class A { method x { say A::B } } 11:29
p6eval rakudo 3e0008: ( no output )
moritz r: my class A::B { }; my class A { method x { say A::B } }; A.x
p6eval rakudo 3e0008: OUTPUT«Could not find symbol 'A::&B'␤ in method x at /tmp/OvsGZroBwS:1␤ in block <anon> at /tmp/OvsGZroBwS:1␤␤»
moritz oh
so how do I do that then? 11:30
jnthn That should probably work. Though I suspect the workaround is...
moritz r: my class A { class B { ... }; method x() { say A::B } }; my class A::B { }; A.x 11:31
p6eval rakudo 3e0008: OUTPUT«B()␤»
jnthn r: my class A { ... }; my class A::B { }; my class A { method x { say A::B } }; A.x
p6eval rakudo 3e0008: OUTPUT«A::B()␤»
jnthn It's meant to steal the .WHO of the stub. Wonder why it doesn't.
moritz so, it's a bug? 11:32
11:32 birdwindupbird joined 11:33 GlitchMr left 11:34 mikemol joined
moritz ... submitted 11:35
11:42 MayDaniel joined 11:53 JimmyZ joined
dalek c: f521d36 | moritz++ | lib/Backtrace/Frame.pod:
document Backtrace::Frame
11:53
12:21 nodmonkey left 12:29 topologist left, topologist joined 12:35 birdwindupbird left 13:17 GlitchMr joined
masak hola, #perl6 13:20
sisar hi masak ! 13:23
eiro ola everybody
colomon o/ 13:30
13:31 MayDaniel left 13:48 tokuhiro_ joined 13:50 birdwindupbird joined 14:03 thelazydeveloper joined 14:07 cognominal_ left
tadzik oh hey 14:12
14:13 MayDaniel joined
arnsholt jnthn: You around? 14:24
14:29 PacoAir joined 14:35 tokuhiro_ left, tokuhiro_ joined 14:39 tokuhiro_ left
jnthn hi, arnsholt 14:41
arnsholt Looking at CArray.c, it looks like it supports most of the different sized int/num types, that right? 14:42
jnthn I don't know that it considers size yet.
oh, I'm mistaken! :)
Yes, it seems to do those :) 14:43
arnsholt Excellent. Then I'll remove that entry from the TODO file as well 14:44
I'm starting to think about sized things for structs
14:44 moukeddar joined
jnthn nice :) 14:45
arnsholt Do you happen to know off-hand if there's a single correct answer for packing non-word sized things?
jnthn Just need to be careful with alignment.
It's generally about where things start.
14:45 moukeddar left
arnsholt Yeah, ISTR that usually things should be word-aligned, no? 14:45
jnthn It's a bit more subtle than that. 14:47
arnsholt I'd like to do something about not being able to assign to (non-reference) struct fields as well, but that'll require more guidance I think
jnthn A struct which is just a bunch of int8s will have them laid out one after the other, for example.
It depends on the contents of the structure.
arnsholt Right 14:48
So I'll need to keep track of if I have partial words left for small-ish things?
14:48 seldon left
jnthn Yeah 14:49
en.wikipedia.org/wiki/Data_structur...cts_on_x86 has a bunch of examples for how it is on x86/x64
14:49 seldon joined
arnsholt Awesome. Cheers! 14:49
14:51 nodmonkey joined
arnsholt A double is apparently eight-byte-aligned on Windows and 4-byte-aligned on Linux. Great =) 14:51
14:52 nodmonkey left
jnthn arnsholt: See also www.wambold.com/Martin/writings/alignof.html 14:53
arnsholt Oh, that's useful!
Does Parrot have any official types similar to uint8_t and friends, or should I just use the C99 types? 14:56
tadzik I suppose using C99 types may get nasty on Windows, no? 14:58
jnthn It defines Parrot_int1 (for 1 byte = 8 bits), etc.
tadzik: Yeah, 'cus MSVC doesn't do C99
tadzik right
arnsholt Excellent 14:59
Yeah, I remember Parrot targeting C89
(targetting?)
seldon vc2010 has stdint.h (and <cstdint>). Not much else from C99, though.
Up to vc2008, you had to roll your own typedef unsigned __int64 uint64_t; 15:01
hoelzro hi Perl6 folk, I found some interesting and (to me) unexpected behavior with Rakudo and temp variables 15:02
15:02 lichtkind joined
hoelzro running this script should demonstrate what I mean: gist.github.com/3071300 15:02
I see weird behavior when using temp variables and recursive calls 15:03
moritz r: gist.github.com/3071300
p6eval rakudo 942831: OUTPUT«before: 0␤after: 0␤before: 0␤after: 10␤»
moritz yep, looks like over-sharing 15:04
shoudl be all 0
arnsholt Hmm. Apparently my gcc doesn't like ALIGNOF 15:06
hoelzro right
moritz: is that a bug?
moritz hoelzro: yes
hoelzro yay, I found a bug!
lichtkind hoelzro++ :) 15:08
jnthn away for a bit 15:12
15:24 mtk joined 15:26 JimmyZ left 15:27 lue left
pmichaud good morning, #perl6 15:31
seldon Good afternoon. 15:33
masak pmichaud! \o/ 15:40
hoelzro let's say I have a superclass and a set of subclasses. I'd like to have a create method on the supreclass to serve as a factory method for subclasses, but Rakudo complains that it doesn't have a definition for the subclass in the factory method. Here's an example of what I'm trying to achieve: gist.github.com/3071368
15:41 lue joined
GlitchMr perl6: say 'a' x 30 ~~ /a?a?a?a?a?a?a?a?a?a?a?a?a?a?a?a?a?a?a?a?a?a?a?a?a?a?a?a?a?a?aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/ 15:42
p6eval rakudo 942831, niecza v19-13-g442e075: OUTPUT«(timeout)»
pmichaud hoelzro: that looks to me like a variant of RT #114034
arnsholt Durr. Apparently GCC only has __builtin_offsetof(t,m) not offsetof(t,m) 15:43
seldon You have to #include <stddef.h> for offsetof
arnsholt Aha! That explains it. Thanks! 15:44
hoelzro ooooh
pmichaud: thanks!
so it's not a declaration order thing at all
I'm thinking of not even using a subclass relationship and just defining a local "Stanzaesque" role for each class to consume 15:45
pmichaud technically these aren't subclasses in your gist :)
they're just classes that are in three namespaces sharing a common Hexe::Stanza root 15:47
hoelzro pmichaud: right, I forgot that bit =)
masak r: say my @pascal = 1; say @pascal = @pascal, 0 Z+ 0, @pascal for ^10 15:49
p6eval rakudo 942831: OUTPUT«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␤1 10 45 120 210 252 210 120 45 10 1␤»
masak man, that is short ;) 15:50
tadzik This is madness!
15:50 moukeddar joined
masak this. is. #perl6. 15:50
tadzik \o/ 15:51
seldon That is cool, at any rate.
tadzik >-<-o
tadzik falls into a well
masak I didn't even push him!
tadzik I'm a ghost of an unpushed commit
15:52 topologist left
seldon If I want to supply a conversion operator, do I just declare a method Str returns Str? 15:55
masak aye. 15:56
pmichaud multi method, probably
seldon Why multi?
pmichaud you probably don't want to overload the meaning of .Str for the type object
masak r: my @a = [1, 2], [3, 4]; my @b = [10, 20], [30, 40]; say (@a Z+ @b).perl; say (@a ZZ+ @b).perl
p6eval rakudo 942831: OUTPUT«(4, 4).list␤(11, 22, 33, 44).list␤»
masak \o/ 15:57
seldon Ah.
So multi method Str(StringIO:D) returns Str { ... } ?
pmichaud seldon: yes, something like that
need a colon after the D
seldon Right, right. Typo.
hoelzro I have a type (Hexe::JID) that can create an instance from a String; is it possible to declare a type constraint on a method parameter that would automatically coerce a Str to a Hexe::JID?
tadzik as Str 15:58
hoelzro ex. has Hexe::JID $!from; submethod BUILD(:$!from) {}
tadzik r: sub foo($a as Str) { say $a.WHAT }: foo 5
p6eval rakudo 942831: OUTPUT«===SORRY!===␤Confused␤at /tmp/bji8U351ly:1␤»
tadzik r: sub foo($a as Str) { say $a.WHAT }; foo 5
p6eval rakudo 942831: OUTPUT«Str()␤»
tadzik I think that's what you mean
pmichaud tadzik: I think he wants to go the other way
hoelzro I do
tadzik hmm, let me reread that
oh, I see
pmichaud he wants to go from Str to Hexe::JID
hoelzro I want to coerce a Str into a Hexe::JID 15:59
pmichaud I'm not sure there's a way to do that (that works right now)
tadzik there's a way to declare something of this sort I think; setting does it in a few places
pmichaud the problem is the coercion to something in a nested namespace
tadzik oh hmm
pmichaud although I did have a proof of concept of a coercer yesterday.... just a sec 16:00
16:00 MayDaniel left
hoelzro ok 16:00
thanks for answering all of my silly questions, btw =)
I intend to write a blog post after I'm done with this to illustrate all the stuff I've learned
and maybe enhance the docs a bit =) 16:01
pmichaud gist.github.com/3063969 # writing a Type() coercer
sisar ++hoelzro
pmichaud ...but I don't know what the 'as' keyword ends up using to do its coercion. Just a sec
masak this is for moukeddar :)
r: my @mothers = <Anne Vivian Sylvia>; my @fathers = <Ben Waldo Thomas>; for @mothers Z @fathers -> $mother, $father { say "$mother is married to $father" } 16:02
p6eval rakudo 942831: OUTPUT«Anne is married to Ben␤Vivian is married to Waldo␤Sylvia is married to Thomas␤»
masak r: my @rows = 1..3; my @columns = 1..5; for @rows X @columns -> $row, $column { say "($row, $column)" } 16:03
p6eval rakudo 942831: OUTPUT«(1, 1)␤(1, 2)␤(1, 3)␤(1, 4)␤(1, 5)␤(2, 1)␤(2, 2)␤(2, 3)␤(2, 4)␤(2, 5)␤(3, 1)␤(3, 2)␤(3, 3)␤(3, 4)␤(3, 5)␤»
pmichaud looks like 'as' is expecting the method form to work :-/
gist.github.com/3071483 # example using 'as'
moukeddar wow, never saw somthing like this 16:04
pmichaud If we switch 'as' to instead call postcircumfix:<( )> on the type object, and combine that with sorear++'s suggestion at irclog.perlgeek.de/perl6/2012-07-07#i_5793391, then we could get 'as Type' to use either the Type or method form.
hoelzro pmichaud: thanks!
pmichaud++
pmichaud note that the use of postcircumfix:<( )> as coercer is already mentioned/covered at S13:135.... I think we may just need to get other parts of the spec to start using that. 16:06
masak moukeddar: Perl 6 is quite cool lon all levels. this is just the "data processing" level. I really like the text handling and object orientation as well. and there are other bits too which I can't think of now.
on*
moukeddar: did you see how we do the fibonacci sequence? :) 16:07
pmichaud Also, perhaps we should update S13 to note that the invocant to postcircumfix:<( )> should be marked :U (or :T) if it's to be used as a coercion.
moukeddar i could say this is shocking to me, a whole new paradigm (i guess)
masak r: constant @fib = 1, 1, *+* ... *; say @fib[^10]
p6eval rakudo 942831: OUTPUT«1 1 2 3 5 8 13 21 34 55␤»
masak moukeddar: *+* just means "take two things (not yet specified) and add them" 16:08
moukeddar seriously?
masak moukeddar: we call the '*' term "Whatever".
r: say (*+*)(3, 4)
p6eval rakudo 942831: OUTPUT«7␤»
masak moukeddar: srsly. 16:09
tadzik see also: { $^a + $^b } 16:10
which look cleaner, while being almost exactly the same things
or: -> $a, $b { $a + $b } 16:11
or sub ($a, $b) { $a + $b }
moukeddar is this like lambda expressions?
tadzik yep
tadzik afks
moukeddar nice :)
seldon These fit in &argument slots, right? 16:12
masak yes, they are blocks that bind parameters. which is another way of saying "yes, they are lambda expressions" :)
the thing that *+* helps you with is that you don't have to type the {} for the block, and you don't have to name $^a and $^b. 16:13
moukeddar but without the "=>" operator
masak from C#?
with us it's ->, like tadzik wrote above.
and we write it before the params, not after. 16:14
moukeddar now that's weird lol
masak if you squint, it looks like a tilted λ :) 16:15
16:16 cognominal joined
seldon Since there are already unicode operators, would it not be easier to just use λ? 16:17
16:17 Guest77817 left
moukeddar kinda, you know what baffles me the most, is how it gets parsed, 16:17
16:17 ponbiki joined, ponbiki is now known as Guest19154
masak moukeddar: not so strange. the parser sees a '->' and knows that a parameter list is coming, and then a block. 16:18
moukeddar now i undertsant that article you sent me the other day :) Compilers Compilers
masak cognominal: so, 'cōgnōmen' means 'nickname', basically? and 'cognominal' means 'related to/having something to do with nicknames'. 16:19
moritz is still baffled that Perl 6 can be parsed, at least mostly :-)
masak doesn't know which way to parse moritz' sentence ;)
are you mostly baffled, or that it can be mostly parsed? :P
cognominal masak, yup. 16:20
moritz mostly parsed
dalek p: 8137a66 | pmichaud++ | src/QRegex/Cursor.nqp:
[qregex] Enable !cursor_more to receive other (ignored) named parameters.
16:21
masak tadzik: -> $a, $b { $a + $b } and sub ($a, $b) { $a + $b } are different beasts in that only the latter binds 'return'.
only the latter takes a continuation that 'return' executes :)
cognominal maska, also in the production/consumption world that rules us all, I am supposed to be a cog which works in a nominal (in Nasa jargon) way meaning according to spec. 16:22
masak
pmichaud there's also a difference between -> and sub in how $_ is set up.
cognominal masak: en.wikipedia.org/wiki/Cognomen 16:23
masak cognominal: nod. so there is a double meaning, too. I think before Strasbourg I had only heard (or at least understood) the latter meaning.
cognominal: yes, I just saw that page :)
moritz pmichaud: well, the default signature is different
cognominal www.thefreedictionary.com/Cognominal
moritz hm 16:24
r: $_ = 4; (-> { .say }).()
p6eval rakudo 942831: OUTPUT«4␤»
moritz r: $_ = 42; (sub () { .say }).()
p6eval rakudo 942831: OUTPUT«Any()␤»
pmichaud r: $_ = 4; (-> $x { .say })()
p6eval rakudo 942831: OUTPUT«Not enough positional parameters passed; got 0 but expected 1␤ in block <anon> at /tmp/SmyOsRJDpt:1␤␤»
moritz right, they are different
pmichaud r: $_ = 4; (-> $x { .say })(3)
p6eval rakudo 942831: OUTPUT«4␤»
moritz r: $_ = 4; (-> $_ { .say })(3) 16:25
p6eval rakudo 942831: OUTPUT«3␤»
pmichaud r: $_ = 4; (sub ($x) { .say })(3) 16:27
p6eval rakudo 942831: OUTPUT«Any()␤»
cognominal masak, tadzik, jnthn, btw, my stuff in codeview starts to work even if its place in the great scheme of things is not readily apparent. I am waiting to test it with hairy perl6 parse trees. github.com/cognominal/codeview 16:28
moukeddar so much to learn
masak cognominal: interesting. keep us posted. 16:29
cognominal masak: I have yet to hook it up with Small Federated Wiki. Anyway, I learnt a few html5 trick by reading their code. 16:30
masak nice :) 16:31
sisar cognominal: are you talking about github.com/WardCunningham/Smallest...rated-Wiki ? 16:43
cognominal yup
sisar: there is not much there but the code is clean unlike mine and there are a few things I need and I would be unable to write by myself. 16:45
Basically it is a html5 wiki. I use html5 as a globbing term for everything useful in the modern web. 16:46
16:46 thou joined
sisar cognominal: i'm still trying to understand _what_ is the Smallest Federated Wiki.. is it a new kind of wiki-engine ? 16:46
cognominal Currently it is a way for cunninngham, the inventor of the wiki, to have a front end for his domotic toys. 16:48
sisar cognominal: and what will hooking up zbrew with SFW achieve ? 16:49
masak 'domotic'?
cognominal but the building bricks are general enough to be geared to do almost anything wikilike.
In a few weeks, I would like to have an irc like tool and be able to drag and drop rakudo code in my code highlighter. 16:51
Eventually I want rules in the parse path pane to link to Perl6 tutorials.
irc is so passé :)
sisar oh, 'Should eventually be a plugin for Small Federated wiki ", now i get it. 16:52
16:53 moukeddar left
cognominal sisar: sorry the doc as it is is very much for my own consumption 16:53
masak: en.wikipedia.org/wiki/Home_automation sorry domotique is the french term
sisar cognominal: yeah, looks like that 16:54
:)
sisar afk
cognominal sisar, that will change soon
anyway, eiro told me I should enter a proselytism phase. :) 16:55
16:58 topologist joined
cognominal masak: so, is cognominal an autopun? 16:59
hoelzro if I have an attribute name in a variable (let's say $name), can I get the value of that attribute from self? 17:09
btw, the attribute is private
if that helps/hurts
jnthn Well, it's easy if it's public, since you just call the accessor. :) 17:10
Private is harder.
You can get the attribute meta-object and then use .get_value on that.
17:10 lichtkind left
jnthn iirc 17:10
What's the use case, though? Often there's a better way :) 17:11
hoelzro jnthn: I'd like to implement gist to print out my object's attributes
ommitting attributes with an undefined value 17:12
jnthn oh
r: class A { has $!x = 42; method m() { self.^attributes.map({ .name ~ ' = ' ~ .get_value(self) }).join("\n") } }; A.new.m.say
p6eval rakudo 942831: OUTPUT«$!x = 42␤»
hoelzro ok, thanks! 17:14
cognominal jnthn, have you though of the way to access the p6 parse tree. It will piss me off if I go public with my tool displaying a javascript or coffeescript parse tree 17:15
arnsholt Hmm. My initial attempt doesn't cause a segfault or break any existing tests. Not sure if I should be suspicious or pleased 17:16
Or both, perhaps
cognominal I am creating it in the first place for displaying Perl 6 stuff.
jnthn cognominal: Think I know a way, just gotta try coding it up :) 17:18
cognominal jnthn++ 17:19
coffeescript and jquery are already flooding me, so I have to delegate the hairy Perl 6 part 17:20
arnsholt Hmm. I don't think 4399404817 actually fits in an int8 17:22
benabik Not even close. 17:23
arnsholt jnthn: Should the get_attribute method care about the number of bits in the attribute it's fetching? 17:24
17:26 am0c joined
jnthn arnsholt: The ref case should returns the attribute's location; it's up to the op doing the reading to se sure it pays attention to the correct number of bits. 17:26
17:26 benabik left
arnsholt Yeah, that's what I thought 17:27
So I have: is $cobj.int, 17, 'getting int from C-created struct';
17:27 benabik joined
arnsholt Where $cobj.int is specced as an int8 in the Perl class and char in the C code 17:28
And is claims that $cobj.int is 4399404817, which is a bit on the high side 17:29
Any thoughts?
17:29 birdwindupbird left
jnthn Hmmm. 17:31
arnsholt Same thing happens if I create an intermediate int8 and test that, but the value is slightly different 17:32
Looks like it's reading into the padding space
jnthn Ah, yes, repr_get_attr_int doesn't support sized attributes in general at the moment. 17:34
That's gonna need a little thought.
17:34 benabik_ joined
arnsholt Ah, right 17:34
17:36 benabik left, benabik_ is now known as benabik
arnsholt I'll just leave it for the time being then 17:36
17:36 snearch joined
arnsholt Looks like it'll be pretty straightforward, FWIW 17:36
sorear good * #perl6 17:56
arnsholt Hey sorear 17:57
18:01 Guest19154 left 18:10 samlt left 18:18 rsimoes joined 18:19 adu joined
sorear hello arnsholt 18:20
18:22 quietfanatic joined
quietfanatic r: say 4399404817.fmt("%x") 18:23
p6eval rakudo 942831: OUTPUT«6399711␤»
adu hello sorear
quietfanatic yup
jnthn: Shouldn't a simple +& 255 work around the problem for now? 18:25
or arnsholt: rather
18:27 samlt joined 18:28 spider-mario joined
arnsholt quietfanatic: I suppose, but we can't really tell users of Zavolaj that they'll have to handle that kind of stuff by hand 18:48
quietfanatic Yeah, I meant in Zavolaj itself 18:53
18:53 nodmonkey joined
quietfanatic or is the repr_get_attr_int jnthn++ was talking about part of zavolaj too? 18:53
I probably shouldn't be kibbitzing in matters I don't actually understand :)
18:55 spider-mario left
arnsholt repr_get_attr_int is in the 6model part of NQP, actually 18:58
And it has to do the correct kind of pointer deref, depending on the type of the attr you're getting 18:59
Which is the part that requires a bit of thought
19:03 Woodi left
quietfanatic Is this in Parrotland, or Cland? 19:05
arnsholt NQP C code 19:06
19:06 GlitchMr left
quietfanatic Hm. 19:07
19:20 mucker joined 19:24 paul_ joined
paul_ hi all 19:24
sorear Hello and welcome to #perl6. 19:25
paul_ i 've been using perl 5 for sometime now
just a general hacker that uses perl5 for computational biology problems
i just stumbled upon perl6 and was wondering if i should switch over
any advice?
quietfanatic Hm, well, it depends on what you want.
paul_ well, maybe I should rephrase: why would I want to switch to perl6? what are the benefits? 19:26
quietfanatic Do you mostly want more convenient programming? Go ahead and give Perl 6 a try.
If you want speed and stability, you're better off staying with Perl 5, at least until Perl 6 matures some more. 19:27
seldon Computational biology means lots of number crunching, right?
quietfanatic Hm, the benefits
paul_ yeah more convenient is better...I dont' need to worry much about speed and stability
i'm more into the string handling of DNA sequences rather than statistical number crunching 19:28
how long will Perl 5 be supported? 19:29
quietfanatic As far as I know, Perl 5 will be supported as long as there are people wanting to use it.
paul_ what do you think the usage of perl 5 versus perl 6 is?
quietfanatic Hmm...
I'm not sure what you mean 19:30
19:30 birdwindupbird joined
quietfanatic oh, you mean, how many and what kind of people are using each? 19:30
paul_ yeah
quietfanatic Perl 5 is still clearly dominant. Most of the people using Perl 6 for real work are early adopters.
paul_ is perl 6 syntax easier to understand and write? 19:31
masak paul_: yes, but it depends who you ask too.
paul_: I once had a DNA string that was so long it crashed Perl 5's regex engine. Rakudo was slowish but did fine with it. 19:35
paul_ what is Rakudo?
quietfanatic masak: really? That's amusing. 19:36
Rakudo is one implementation of Perl 6
it's the most complete one so far.
paul_ will it work on Mac X or cygwin on Windows? 19:37
masak quietfanatic: yes, really. this was something like three years ago, so Rakudo is slightly faster now. and maybe newer perls don't crash, but I wouldn't bet on it. 19:38
paul_: yes.
jnthn On Windows, best to run it "natively" rather than under cygwin.
Though as far as I know it works on cygwin too. 19:39
sorear paul_: tbh I'd be suprised if Perl 6 had more than 100 serious users at this point
arnsholt Rakudo works fine on OS X as well. I do my stuff mostly on a Mac 19:40
19:40 spider-mario joined
quietfanatic masak: The perl 5 regex engine has undergone many internal improvements lately, as far as I've heard. For instance, it's become re-entrant. 19:40
masak aye.
19:41 adu left
quietfanatic paul_: Here's someone's blog describing many of the differences between Perl 5 and 6: perlgeek.de/en/article/5-to-6 19:41
masak but the 1 Mb string limit might be quite hard-coded in the regex code. I dunno.
er, MB
moritz 32k characters, actually
masak oh, right.
moritz: you know if the limit is still there? 19:42
paul_ ok thanks all
masak quietfanatic: "someone's". moritz'++ :)
quietfanatic paul_: If you have any questions, feel free to ask them here
masak er, moritz++'* :)
moritz masak: it is on 5.16
quietfanatic yeah
moritz $ perl -Mre=debug -e '/.{2,}/' 19:43
...
quietfanatic I knew perlgeek.de belonged to someone with an m name
moritz 1: CURLY {2,32767} (4)
masak moritz++ 19:44
quietfanatic: yeah, it's hard to keep us apart if you're not a regular, I guess. 19:46
masak .oO( mberends is making it easier for us lately, though ) :/ 19:47
quietfanatic lunch with f&f & 19:53
timotimo oh, i just noticed, that for 1..3 -> $a { ... } isn't even special syntax, the -> $a just makes a lambda. that's pretty cool 19:57
masak yeah :)
19:58 adu joined
colomon rn: for 1..3 *.say 19:58
p6eval niecza v19-13-g442e075: OUTPUT«===SORRY!===␤␤Missing block at /tmp/OgPgqOVROT line 1 (EOF):␤------> for 1..3 *.say⏏<EOL>␤␤Parse failed␤␤»
..rakudo 942831: OUTPUT«===SORRY!===␤Missing block␤at /tmp/i9RIQeUGLs:1␤»
colomon didn't think that would work...
masak right. except when it is special syntax :P 19:59
pmichaud the 'for' statement does require a block of some sort. But .map works
rn: (1..3).map(*.say)
p6eval rakudo 942831, niecza v19-13-g442e075: ( no output )
pmichaud rn: (1..3).map(*.say).eager
p6eval rakudo 942831, niecza v19-13-g442e075: OUTPUT«1␤2␤3␤»
masak the 'for' needs to be a special form so that we can TTIAR the list and the block.
timotimo (1..10).map(*.say).race 20:00
r: (1..10).map(*.say).race
p6eval rakudo 942831: OUTPUT«No such method 'race' for invocant of type 'List'␤ in block <anon> at /tmp/rOqas1gUn5:1␤␤»
timotimo ah, NIY i guess?
masak it's pretty new in the spec.
pmichaud ...race?
masak pmichaud: welcome back! :P
masak .oO( also, keep up! ) :P
colomon race?
masak will get into trouble one of these days for using the "keep up" meme... 20:01
timotimo for when you don't care about the order in which you get the results
masak colomon: it's "worse than eager".
er, sorry, "worse than hyper".
colomon but slower than hyper
?
ah.
timotimo no, it's even faster!
masak not so much slower as less orderly. 20:02
it's "just throw it at me!" mode.
colomon huh
jnthn
.oO( beware of race conditions... )
colomon I guess it's not completely useless....
timotimo a lot of data may be unsorted anyway
so why keep the unsorted order? 20:03
pmichaud I'm not exactly sure what .race is to be a method on, though.
masak jnthn: I din't know you were so sensitive about race.
20:03 adu left
jnthn :P 20:03
colomon what pm said. 20:05
pmichaud just aliases .race to .eager for now :-)
timotimo is hyper implemented yet? 20:06
moritz r: say <a b c>».uc 20:08
p6eval rakudo 942831: OUTPUT«A B C␤»
moritz the » is a hyper
timotimo is it the same as calling .hyper?
i think hyper was "don't guarantee execution order, but guarantee return order"? 20:09
pmichaud ... .hyper?
masak :P
I've only seen it as a listop, I think.
pmichaud pmichaud@kiwi:~/p6/specs$ ack '\.hyper'
pmichaud@kiwi:~/p6/specs$
timotimo OK 20:10
masak right, S02 talks about '=head2 The C<hyper> operator'
having it as a method feels strange, because we don't do that kind of Perl 5-like context magickery.
sorear I'm not certain how race can work at all with current lists 20:11
our iteration system likes to be in-order
pmichaud I suspect it's a flag passed to iterators
to tell the iterator "feel free to return things in any order you want" 20:12
so .reify(*, :race) tells the iterator "get as many as you want and give them back to me in whatever order you want"
masak here's the thing that's "wrong" with the spec from a user documentation point of view. (I just realized this as I re-read the 'race' spec.)
in order to grasp the spec to a sufficient degree, you have to have been already brainwashed by, well, us. 20:13
or more specifically, @Larry, to the extent that that group still exists.
if you haven't been brainwashed, what's there looks mostly like a science fiction writer's relaxed musings about programming languages of the future. 20:14
moritz aren't we all a bit @Larry? :-) 20:15
masak yes :)
"...the community's rewrite of the language..."
case in point: "This operator is agnostic towards flattening or slicing. It merely changes the work-ahead policy for the value generator. It is a transitive contextualizer insofar as iterators will have to pass on the policy to subiterators."
masak decides to have "It is a transitive contextualizer" put on a t-shirt 20:16
pmichaud masak: bonus points if you can get it to go from your t-shirt to another :-P
masak *lol*
that would be an awesome autopun!
20:17 paul_ left
timotimo is that slice context thing still in perl6? haven't seen it yet except for that 5-to-6 article 20:17
masak timotimo: it is, but we're saving S09 for last, apparently :)
er oh wait. slice "context"? hm.
20:17 Coleoid joined
timotimo yeah, @@( ... ) 20:17
masak oh right. 20:18
pmichaud @@( ... ) no longer exists, afaik
lue hello world o/
masak ack -Q '@@' on the spec gives nothing.
lue! \o/
lue hi masak o/ I've been following your text-adventure programming adventure 20:19
masak lue: oh! I'm glad to hear it. 20:20
lue: yeah, I figure you'd be interested in that.
lue: does it make any sense? is my audience happy so far?
lue [ Funny thing is, I spent the last days of June finally learning Inform 6. What a coincidence :) ]
masak .oO( Inform has all the charms and benefits of natlang BDD... ) 20:21
lue Yeah, it makes sense, at least so far :) . Your posts are at least teaching me about the magic of events (which I've never even bothered/needed to really know) 20:22
dalek kudo/nom: 138213a | moritz++ | src/core/Backtrace.pm:
do not use a nested class for Backtrace::Frame

mostly so that .WHAT gives the full name
20:23
masak lue: events are indeed magical. we're beginning to use/teach them at $work too, which is awesome.
lue: it's really evident with the last post, where we can just save the whole game because it can be represented as "the events so far". 20:24
pmichaud ...I have "what is the least surprise" question
what kind of thing do we expect $str.match( / pat /, :global) to return ?
20:24 snearch left
lue masak: That's definitely a good side to events that I'll have to remember. 20:24
masak pmichaud: a List of Match? 20:25
moritz or a Match of Match
masak yeah, those are the two contenders :)
lue: it's also the events that allow me to do the testing I do in the game.
moritz has hacked too much on the subject to be able to talk about least surprise
and now, sleep 20:26
colomon lazy list of Match?
pmichaud List of Match is what I'm expecting, also.
20:26 kaare_ left
pmichaud so, if the pattern never matches, it returns an empty list? 20:27
20:27 c1sung left
colomon .....yes? 20:27
pmichaud if the :global isn't present, so that we have $str.match( / pat / ) we just return the match object (whether failed or successful) ? 20:28
colomon must admit that Match has always had weird magic going on from his perspective, and anything that simplifies it is a bonus....
colomon apologizes if he is talking nonsense, but there is a three-year-old three feet away loudly insisting that the Union Pacific train is going to go into the river unless I wave the lantern to signal it to stop.... 20:29
pmichaud Match has some strange semantics, yes, at least according to S05. I'm hoping to clean it up a bit. 20:30
colomon is there any real advantage to having the single pattern match that fails return a Match object? does it have information about why the match failed?
pmichaud it has information about the match, such as the original thing being matched against 20:31
it doesn't indicate why the match failed or anything like that.
colomon huh
is there some advantage I'm not seeing to retaining the thing being matched against? 20:32
pmichaud but returning the Match object means that when printed you can get "failed Match" instead of just an empty list.
r: say 'abc'.match( /x/ )
p6eval rakudo 942831: OUTPUT«#<failed match>␤»
colomon (by which I mean, it seems like it would generally be very easy to save the thing being matched yourself.)
n: say 'abc'.match( /x/ ) 20:33
p6eval niecza v19-13-g442e075: OUTPUT«Match()␤»
pmichaud getting '#<failed match>' seems more useful/informative than getting an empty list in this case, yes.
colomon Yeah, I guess there's something to that. 20:35
huh
pmichaud a similar question is 'abc'.match( /./, :nth(6) ) 20:36
colomon does that seem to imply that maybe .match(/ pat /, :global) is a bad idea? (because it returns a different kind of thing.) maybe .match-global(/pat/) would be an improvement?
pmichaud .match-global doesn't seem to resolve the difficulty I'm looking at, no. 20:37
I'm fairly certain that 'abc'.match( /./, :nth(2) ) should return a match object
and 'abc'.match( /./, :nth(1,3) ) should return a List of match objects 20:38
colomon agreed, assuming 'abc'.match(/./) returns a Match object (on :nth(2))
masak cognominal: hm, is 'cognominal' an autopun? well, it *does* confuse use and mention, but not quite in the way I'm used to. I don't consider things like "brief" or "word" to be autopins either, just autologues. 20:39
20:40 c1sung joined
masak er, s/autopins/autopuns/ 20:40
colomon so .match can return a Match object or a List of Match objects.
20:40 sisar left
lue What would :nth(*) cause? Could it mean the same thing as :global, or would it be an error? 20:41
masak c1sung: 你好,來自台灣的人!
colomon I guess maybe it *should* a failed Match object when it can't match anything with the :global setting
pmichaud: with 'abc'.match( /./, :nth(1,3) ), if :nth(1) succeeds and :nth(3) fails, does it return overall failure? Or a list with a good Match and a failed Match? 20:42
masak cognominal: en.wikipedia.org/wiki/Autological_word
pmichaud colomon: that was to be my next question -- what about 'abc'.match( /./, :nth(1,3,6) )
I could see it being a list of two matches, a list of two matches and a Nil, or a list of two successful matches and a failed match 20:43
cognominal masak: yes, but the point, like you said, is that I use as a nick. It is a word in a certain context.
* use it
lue Maybe a list of (Match, Match, failed match)
colomon pmichaud: but it could also just be a failed Match, no?
pmichaud I suppose it could be a failed match.... but (unlike :x) there's nothing in the spec to imply that not getting all of the n's requested will cause an overall failure 20:44
cognominal masak: I guess that your sentence is that my nick should be one to qualify :)
pmichaud in particular, :n(1,1,*+*...*) is valid
colomon pmichaud: oh, interesting
pmichaud: that example suggests it SHOULD NOT be Match, Match, failed Match, right? 20:45
because it would be Match, Match, infinite list of failed Matches.
oh, I guess it could be lazy, though.
pmichaud colomon: well, it's lazy, and I don't have a problem with the notion of "infinite list of failed Matches"
colomon right 20:46
it makes sense it should be lazy
cognominal hum, your article leads to interesting stuff en.wikipedia.org/wiki/Grelling-Nelson_paradox
pmichaud all of these are intended to be lazy, fwiw.
colomon in which case, it seems like Match, Match, failed Match is the only sensible answer 20:47
colomon realizes he just contradicted himself five lines back, but he wasn't taking laziness into account then.
masak cognominal: well, the science of autopuns is still young. but it's something like "autopuns must be statements", or rather, the use and the mention are usually distinct even though they are confused. 20:48
jnthn pmichaud: If :g returns a Match, will for $x.match(/y/, :g) -> $m { ... } do the right thing? 20:49
lue What would happen if someone gets an infinite list of failed matches (with :nth(1,1,*+*...*) for instance) and would like to know how many matches they got? (what would .elems on the list return?)
pmichaud jnthn: I've not advocated that :g returns a single Match
although Rakudo does that currently, unfortunately.
I think that :g should imply "List", unless it's modified by a :nth
jnthn pmichaud: Oh, I thought it did the list of match thing...
OK. 20:50
It does mean that .match ends up having more than one return type.
pmichaud we already have that. :-)
cognominal masak, that's fun because in #perlfr, someone was just asking who was talking of autopun in perl circles.
pmichaud 'abc'.match( /./, :nth(3)) # single Match object
cognominal Jung has a word for that that I always forget. 20:51
pmichaud 'abc'.match( /./, :nth(1,3)) # List of two Match objects
cognominal synchronicity!
masak yes.
jnthn pmichaud: Well, if we're returning a List in that case, then I'm certainly for :g returning a List too.
pmichaud and if there are no matches, it returns an empty list?
masak Jung is often not-even-wrong in ways I find highly intriguing :D 20:52
colomon a list with just a failed Match/
?
pmichaud I'm not sure I want list with failed Match, though, because for $x.match(/y/, :g) -> $m { ... } doesn't really do what you might expect
unless you're expecting :g to return failed matches
jnthn pmichaud: It'd see that is needed to get the "for" case to work out.
*as needed 20:53
It'd be weird to get a single iteration of the loop when nothing matched, imho.
pmichaud okay, I think I know what I'll start with, then. 20:55
we'll have to see if TimToady++ will bless it into a spec or make us change it somehow :) :)
the current spec with Match of Match feels terribly wrong to me, on several levels.
basically, things that imply "list of Match" return empty lists if nothing matches. Otherwise you get the (possibly failing) Match object 20:58
masak +1 20:59
jnthn wfm
colomon +1
lue +1 21:00
21:02 birdwindupbird left 21:04 rodney_ joined
masak rn: sub a { my &x = { return }; &x }; my &y = a; &y() 21:16
p6eval rakudo 138213: OUTPUT«(timeout)» 21:17
..niecza v19-13-g442e075: OUTPUT«Unhandled exception: Illegal control operator: return␤ at /tmp/Tc6z8vfHzf line 1 (ANON @ 4) ␤ at /tmp/Tc6z8vfHzf line 1 (mainline @ 6) ␤ at /home/p6eval/niecza/lib/CORE.setting line 3918 (ANON @ 3) ␤ at /home/p6eval/niecza/lib/CORE.setting line 3919 (m…
masak hm, locally on rakudo I get 'Attempt to return outside of any Routine'. I don't much like that error.
the return is in a Routine.
pmichaud ...a Routine that has already exited, though.
masak it's just that the Routine in question is exhausted. 21:18
pmichaud yes, that seems like a LTA error message
masak right, I agree that the return heppens dynamically outside the dynamic scope of the Routine.
masak submits rakudobug
benabik rn: sub a { my &x = { return }; &x }; sub b(&x) { &x() }; b(a) 21:20
p6eval rakudo 138213: OUTPUT«(timeout)»
..niecza v19-13-g442e075: ( no output )
masak locally I still get 'Attempt to return outside of any Routine' 21:22
benabik++
pmichaud it looks to me like it's just the message that is suspect.
I can't find that X::ControlFlow::Return is used anywhere other than EXHAUSTED
(perhaps it is; I'm having trouble following all of the logic there) 21:23
I can see other references to X::ControlFlow::Return... but I don't know what if anything invokes them
21:28 eviltwin_b joined 21:40 rodney_ left 21:46 cognominal left 21:47 cognominal joined 21:48 cognominal left 21:50 cognominal joined 22:03 PacoAir left 22:04 zby_home_ left
masak lol blig blag blog! strangelyconsistent.org/blog/july-8...cked-exits 22:07
22:11 adam7504 joined
seldon I'll read that when I'm done cursing Protoman. 22:15
22:16 sergot left, sergot joined
sergot good night! :) 22:16
22:16 sergot left 22:17 mucker left
lue masak++ 22:17
Also, July 7th disappeared from your RSS feed (and this post is listed as being posted on July 7th, if that helps) 22:19
masak oh noes.
fixing. 22:20
pmichaud anyone have some good tricks for determining the set of integers that are inside of a Range?
masak lue++ 22:21
pmichaud or, perhaps better, finding out the smallest and largest integer inside of a Range?
22:22 adam7504 left
seldon Range as in array or range as in interval? 22:23
pmichaud Range as an interval. Like 3..5 or 1.4 ^..^ 7.2
seldon (3..5).bounds 22:25
pmichaud r: say (1.4 .. 7.2).bounds
p6eval rakudo 138213: OUTPUT«1.4 7.2␤»
pmichaud nope.
seldon I daresay it should be possible to get the ints from that. 22:26
pmichaud r: say (7.2 .. 1.4).bounds
p6eval rakudo 138213: OUTPUT«7.2 1.4␤»
quietfanatic r: say {ceiling($^a), floor($^b)}((7.2 .. 1.4).bounds) 22:27
p6eval rakudo 138213: OUTPUT«(timeout)»
quietfanatic why did that timeout 22:28
pmichaud I don't know.
although {...} looks like a hash in that context. 22:29
seldon What do you want to get for 1.2 .. 1.8 ?
pmichaud an empty list
or some way of knowing that there are no integers in that Range 22:30
r: my $range = 7.2 .. 1.4; say $range.max; say $range.min.floor; say $range.min.floor < $range.max; 22:34
p6eval rakudo 138213: OUTPUT«1.4␤7␤True␤»
pmichaud wtf?!
r: my $range = 7.2 .. 1.4; say $range.max; say $range.max + 1; say 7 < $range.max; 22:36
p6eval rakudo 138213: OUTPUT«1.4␤2.4␤True␤»
diakopter eh
pmichaud ...what am I missing here?
r: my $range = 7.2 .. 1.4; say $range.max; say $range.max + 1; say 7 < $range.max; say 7 < $range.max + 1;
p6eval rakudo 138213: OUTPUT«1.4␤2.4␤True␤True␤»
seldon codepad.org/Emo9hwae <-- how's that?
diakopter max Always pulls from the right? 22:37
pmichaud r: say 7 < 2.4
p6eval rakudo 138213: OUTPUT«True␤»
pmichaud o_O
r: say 7.0 < 2.4 22:38
p6eval rakudo 138213: OUTPUT«False␤»
quietfanatic woah
lue r: say 7 < 2
p6eval rakudo 138213: OUTPUT«False␤»
pmichaud rn: say 7 < 2.4
p6eval niecza v19-13-g442e075: OUTPUT«False␤»
..rakudo 138213: OUTPUT«True␤»
pmichaud ...how did _that_ one slip past us? ;-)
seldon r: say 7.Num < 2.4
p6eval rakudo 138213: OUTPUT«False␤»
pmichaud r: say 7.Rat < 2.4
p6eval rakudo 138213: OUTPUT«False␤»
quietfanatic I guess it's so obvious it isn't tested
pmichaud seldon: does that version work if the range is reversed -- i.e., 7.2 .. 1.4 ? 22:39
I guess it doesn't matter in that case.
seldon Yes. That's what the [min] and [max] stuff are for. Although I guess $r.max and $r.min is more concise.
quietfanatic IIRC, backwards ranges are not considered to be containing anything.
pmichaud correct, but I think I'll have to test for that specially anyway.
seldon say (7.2 .. 1.4).reify
r: say (7.2 .. 1.4).reify 22:40
p6eval rakudo 138213: OUTPUT«␤»
pmichaud Now for the bigger bug... why does rakudo think 7 < 2.4 ?
r: say 7.Real < 2.4.Real 22:41
p6eval rakudo 138213: OUTPUT«True␤»
masak o.O
pmichaud r: say 7.Real.Bridge
p6eval rakudo 138213: OUTPUT«7␤»
pmichaud r: say 7.Real.Bridge.WHAT 22:42
p6eval rakudo 138213: OUTPUT«Num()␤»
pmichaud r: say 2.4.Real.Bridge.WHAT
p6eval rakudo 138213: OUTPUT«Num()␤»
pmichaud r: say 7.Real.Bridge < 2.4.Real.Bridge
p6eval rakudo 138213: OUTPUT«False␤»
pmichaud ...is there a way to find out which multi actually gets invoked in response to a given set of arguments? 22:43
(one that is implemented in Rakudo :-)
diakopter r: say 2.4 > 7 22:44
p6eval rakudo 138213: OUTPUT«False␤»
diakopter OO
lue r: say 2 > 7.3
p6eval rakudo 138213: OUTPUT«False␤»
pmichaud heh 22:45
masak pmichaud: debug output statements? :)
pmichaud gist.github.com/3073290 # whoooops!
Rat < Int is correct
Int < Rat is wrong
same for <= 22:46
jnthn pmichaud: There's a method on Routine which will give you back the applicable candidates.
r: say Routine.^methods(:local)
p6eval rakudo 138213: OUTPUT«(timeout)»
pmichaud well, I found the culprit :)
jnthn OK :)
diakopter r: say 7 > _2.4 22:48
p6eval rakudo 138213: OUTPUT«===SORRY!===␤Confused␤at /tmp/MFVqeDSkrh:1␤»
diakopter r: say 7 > 2.4
p6eval rakudo 138213: OUTPUT«False␤»
pmichaud yes, most of the Int,Rat comparators are wrong 22:49
jnthn I...guess we're missing some test coverage. 22:50
pmichaud actually, we have tests for those. 22:52
our tests just aren't testing this case
I mean, we're testing Int < Rat and Int > Rat and the like 22:53
but the ints and rats used in the test don't expose this bug.
pmichaud goes ahead and files a ticket so he can reference it in the tests. 22:54
well, maybe not.
22:56 samlt left 22:59 plobsing joined
dalek ast: 33d6754 | pmichaud++ | S03-operators/relational.t:
Add some tests for the &infix:«<»(Int, Rat) bug discovered today.
23:02
23:02 spider-mario left 23:07 cognominal_ joined 23:08 thelazydeveloper left
dalek ast: 997c786 | pmichaud++ | S03-operators/relational.t:
Also add tests for &infix:«<=>»(Int,Rat) and &infix:«<=>»(Rat,Int).
23:09
23:10 cognominal left
masak 'night, #perl6 23:16
23:17 Infiltrator left 23:30 quietfanatic left 23:35 lue left
pmichaud hmmmm... something broke spectests. 23:35
23:44 eviltwin_b left 23:57 tokuhiro_ joined