pugs.blogs.com | pugscode.org | pugs.kwiki.org | paste: sial.org/pbot/perl6 | <stevan> Moose... it's the new Camel ":P
Set by audreyt on 15 March 2006.
svnbot6 r9610 | lwall++ | Nit in Perl sub call grammar. 00:07
Juerd ruoso++ 00:10
00:11 chromatic joined
Juerd You better watch out / You better not cry / You better not pout / I'm telling you why 00:11
SANTA CLAUSE IS ALREADY HERE :)
chromatic: Santa is ruoso; how 'bout that? 00:12
chromatic Trying to figure out why the -o flag doesn't work in the bootstrapped version.
Juerd Can't help you with that; sorry.
chromatic Ahh, because it's wrong. 00:13
Maybe no primitive for open? 00:15
Looks like it. How do I add one? 00:17
00:21 binary42_ joined
Juerd I wish I knew. I've only had tuits to watch IRC :( 00:22
chromatic It looks like the first step is defining a grammar rule in Grammar/Perl6.p6.
Then defining some behavior in Emitter/Perl5.pm 00:23
Juerd has a desk at home that you can electrically adjust in height.
I left it in standing height.
chromatic What's the right grammar rule though? I wrote:
my $out_fh = open( $output_filename, :w );
Juerd I got home, tired, parens already sleeping, and now I have to stand
It's too noisy to use at night :( 00:24
s/parens/parents/
chromatic: Pick an existing rule and copy it?
chromatic Yeah, working on that. Have I ever mentioned that I don't like parsing?
Supaplex parsing is tEh suck 00:25
Juerd Not that I've read.
chromatic If only Larry or Patrick were still awake... it's barely 4:25 pm on the west coast!
Juerd It's 1:26 am here, and I'm about to fall asleep, which is bad given that I'm not sitting. 00:26
So I better go to bed
Good night, and good luck with open
Limbic_Region [18:26] <TimToady> oyasuminasai!
that was an hour ago
TimToady rehi 00:27
chromatic konnichiwa 00:28
TimToady in a meeting at $work... 00:29
clkao that was a light sleep
63min from oyasumi to konnichiwa :p 00:30
TimToady ä»®åƝ desu... 00:31
chromatic It always seems like morning after a meeting ends. 00:32
00:33 binary42_ is now known as binary42
TimToady currently just in mourning 00:33
00:52 nivrrex joined 01:00 nivrrex left
chromatic Aha. 01:21
I hate parsing.
kattana_ Stop parsing my sentences then! 01:22
jisom what are you parsing? 01:24
svnbot6 r9611 | chromatic++ | Added open() and indirect filehandle output support. (It's ugly but it works.)
jisom bf?
chromatic Perl 6. 01:25
svnbot6 r9612 | chromatic++ | Add bootstrap target for second-stage lrep bootstrap.
jisom from the beginning I don't think it ever looked easy to parse
chromatic There are two problems. #1, I hate writing parsers. #2, indirect objects suck. 01:26
01:43 arcady joined 01:50 hcarty joined
GabrielVieira chromatic your modification had worked? 01:55
i mean print filehandle works well?
print $out_fh $code; <- 01:56
TimToady that's illegal p6... 01:57
it would have to be "print $out_fh: $code" 01:58
GabrielVieira hum
just insert : in the code
:)
TimToady or "$out_fh.print: $code"
or "$out_fh.print($code)"
GabrielVieira or.. ?
:P
looks nice 01:59
<varscalar> (\.) $op := (print|say|warn|die) (\:) <p6ws>? <list> <p6ws>? \; 02:00
does it works for the 2ōæ½xBA one?
avar what does := do now? 02:01
GabrielVieira gives $op the parentheses inside value 02:02
inst it?
jisom so that's in a rule?
GabrielVieira not yet
chromatic Oh yeah, I forgot the colon.
I'm used to Larry getting it.
GabrielVieira chromatic :) 02:03
chromatic Let me see if I can fix it.
TimToady chromatic::
chromatic I originally thought about doing the direct object invocation, but lrep doesn't do objects yet.
GabrielVieira chromatic your open function... u goona make read and write too?
TimToady assuming MMD, print($out_fh,$code) could also conceivably work. 02:04
chromatic Gabriel, maybe. I haven't needed to use read yet so I didn't do it.
GabrielVieira $op := (print|say|warn|die) <p6ws> <varscalar> <p6ws>? (\:) <p6ws> <list> <p6ws>? \; # resolves the colon problem in the 1st method?
humm
chromatic ill look for p6 open documentation 02:05
i need to be updated
chromatic I don't think it's right there; I think it needs to be <varscalar> \: or something like that.
GabrielVieira :P
chromatic Maybe there should be a rule for indirect object notation.
svnbot6 r9613 | damian++ | r6@Gort: damian | 2006-03-16 10:31:40 +1100 02:07
r9613 | damian++ | r7@Gort: damian | 2006-03-16 12:45:22 +1100
r9613 | damian++ | Updated Pod semantics to reflect Larry's preliminary input
GabrielVieira TimToady where is open documentation? 02:08
TimToady I dunno.
GabrielVieira hum
TimToady To the first approximation, assume it's the same as P5 but with first argument moved out as return value.
probably with real :foo<bar> replacing the in-string arguments. 02:09
doubtless pugs has some prior art as well...
chromatic Gabriel, see t/builtins/io/*.t 02:10
ayrnieu E02 makes use of &Main::open
GabrielVieira chromatic going to :)
ayrnieu E03, rather.
svnbot6 r9614 | chromatic++ | Changed the filehandle printing to use the proper indirect object notation.
GabrielVieira ops
my $mad = "scientist"; wont work? 02:12
i'll need to predaclare $mad? 02:13
chromatic Right.
Apparently you can't declare and assign to a variable in the same statement.
GabrielVieira but goona change?
TimToady eventually, or it's not P6 02:14
GabrielVieira hum
it not good =/
ist*
ops
GabrielVieira sad its :P
02:14 Quell joined
jisom what are you on, and where can I get some? 02:15
TimToady The porting-howto suggests: open my $fh, "<", $filename or die $!; -> my $fh = open($filename, :r) err die $!; 02:17
GabrielVieira chromatic couldnt really have a space betwen the FH and the colon? 02:18
02:18 pfenwick joined
GabrielVieira humm 02:18
TimToady I think space is okay there. It's the space after the colon that keeps it from turning into, say, :foo or something.
GabrielVieira but open $fh : $file 02:19
TimToady And we've been careful not to have an infix:<:> operator.
GabrielVieira wont work
TimToady why not?
chromatic My parser rule forbids it, for one. 02:20
Although that's the only reason...
GabrielVieira hum
what about give arguments in new lines? 02:21
like:
$fh =
TimToady I think the only place we have to be careful about space before : is in L
LABEL:
GabrielVieira etc..
what u mean TimToady?
chromatic It's ambiguous there? 02:22
TimToady LABEL : goto LABEL; might be a problem. But don't worry about it.
It might not be a problem.
GabrielVieira ohh 02:23
i got
:)
jisom doesn't 99% of coding practice have the colon immediately after?
GabrielVieira TimToady ur right
TimToady I don't understand your newline question. 02:24
ayrnieu jisom - in labels? I've never seen it otherwise. ew.
GabrielVieira i meant
$fh = open
$file,
rw
;
TimToady it'd have to be :rw to avoid being a bareword, but other than that, it's fine. 02:25
GabrielVieira a argument per line or whatever its showed
chromatic I think the problem there is that the current grammar doesn't allow statement assignments to follow variable declarations.
02:27 hcarty left 02:29 binary42 left
GabrielVieira humm 02:31
which files i need to modifie to insert a new rule? 02:32
chromatic Grammar/Perl6.p6 and Emitter/Perl5.pm, likely.
02:35 DesreveR joined
GabrielVieira was what i thought 02:43
svnbot6 r9615 | chromatic++ | Added an indirect object rule and made print_with_fh rule use it.
chromatic If you look at the checkin for #9615, you'll see what I did.
GabrielVieira about 5hours ago i tried to do the print with filehandle function with no success :~
:P
chromatic You have to be stubborn and hate parsers. That's why I did it. 02:44
GabrielVieira stubborn?
chromatic Focus your hate into pure coding frenzy. 02:45
TimToady You just have to hate parsers less than you hate non-parsers.
Parsers are like democracy. 02:46
GabrielVieira hahah
chromatic You have to be Winston Churchill to make them work.
TimToady I think WC was a better emitter than parser, but leave it be... 02:47
FurnaceBoy but in the morning, chromatic will be sober.
GabrielVieira chromatic u took the colon out? 02:48
TimToady ohayogozaimasu!
it was there when I looked.
GabrielVieira from open function 02:49
chromatic I took it out from the _print_with_fh rule and subsumed it into the indirect_object rule.
GabrielVieira ops
TimToady open doesn't take an indirect object.
chromatic It's mini-penance for duplicating most of the _print*.
GabrielVieira was not open
:)
02:49 Quell is now known as K
GabrielVieira chromatic nice :) 02:50
chromatic lists.utsl.gen.nz/pipermail/pugs-co...06946.html
TimToady wow. you're an Author now. 02:52
chromatic Been a sub-creator for years and years....
TimToady glub glub
GabrielVieira haha
chromatic Now I'm tempted to rewrite the Makefile to rebuild everything. Maybe I'll ponder that over dinner. 02:53
TimToady chromatic: fortunately for us, GV is easily amused.
GabrielVieira <dot> is defined... what about creat a <colon> too?
chromatic GV, not GVR?
jisom rule color { \: } ? 02:54
*colon
chromatic I thought about it, but unless it's in use elsewhere, I'm not sure it's necessary.
GabrielVieira yep 02:55
kattana_ dont name rules after what they are made of, name them after what they do
GabrielVieira iv done
<dot> does "."
:P
ayrnieu I'd think { : | \: | <[:]> } equivalent.
jisom what about gt and lt?
a bare colon has the cutoff meaning
GabrielVieira <colon> would do ":"
jisom or backtracing 02:56
some wording
kattana_ what if you want to change "."? allways leave options
TimToady It would appear that nothing uses <dot> 02:57
ayrnieu: bare : is metacharacter in P6
oh, sorry jisom, you just said that. 02:58
GabrielVieira can i paste 4 lines of code here?
TimToady : is backtracking prevention on the previous atom, so probably illegal as the first thing.
jisom eh, wrote the regexdna shootout, and I used the p6rules with pge.... my first foray into p6rules
TimToady kattana_: we'd like this grammar not to run until the heat-death of the universe, at least until we get bootstrapped onto PGE for (hopefully) better speed. 03:00
jisom pge seems to allow it...but it does cause a problem
and for pge, using \: instead of <colon> would be faster
pasteling "GabrielVieira" at 200.141.147.108 pasted "print syntax rule" (13 lines, 436B) at sial.org/pbot/16344 03:02
GabrielVieira could you see that paste?
TimToady pge doesn't seem to allow initial *, and I don't think it should allow initial : either.
jisom well it errors on calling the matchsub 03:03
TimToady but maybe it helps with something else to treat it that way...
chromatic Hm, for the direct object invocation syntax, there ought to be a more general rule... but it's difficult to desugar that in general until there's object method support somewhere.
jisom it doesn't throw a syntax exception
TimToady "foo" ~~ /: foo/ 03:04
works.
same thing with * doesn't parse
jisom I get a "Null PMC access in invoke()" problem
TimToady well, I'm running with a *very* recent Parrot... 03:05
jisom I'm with r11858
which, as the joke goes, is ancient 03:06
TimToady I got the Null PMC when I just said /:/ instead of /: foo/
jisom oh, I forgot the space
I was using :foo
TimToady by ten years from now you probably won't make that mistake. 03:07
jisom ten years from now I'll be on perl7
chromatic Showoff.
jisom hm? 03:08
GabrielVieira how can i renew my lrep codes? like update, but when i do update my entries gonna still be there and i want them out :D
chromatic *I* don't even have Perl 7 yet.
jisom I don't have perl6 yet either
technicall
chromatic Gabriel, svn or svk revert.
ayrnieu jisom - 'on' is the right word to use, there, as perl7 will be, like all 'programming languages' of 2016, a virus in your VR kit.
GabrielVieira 5 months from now ill be working entirely with perl6 x) 03:09
:P
chromatic but.. all the files? how can i do? 03:10
chromatic I use svk revert *, if I don't care about any changes I made.
TimToady gotta decommute, bbiab & 03:11
GabrielVieira didnt work :T 03:12
chromatic rm *; svk up 03:13
GabrielVieira now yes 03:15
:D
tkz
03:19 K is now known as Quell 03:20 amnesiac joined 03:21 Quell is now known as K
GabrielVieira so 03:22
in what u all r working at?
(in lrep i mean)
pasteling "chromatic" at 63.105.17.30 pasted "Bootstrapping the rest of the code breaks Grammar/Perl6Primitives.p6 -- here's my Makefile patch to prove it" (56 lines, 1.7K) at sial.org/pbot/16345 03:33
chromatic Dinnertime.
TimToady GabrielVieira: I'm not working on anything in lrep. I'm not allowed to implement Perl 6, for fear it'll turn out like Perl 5. :-) 03:43
GabrielVieira hahaha 03:46
dude
my bed is claiming for me
so... 03:47
:P
TimToady sweet dreams++
GabrielVieira tkz ;)
good (night|morning|etc)
:)
[]s
mugwump TimToady: well, look at the way Linus handles patches to the Linux kernel. He could conceivably get away with not writing any code at all, just picking patches after they get reviewed/flamed on the relevant list 03:49
jisom isn't that what he does now?
mugwump well apart from the odd trivial thing here and there
open svn might be nice for collaborative hacking, but the distributed model (as offered by git or svk push -P) is better for stable dev. 03:50
03:55 K is now known as Quell
mugwump but hey, no point changing what's working for now. 03:55
04:10 dvst joined 04:17 szbalint_ joined 04:26 pdcawley joined 04:31 Alias_ joined
Alias_ audreyt: ping? 04:31
I'll just leave a tidbit behind then 04:32
pugs.blogs.com | pugscode.org | pugs.kwiki.org | paste: sial.org/pbot/perl6 | <stevan> Moose... it's the new Camel ":P | .pmc == PPI source filters! 04:32
Alias_ runs 04:32
04:32 Alias_ left 04:37 mako132_ joined, justatheory joined 05:07 nirgle joined 06:10 justatheory joined 06:22 justatheory joined 06:28 stennie joined 06:35 stennie joined 06:37 Aankhen`` joined, Quell joined 06:38 tcliou joined 06:40 stennie joined 06:51 stennie joined 06:54 GeJ joined, kane_ joined 07:02 Frances joined
nothingmuch morning 07:03
GeJ morning nm 07:05
morning folks 07:06
07:21 pfenwick left
GeJ fires up the mule, the donkey, the firefox and the ftp-thingy 07:37
take that you damn french senators! 07:39
07:40 drrho joined 07:44 szbalint_ is now known as szbalint 07:50 fandango joined 07:56 szabgab joined
Quell brb, reinstalling x-chat 07:56
szabgab In case of @a = readdir($dir); @b = readdir($dir); @b should be empty and not undef, right ? 07:57
ayrnieu what type is $dir ? 07:58
szabgab $dir = openddir "."
IO::Dir 07:59
ayrnieu (not ::Str , then)
08:00 iblechbot joined
ayrnieu szabgab - I get @b as empty after that... 08:01
szabgab ok, I see that was my bug in checking it...
08:01 Quell joined
ayrnieu ./pugs -e 'for opendir "." -> $d { my @a = readdir $d; my @b = readdir $d; say @b.perl }' 08:02
OK.
szabgab using ok(+@b, 0) instead of is(+@b, 0)
ayrnieu (although that prints [] where I get () interactively. but nevermind, I don't understand it.)
jisom I haven't used perl6 much, but I have to say the "for @array -> $scalar {}" syntax a little unreadable, how complicated would it to allow "for @array as $scalar {}"? 08:05
svnbot6 r9616 | szabgab++ | quickref: files and directories
r9616 | szabgab++ | more opendir/readdir related test
ayrnieu jisom - er, your suggested syntax is a little unreadable to me :-) 08:06
jisom the "@array -> $scalar" makes me think of storing an array reference of @array into $scalar 08:07
or perl5's method invocation
on an array
although 'foreach @array as $scalar' seems more readable
ayrnieu *shrug* I'd never, ever write that. 08:08
jisom it's easier for me to read words than characters
08:10 marmic joined
ayrnieu it's interesting that you note the -> as a perl5 funcall. That hadn't even occured to me. I guess I see perl6 as a different enough language. 08:10
jisom me too....when the question comes up of "is perl6 still perl?", I just sort of think, how many perl1 programs run under perl5, and how many perl programs at all run under perl6 08:11
ayrnieu I didn't mean it in that way. Incidentally, I have never seen a perl1 program, but I've seen old perl poetry which perl5 couldn't parse. 08:12
jisom you can download perl1 08:13
ayrnieu where it was indicated as having parsed.
*nod*, but I haven't.
08:13 nothingmuch joined
jisom it's simple, "compiles as far as some programs run" 08:13
I imagine many programs, those that don't use something like "$ = 'foo';" would work fine 08:14
and not use oo
ayrnieu perl1 strikes me as something which ought to exist as a simple module under Acme::
and not use more than just OO :-) 08:15
perl4, even, lacked lexically scoped variables, and proper references.
pasteling "jisom" at 64.85.214.233 pasted "snippets from perl1's man page" (40 lines, 1.2K) at sial.org/pbot/16348 08:16
jisom true, but syntactically, it's one of the major differences
my and our being new, our being only 5.6
ayrnieu OO is not much, syntatically. 08:17
jisom nevertheless, it's an important part of many "application languages"
ayrnieu -> and bless(); I don't know if packages already existed.
jisom it's not so much "how many perl5 programs would run on perl1", but "how many perl1 programs could run on perl5" 08:18
ayrnieu ah, and we got here by your passing 'and not use oo'. 08:19
jisom eh 08:20
ayrnieu Not to offend, but I really, really don't care about perl1. It's sort of pleasant that it has been made to be downloadable again, and I recall some present of that to the community, but it's not a language I care about.
08:20 nothingmuch joined
ayrnieu perl4 is disturbing enough, when I come across it. 08:21
jisom but it sort of goes back to "is perl6 perl"....which of course came from the "for @array -> $scalar" thing reminding me of perl5's oo method invocation
"A subroutine is called using the do operator. (CAVEAT: For efficiency reasons recursive subroutine calls are not currently supported. This restriction may go away in the future. Then again, it may not.)" besides that part of course 08:22
ayrnieu I see 'is perl' as a function based on a fuzzy bag of features and biases, at least including contexts of expressions and a bias in favor of language complexity.
jisom maybe that's why my sub calls seg faulted 08:23
ayrnieu The function you seem to suggest, that 'is perl' depends on the previous Perl code that can run on it, that doesn't matter quite so much to me. Especially not "can I write the 'is perl' language just as I wrote previous Perl" 08:24
because, again, perl4->perl5 is shocking :-)
jisom not necessary features but how to write in it....and I'm not biased against perl6, but I notice things that make me think "you could call this by another name and people might not call it perl"
nothingmuch jisom: what doesn't support recursion? 08:25
jisom perl1, apparently
ayrnieu I'd still call it very perl-like, because it has contexts of expressions and a bias towards language complexity an some other stuff I haven't cleared up with myself.
jisom I started with perl5, on a mac(not osx)...until one time I saw perl1 being available, I'd never used it or seen it, but it sort of surprises me how few of the things have changed 08:26
ayrnieu ah, OK.
08:27 szabgab left
jisom I like the one-liner capability(that may span multiple lines on my terminal) and being able to write easy to read programs 08:27
ayrnieu I guess the important victim of progress is idiomatic language. perl4 and perl5 are similar in endless ways, but if you present a perl5 program written perl4ly people will look at you like you are a space alien. 08:28
jisom when it comes to rules, I think the easier ability to write noncapturing groups is good, but I don't like the more complicated character classes
ayrnieu jisom - example of a more complicated character class?
jisom "<[abc]>" compared to "[abc]" 08:29
and how "<foo>" calls foo
ayrnieu ah. Well, it may scale better.
Contrast with [[:alpha:]] and such of perl5.
jisom but that's easily understandable
to me anyway 08:30
anyway, how does perl6 rules do it? I haven't worked with that on pge yet
ayrnieu <?alpha> , I assume, but I'll check. 08:31
<alpha>
<alpha+[0-3]-[jJ]> # heh. 08:32
08:32 jisom_ joined
ayrnieu <alpha> 08:33
<alpha+[0-3]-[jJ]> # heh.
jisom_ hates his isp sometimes
well the <alpha> syntax would actually be slower under pge than <[a-zA-Z]> :-p
ayrnieu actually, off-hand, I don't know how I would as neatly express [[:alpha:]]-but-not-[jJ] in perl5. (?:(?![jJ])[[:alpha:]]) I suppose. 08:34
jisom - well, [a-ZA-Z] is also not the same as alpha
jisom_ true, but for ascii it's right
ayrnieu so, (?:(?![jJ])[[:alpha:]]){5} becomes <alpha-[jJ]>**{5} ? 08:35
if you want to match ascii, match ascii :-)
perl6 makes that readable enough that people might actually think that way. 08:36
jisom_ although for the complicated situations, p5 regex can be unwieldily, but for most cases, it doesn't come to that
and in for other situations, hopefully the person reads perlpacktut and uses pack instead 08:37
jisom_ wishes parrot had a pack/unpack
ayrnieu well of course, when a tool gets unwieldy people tend to do something else.
I don't sit around trying to force concurrency-oriented-programming into my perl5. I just don't do that :-) 08:38
but that's a neat way to do things, and so might <xdigit-[0]> turn out.
jisom_ yes, there's the whole "right tool for the job" thing, but if you know perl, and don't want to learn a new language, you'll figure out the weird regex 08:39
ayrnieu <+xdigit-[0]>
jisom_ yes, I will admit it can be very beneficial
but for character classes alone, none of that other complex stuff, and character classes are quite common in my experience, it's more characters and from a standard regex usage, it'll lead to a definite learning curve 08:40
nothingmuch jisom: "figure out the weird regex" is consistent with "perl is a write only language"
Perl 6 is trying to make it almost as concise to write throwaways 08:41
just as easy to write throwaways
jisom_ or a "write once, document well" language :)
nothingmuch but possible to write a big app too
without needing exceptional programmers
ayrnieu I'm not sure that "OK, [1-9] is <[1..9]> and [^ab] is <-[ab]> , enjoy." is such a difficult first jump :-)
jisom_ haven't you ever heard of Eagleson's law?
nothingmuch no, i haven't
but documentation < self documenting code, for maintenance purposes 08:42
jisom_ Eagleson's Law:
Any code of your own that you haven't looked at for six or more
months, might as well have been written by someone else. (Eagleson
is an optimist, the real number is more like three weeks.)
nothingmuch type annotations, for example, can *REALLY* help clarity
that law needs a name?
jisom_ well, I do tend to write self documenting code, but still, sometimes if you're wanting that extra performance improvement, you use comments
oh, that's from fortune
ayrnieu jisom - that's not correct, and it's sort of a verbose way to say "readability is important", and the perl6 Camel Book will probably have, as previous Camels, an 'optimizing for maintainability' section. 08:43
nothingmuch err
comments?
how do those improve performance?
ayrnieu nothingmuch - jisom is saying that you will comment your obscure optimizations.
nothingmuch oh
well, that should never be more than 5% of the code or so 08:44
jisom_ well certain operations can be improved better by a human than a computer
nothingmuch works on performance intensive C++ code
jisom_ it's often small portions, but at bottlenecks, or places you know you can optimize
nothingmuch and one of the lessons I've learned is that if you write beasts in the name of performance you will lose so much more later on
nowadays we are optimizing things by 50% or so
just by simplifying a bit
the reason it got this way is that the code was so convulted it took a team effort to understanad it all 08:45
since we're 2nd generation programmers for this part of the product
balance is everything
keep most code optimiz*able*
jisom_ I remember what a friend said, he had a friend who was essentially needing to save space, so it was delete the comments in the other guy's opinion, my friend replied "delete the code, you can recreate it from the comments, but without the comments you won't understand the code"
nothingmuch by making it clear and easy
buu jisom_: Until the comments are wrong =] 08:46
nothingmuch and only if you can prove by profiling are you allowed to optimize it
jisom_ buu: fire the programmers who don't comment o:-)
nothingmuch i disagree with that
nothingmuch doesn't comment i++
jisom_ profiling or benchmarks
ayrnieu I particularly like perl6 rules in that I see them as allowing me to tend to more strictly match my input, rather than for sanity's sake loosely read input and then write very many tests to make sure it's not brokenly loose.
nothingmuch but if i delete
then it won't work anymore
jisom_ nothingmuch: does your code document itself?
buu jisom_: I never said they didn't comment, I said the comments wre wrong.
Yay selfdocumenting code!
jisom_: I generally feel that if your code isn't self explanatory, it should be rewritten (or it's C) 08:48
jisom_ ayrnieu, given that perl6 rules use [] for non capturing, and {} still for counting, I don't know of an alternative, though perhaps I'd have choosen {} for non capturing instead.....but, what about when <foo> does more than just a character and a whole pattern? what should a reader expect <foo-[abc]> to think?
ayrnieu jisom - it has to be <+foo-[abc]>, sorry. 08:49
jisom_ I go for pir nowadays....should be easier with the hllmacros.pir file, hopefully
nothingmuch jisom_: yes
jisom_: i make sure
and if it doesn't i comment
ayrnieu jisom - {} are already used by closures within rules.
nothingmuch and then think hard how to remove the comments
jisom_ so it has to be **{2} for counting?
nothingmuch (by correcting the code)
(correcting == making it more readable)
08:50 jisom_ is now known as jisom
nothingmuch the problem with macro programming, with all due respect, jisom, is that they don't compose well 08:50
no matter how good hllmacros.pir is
jisom but say the code's performing some algorithm, then it's more of a case of "get it right and get it working fast" rather than "what's this say again?"
ayrnieu jisom - yes.
nothingmuch pir will not be a good high level language for writing human optimized code 08:51
jisom nothingmuch: pir's an assembly, macro's can help greatly
nothingmuch yes, i know
i wrote a lot of assembley and our assembler didn't have macros and how i longed for them
but there's still a "deeper" level of all encompassing abstraction 08:52
a sort of consistency
what is a value
what is a construct
these questions can become very limiting later on
jisom yeah, in less than 30ish lines of code, I added support for nested macros and then added a hllmacros.pir file to make it easier to program in pir, and programming for parrot can be good, and just as people will write in machine assembly over other languages, people will write in pir in years to come
nothingmuch right 08:53
and that's a good thing
but that's not a replacement for Perl 6's values
jisom yeah, my initiative to add the support was porting some oo code that was sort of complex......and the macros help prevent bugs
absolutely, eventually I'll learn perl6 well and for some things I'll use it often, pir's not for one liners after all 08:54
but with jit, it's not impossible to get "faster than c"
I think parrot has two shootouts that can run faster than c with jit enabled on x86
it's one of those "do what I say" type things 08:55
audreyt jisom: noncomposable macros can bring more bugs, though 09:01
(just look at XS)
jisom what's noncomposable mean?
audreyt jisom: I'd like to have some form of composable macros in parrot-land, be it PIR or AbsPIR or something
jisom: noncomposable means when you nest two macros
jisom parrot supports that
I added it
audreyt you can accidentally change one's meaning 09:02
if two macros know about each other
then they can conspire to fix this
but in general, C-style macros (and naive Scheme-style macros) doesn't compose
jisom "perldoc -F runtime/parrot/include/hllmacros.pir" in parrot's root
audreyt currently the "Foreach" macros in parrot
jisom oh
audreyt doesn't compose with itself
jisom well that's complicated.... 09:03
audreyt you can work around that
but in general where side-effects can occur in noncomposble macros
is an undecidable problem
Ara4n morning folks
jisom the .sym is changed to .local for the lexer, and unlike .local in macros where it creates something specific, .sym just reserves the name and is there as a replacement for .local and has no special meaning different from .local
audreyt jisom: yeah, I went thru hllmacros.pir with leo 09:04
jisom ok
nothingmuch jisom: jit cannot be faster than C for high level code if high level knowlege is not passed down
jisom an alternative could be using push/pop whichever thing, but there was discussion recently on removing that
audreyt "Composable and Compilable macros" from matthew flat, and "Composable Macros" from oleg
nothingmuch because a boxed value, no matter how optimized in assembly will always be more complex than an unboxed value 09:05
jisom nothingmuch: benchmarks often are low level
nothingmuch that's why benchmarks are irrelevant
we shouldn't be chasing benchmarks
jisom but they're often used
audreyt jisom: so in any case, I fear the XS-doom will be upon PIR-macro programmers if people starting to nest them often
nothingmuch for what good purpose?
name one good reason to use synthetic benchmarks that is not propaganda
audreyt jisom: (not that I think hllmacros.pir is bad -- I think it's cool and saves a lot of typing) 09:06
jisom audreyt: I haven't worked with xs, I've hadn't even wanted to look at it, let alone the macros of it, so I can't comment on xs macros
nothingmuch propaganda is important, but it's only there to make the first step
audreyt jisom: ok... but think about C macros in general :)
nothingmuch after that works, you need to prove that your propaganda isn't lies and deception =)
audreyt jisom: XS is just C macros went wrong
jisom and it works with the "ok, you use unless for an if block and if for an unless block" trouble
audreyt into its own minilanguage
jisom ouch
audreyt hllmacros.pir of course is not going there _yet_ 09:07
jisom propaganda helps pr....
audreyt but the temptation is there I'd say
e.g. the temptation to use two Foreach is high :)
jisom perhaps, but many basic blocks are often rewritten time and time again, and can be bug prone
I know
sometimes I just add a "foreach2"
nothingmuch jisom: if you truuely *polymorphic* macros
then that's just OO eventually
audreyt ooh foreach2 :-/ 09:08
jisom but perhaps a buggy foreach with a comment about it's bug is better than none?
you do have to change variable names.... 09:09
if .sym had the .local $label properties, it'd be possible.... but .sym doesn't allow that 09:10
nothingmuch *cough*
see that's exactly my point about macros != high level constructs
they have this sort of gap
where yuckyness leaks through
the only language where macros make sense as the basic building block is forth 09:11
because it's *so* simple that macros *do* compose
jisom pir's so simple that macros can compose :-p
nothingmuch i seriously doubt that 09:14
09:14 Quell joined
jisom what do you define as "can compose"? 09:14
nothingmuch it's a touchy feely thing 09:15
any language with calling conventions is too high level for macros to work well, IMHO
but that's just my opinion
pasteling "jisom" at 64.85.215.200 pasted "forget hello world" (18 lines, 617B) at sial.org/pbot/16350 09:16
nothingmuch pil is still a low level language 09:19
jisom pir?
nothingmuch err, yes
jisom yes, it's an assembly with nicer things like subroutines and objects, arrays, etc, but still assembly, there's not even an if statement without macros
my intent for doing it when I did it was to make more readable code, a greater hope is that others who come to pir won't be immediately put off and make it easier for beginners to learn it 09:23
and try to solve a bug in a program I've yet to fully fix(or locate the problem) 09:24
09:24 Arathorn joined
audreyt jisom: definitely the hllmacro is a step forward :) 09:26
by making macros nest, the temptation is to take a step sideways and use them as inner subs and higher-order functions 09:27
if people can resist the temptation and/or reason about it, then it's just fine :)
but I'm boardin in 2mins :) 09:28
jisom well if they remember it's an assembly and not an hll, and they realize they're programming in pir, it won't be too bad
audreyt yup
but XS programmers very often forget they are dealing with C.
audreyt goes boarding & 09:29
09:29 rindolf joined
nothingmuch boarding? 09:29
audreyt: are you learning to snowboard?
Arathorn boarding swoosh swoosh swoosh? or boarding 'this is last call for gate 28'?
nothingmuch or boarding 'they're coming to get us, quick get the hammer'? 09:30
jisom wonders how fast you can go from irc to a ski slope
nothingmuch jisom: knowing audreyt she's probably skiing *with* the laptop
Arathorn has been on irc from a chairlift before :/
jisom just need a place to rest it while skiing 09:31
even though most laptops aren't "rated" for that cold
09:31 meppl joined
rindolf Hi all! 09:31
nothingmuch hi rindolf
rindolf What expression holds the line number in pugs. 09:32
nothingmuch: hi! What's up?
nothingmuch jisom: i mean physically, on the slope
in a bag or something
so that she can code on the lift
etc
rindolf: not much
jisom wonders what nothingmuch thought he ment
nothingmuch rindolf: $?POSITION
or somesuch
err, so what did you mean by 'skiing'?
err
'rest it'
sorry
jisom skiing, mountain, snow 09:33
nothingmuch no, not by 'skiing'
jisom do you need more coffee or less coffee?
nothingmuch i need less windows
and a different ISP
nothingmuch is coding, changing ISP and chatting at the same time
jisom in time, you may find a kernel in p6
nothingmuch jisom: do you know House? 09:34
jisom no
nothingmuch www.cse.ogi.edu/~hallgren/House/ 09:35
it's an OS in haskell
09:36 azuroth joined
jisom I forget the name but there's a fairly new os written only in machine assembly... 09:37
personally I think that if you're at that point, you need a hll
nothingmuch how portable is it? ;-) 09:39
Arathorn . o O ( written in parrot )
jisom x86 only :(
once parrot's jit gets improved across all platforms(instead of just major ones), forking it into a compiler for machine code could help write platform independent machine code 09:41
09:41 Daniel_Nee joined
nothingmuch jisom: platform independant machine code makes no sense 09:43
why use it
if it's not platform dependant
jisom neither does the intel vs at&t syntax
nothingmuch i mean, if you're not exploiting CPU features to death, might as well use a high level language 09:44
for this argument i consider PIR high level
because it has semi-opaque data types
and memory abstraction
09:44 kakos joined
jisom it's a cisc, but if you were to strip it to a risc, and change certain parts(like being able to deal directly with ram), it could work 09:45
I'm not saying change pir directly to an assembly syntax, but perhaps strip it and modify it 09:46
not for parrot
just because perl6 has oo and runs as asm, doesn't mean asm has oo
10:17 xinming joined 10:18 elmex joined
rindolf Yay! My first Perl 6 program is working. 10:36
10:37 kanru joined
nothingmuch rindolf: what is it? 10:49
xinming nothingmuch: Hello world! :-P 11:07
rindolf xinming: no. 11:16
nothingmuch: it is a port of my Perl 5 program for solving the Expert QOTW 8 - calculating the graham number. 11:17
Well, I'm going to rest. Bye all!
11:18 Gothmog_ joined, DesreveR is now known as r0nny 11:19 Gothmog_ joined 11:22 r0nny joined 11:41 ruoso joined
ruoso is happy to see others working in lrep-compiler :) 11:46
svnbot6 r9617 | ruoso++ | t/macro.p6t - Tests the macro compilation 11:49
ruoso does unless still exists in perl 6? 11:53
rgs it works in pugs 11:55
ruoso ok... 11:56
nothingmuch ] 12:06
]\] 12:07
oops
anybody seen obra? 12:09
svnbot6 r9618 | ruoso++ | Documenting TODO... Proposing a way to refactor Perl6.p6 12:10
12:16 Khisanth joined
svnbot6 r9619 | ruoso++ | no <?p6ws> between subname and ( in this(that) 12:19
Juerd ruoso: Yes; Damian's insanity re that hasn't reached Perl 6 yet ;) 12:23
Juerd doesn't use unless because it's not natural to him, but understands why it is very useful to have.
ruoso Juerd, specially whith limited rules 12:26
Juerd, if ( ! $var ) is harder to implement than
Juerd, if ( $var ) and unless ( $var )
Juerd I wouldn't know 12:27
12:29 chris2 joined 12:52 slurpee joined
svnbot6 r9620 | ruoso++ | if and unless are not macro anymore... generated lrep can replace the hand-written lrep.pl, updated Makefile to reflect that 12:58
r9621 | ruoso++ | removing lrep.pl in favour of lrep, which is compiled from lrep.p6
r9622 | ruoso++ | updating TODO 13:04
13:07 mako132_ joined 13:13 nothingmuch joined 13:16 iblechbot joined 13:23 Frances_ joined
nothingmuch www.cerado.com/web20quiz.htm 13:25
dear god
13:27 Frances_ joined 13:28 Frances_ is now known as fransees, Limbic_Region joined
ruoso When someone declares a grammar (which is like a package in Perl 5, right?) the rules are scoped to that Grammar. right? which is the syntax to load an external grammar and to match with some rule of that grammar? 13:29
nothingmuch a grammar is just a class 13:30
so Grammar::rule
and use Grammar <rule>;
but
remember that both exports are lexical
and rules can be lexical
my rule foo { }
and rule foo is export { }
ruoso hmmm 13:31
13:31 Frances_ joined
ruoso ok... but if one wants to avoid the export and use it where it is 13:31
nothingmuch Grammar::rule 13:32
but only for 'our rule foo' or 'rule foo', not for 'my rule foo'
obra nothingmuch: I'll be around in an hour
ruoso but Grammar::rule is a subroutine call, isn't it?
shouldn't it be Grammar.rule?
nothingmuch obra: aye... thanks =)
ruoso: no, that invokes the class method 'rule' 13:33
or the class rule 'rule'
but all rules are instance methods on the match object
ruoso now I'm confused
nothingmuch okay 13:34
here's how rules work
in theory
the domain specific language for rules is parsed into an AST defining rules
which is mostly a lambda calculus
ruoso ok
this part I understood
nothingmuch there are combinator rules, like +, (), and so forth
ruoso ok 13:35
nothingmuch the rule methods in perl space are perl wrappers that execute those ASTs
the methods are invoked on the rule evalutor state object thing
the match object
which is like an interpreter env
this match object contains:
the current state
the current match data
13:35 Frances_ joined
nothingmuch various control structures 13:35
etc 13:36
and the rules-compiled-into-methods are invoked on it
now, this is just at the semantic level
the implementation may in fact compile the rules into a different language
like PIR
but at the seam it should always pretend to look like regular perl methods 13:37
ruoso but... the match object isn't the return of a rule execution?
nothingmuch that move match data around
it's implied
when you start a match
then it constructs a new match object
ruoso ah ok...
nothingmuch and binds it to $/
ruoso the ~~ operator already starts the match
nothingmuch and then starts executing the anonymous method
right
so rx:/..../ is an anonymous method
this is just invoked on the $/ object 13:38
$/ contains the input data too
and the method will cause changes to the internal state
pulling in input, accumilating oputput
and backtracking
ruoso so rx:/..../ will be compiled also
nothingmuch yes
it's essentially like saying 'my method { }' with no name
ruoso but...
nothingmuch now, what goes on inside is obviously different 13:39
ruoso how can $/.rulexxx be invoked if rulexxx is defined in a external grammar?
nothingmuch okay
so the way this works is that all invocations on rulexxx etc are *normally* done as:
rx:/ <Grammar::rulexxx> /;
as a parallel to:
$/.Grammar::rulexxx
but i think $/.Grammar::rulexxx is not enough 13:40
the API is not specced enough
and there is a handwavy hole in the middle
basically:
do grammars inherit from Match?
or does Match have a Grammar object that it internally invokes rules on?
ruoso do it?
nothingmuch this stuff isi underspecced
we don't know
that's what I'm hoping pX will sort out
see Hierarchy.pod in docs 13:41
this details all the parts I could think of that are either specced or not yet specced
and is also missing parts which i couldn't think of
ruoso ok...
nothingmuch if you like, try to expand on the areas where the match/grammar lower level API can be detailed
also
luqui created Parse-Rule
13:42 Frances_ joined
ruoso where? 13:42
13:43 Frances_ is now known as fransees
ruoso reading Perl6::Bible again 13:45
nothingmuch ruoso: sorry, back 13:49
parse-rules is in misc somewhere, i think
it's a proposition for the Match object interface
that tries to make sure it can compile to many backend systems
ruoso: sorry, it's in ext/ 13:50
despite having just stubs
ruoso nothingmuch, ok...
13:51 Frances_ joined
ruoso still wondering how "$match = Grammar::Perl6::grammar($source);" should look like in real perl 6 13:51
nothingmuch ruoso: explain 13:52
I think it'll be something like
my $c = Perl::Grammar::Compiler.new();
my $parse_tree = $c.parse( $rule_source ); # whatever hooks 13:53
err, that's a parser, not a compiler
and then it compiles depending on the backend
either to Perl 6
or to PIR
or to both
depending on what can be done
i have a billion ideas on this topic of compiling, if you want to talk about it later
but i have to go now
ruoso so $c.parse means "$c is the grammar object and parse is a rule" 13:54
nothingmuch oh 13:55
on that level 13:56
i think you're forgettin ghtat rules need to be emitted and stuff
if you have a single step parse-rule-syntax-and-execute method
then there's not enough separation for later
or do you mean something else?
$c is the rule compiler
and .parse is a method defined on the rule compiler
this stuff is invoked by the Perl 6 compiler extension that handles the DSL for rules 13:57
ruoso hmmm... for runtime rule compilation... ok....
but I don't have a single step 13:58
but in this case, I'm using a pre-defined set of rules, that are already compiled... 13:59
14:02 Arathorn joined
ruoso so... it would looks like: "$source ~~ /<Grammar::Perl6::grammar>/; $match = $/;" 14:13
hmmm... better yet "$match = $source ~~ /<Grammar::Perl6::grammar>/;" 14:14
14:21 GabrielVieira joined
GabrielVieira hello there 14:22
14:22 Limbic_Region joined 14:24 renato joined
svnbot6 r9623 | ruoso++ | notes on how a match should perform 14:44
pasteling "ruoso" at 201.9.45.97 pasted "proposed emmited code to a perl 6 match..." (5 lines, 164B) at sial.org/pbot/16351 14:45
ruoso audreyt, TimToady, anyone... please take a look at sial.org/pbot/16351 14:46
audreyt looking 14:49
14:51 chris2 joined
Limbic_Region ruoso - just finished backlogging 14:51
ruoso - does your latest change in lrep fix the thingy where chromatic said bootstrapping the rest breaks?
and if yes - is it Christmas?
ruoso Limbic_Region, yes... not that it really fix...
Limbic_Region, but Data::Dumper.Dump($capture) solves the problem 14:52
Limbic_Region, I don't have a clue of why
the Dump modifies the Capture somehow
that it just works...
I still needs to debug it to know exactly which is the difference 14:53
christmas:
?
14:54 vel joined
audreyt ruoso: can you lexically-scope $/ ? 14:55
ruoso oh... sorry
it should be something like
$MATCH
audreyt $MATCH = Perl6::Runtime::Match->new(Grammar::Perl6->grammar->($source))
ruoso in the perl 5 code
audreyt is what I'd expect
ruoso parsing the code 14:56
hmmm... ok 14:57
audreyt or maybe just ->grammar($source)
ruoso audreyt, i think so
audreyt k 14:58
ruoso audreyt, Grammar::Perl6::grammar is already the compiled rule 14:59
audreyt, i think it's just ->grammar($source) 15:00
15:01 justatheory joined
ruoso which would be a good name for the match variable in perl 5? 15:01
$MATCH may not be a good name... 15:02
ingy hi justatheory 15:04
hi audreyt 15:05
ruoso will use something weird like... $M_A_T_C_H____I_T
stevan wonders if ingy notices him
ruoso doubt something would create a variable with this name
ingy *rubs* stevan
stevan *blushes* 15:06
ingy did I rub you the wrong way?
eric256 why not just $_MATCH ?
ruoso eric256, ok... $_MATCH is a good name
stevan ingy: :)
ingy $mƤtch 15:07
stevan ingy: did you see my Moose?
ingy no
eric256 wonders hos stevan can keep loosing his Moose
stevan ingy: search.cpan.org/~stevan/Moose-0.01/
rgs makes object orientation sound easy 15:08
ingy stevan: cute 15:09
almost Spiffy
stevan ingy: next step is mixins,.. then it will be spiffy-er
rgs Makes Object Orientation Spiffy- Er 15:10
stevan :)
ingy use Spiffy -er;
hmm 15:11
stevan :)
rgs more ideas than you can handle !
stevan ingy: I have before/after/around methods though,.. Spiffy aint got that
:P
rgs My Overcraft Overfilled with Some Eels 15:12
rgs will stop the acronym game nom
stevan rgs: no, please,.. go on :)
stevan is writing them all down
rgs :) 15:13
stevan Moose Often Ovulate Sorta Early 15:14
15:14 hexmode joined
ruoso stevan++... 15:14
stevan Most Other Object Systems Emasculate 15:15
obra heh 15:16
ruoso is hungry... needs to lunch... 15:17
ingy "Moo" says Elk!
ELK!
ruoso ingy+++++++
rgs :))
15:23 elmex joined
eric256 heheh i meant to make a short response to perlmonks.org/?node_id=536951 and ended up with an essay 15:23
lol
i don't understand why people think micro and macro evlotion are seperate things when they are just different views of the same process at different scales. ....blah 15:26
svnbot6 r9624 | ruoso++ | $/ in Perl 6 will be emmited as $_MATCH in Perl 5
15:31 rindolf joined
rindolf Hi all! 15:31
eric256 hey 15:32
rindolf eric256: hi! What's up?
eric256 currently just griping about micro/macro evolution and why some people think they are different. lol 15:33
you?
15:35 pmichaud joined
obra hey pmichaud 15:36
rindolf eric256: I finished converting my first program from Perl 5 to Perl 6.
pmichaud hiya, obra
rindolf eric256: now I'm looking for ways to make it more perl-sixy
obra I was literally just going through the milestones doc.
I had typed "svk log" and not yet hit return to see how recently you'd updated ;)
oh. I did hit return. but the console was on another desktop
pmichaud not recently, I'm afraid. I can do that after I track down the parrot bug that has me blocked 15:37
arguile Many Overloaded Object Systems Exists -- Moose Offers Often Super Extensions
obra Would you rather edit directly or reply to a bit of mail from me and have me edit?
eric256 hehe i read that perl-sexy lol
pasteling "rindolf" at 88.153.140.201 pasted "Perl 6 Program to Calculate the Graham Numer" (258 lines, 7.7K) at sial.org/pbot/16352
pmichaud if you send me the mail, I'll edit or reply as appropriate :-)
obra Ok :)
eric256 rindolf loop ($p=$start_from; ; $p++) looks wierd... what about while(1) { $p++ ? 15:40
a little clearer that this loop is going to go forever if it doesn't find a stop case on its own
lumi while(1) {} is written loop {}, isn't it? 15:41
rindolf eric256: thing is the $p++ needs to be at the end, and I need to use $p = $start_from;
obra pmichaud: sent
pmichaud obra: okay, thanks
eric256 yea but $p = $start_form can be before the loop.
rindolf eric256: I like it better as loop. 15:42
eric256 though ti looks like your loop always stops at the first occurence of $n % $p = 0 so why not make the loop seperate?
lumi If it's not scoped to the loop anyway...
pmichaud obra: received. I'll tackle it as soon as I get over the parrot hump
rindolf eric256: can I do something like first { $n % $_ == 0 } ($start_from..Inf)
obra thanks 15:43
rindolf ?
eric256 do { $p++ } until ($n % $p == 0);
TimToady for $start_from... -> $p { ... }
eric256 $p = $start_from; while ($n % $p) { $p++ }; 15:44
lumi lazy { filter { !($n % $^a) } $start_from..Inf } ? 15:45
eric256 stares at lumi 15:46
lumi Too long in haskell-land, sowwy
rindolf lumi: I only need the first element.
lumi Yeah, so [0] from that :)
rindolf lumi: Scalar::Util has a first function. 15:47
lumi: sorry List::Util.
lumi: does Perl6 has something like that?
lumi Nunno 15:48
TimToady [||] or some such
eric256 wonders if we can get rindolf to post this to PM with some test cases. ;) 15:49
rindolf eric256: Perl Monks? 15:50
eric256 yea rindolf...i'm trying to drag perlmonks into p6 land slowly ;)
besides we have to start accumulating this ideas and code somewhere, and thats already there.
rindolf So is there a "first" or "take" or whatever? 15:51
eric256 i don't think so. but it would be easy to write your own.
gaal wasn't gather/take stipulated in S29? 15:52
lumi Ah yeah, take
rindolf gaal: ahoy!
gaal hi rindolf
rindolf gaal: sup?
gaal it's all good 15:53
rindolf gaal: good.
eric256 sub first (Code &code, @list) { for @list { return $_ if &code($_) } }; or something like that
symantics might be wrong there dunno 15:54
TimToady guys, first is [||]
gaal TimToady: [//] probably?
rindolf TimToady: [||]
TimToady: how do I use it?
TimToady it's just a list operator [||] @list
eric256 TimToady how can that be used when he wants the first one that that forumula returns 0 on?
rindolf TimToady: lemme se.
gaal eric256: [//] instead :) 15:55
eric256 @list.first { $n % $^a == 0 };
[//] map { $n % $^a } @list; ??
maybe something like [//] grep { $n % $^a ==0 } @list; 15:56
gaal rindolf: [someop] @list is reduce @list with someop
rindolf gaal: OK.
gaal eric256: which is lumi's suggestion :) 15:57
except he spelt 'grep' 'filter' because he's such a golfer
eric256 gaal in a not so haskell way. lol
TimToady It's kind of a shame that [someop] has to be limited to predeclared infix ops.
eric256 yea those are all still a pretty un-obiovus way to write @list.first:{$n % $^a == 0}; 15:58
rindolf Hmmm... lazy{[||] grep { 10 % $_ == 0 } (3..Inf)} does not work.
TimToady but otherwise it's ambiguous with [1,2,3] things
gaal TimToady: are backticks used already for something? :) # haskell `f` infix-anything
TimToady I don't think pugs does infinite lists yet correctly.
15:58 FurnaceBoy joined
TimToady backticks are attempting to be reserved for users to define 15:59
gaal use MyBackticksAreStrongerThanYours;
TimToady right
at least we can differentiate infix:<`> from prefix:<`> 16:00
gaal good thing Perl isn't in the habit of giving primes to the user to generate more identifiers, or we'd be dealling with `, `', `'', `''', ...
TimToady well, the mathematicians use primes because numbers confuse them. 16:01
eric256 feather is crawling today ;)
gaal eric256: did someone perhaps forget to nice their build?
rgs mmh quotes in identifiers : a sudden puff of perl 4.
gaal I don't think you could use adjacent quotes in identifiers in perl4 16:02
My::::Distant::::::::Relative
rgs I don't have a perl 4 handy to check :)
TimToady perl 5 doesn't allow a''b 16:03
a'b actually derived from Ada.
rgs notes that perl 5 had no regression test for the "Bad name" error, and adds 16:04
gaal
.oO( quote from the future: "I don't have a perl 5 handy to check :) )
16:05
TimToady though in Ada a'b was indicated that b was a property of a
gaal no nested or otherwise deep namespaces there? 16:06
brb
rindolf Hmmm... now [//] grep { $n % $_ == 0 } ($start_from .. $n); fails some tests 16:07
TimToady package why_would_you_need_deep_nesting?
eric256 rindolf [||] ( 1..150).grep:{ 10 % $_}; does work. so you just need to pick a high enogh number
err beat me to that...me and my slugish pug. lol. what does it fail?
lumi Is // right? 16:08
== would be a boolean, not ever an undef
TimToady == is not what grep returns 16:09
rindolf I see it converted it to a fraction. I had to intify it.
TimToady it returns grepped number
but then seems like it could just be [0] as suggested earlier.
unless that forces non-lazy behavior on its left side. 16:10
eric256 ( 5..150).grep:{ 12 % $_ == 0}[0]; works
TimToady The question is, will (5...).grep: { 12 % $_ == 0 }.[0] work eventually when infinite lists work? 16:12
eric256 shouldn't it? i mean it should unlazify up to the requested element
pasteling "rindolf" at 88.153.140.201 pasted "New version of graham.p6" (250 lines, 7.5K) at sial.org/pbot/16353
TimToady I think it should work. 16:13
eric256 doesn't p6 have memoization built in? 16:17
rindolf eric256: maybe it does.
eric256: but I need to memoize only on $n and not on $start_from.
eric256 you don't care where they are starting from? 16:18
rindolf eric256: in the original p5 script, my own custom memoization was faster than MJD's Memoize module.
eric256: I'm talking about get_squaring_factors.
eric256: $start_from is passed by the upper functions in the stack to indicate where to start looking for new factors. 16:19
eric256 hmm can't find any reference to memoization in the docs, must have imagined that 16:20
i could have swarn i read about it and it let you defined which parts of the sub signature to memoize on, must have been currying i was thinking of 16:21
for @$n_sq_factors -> my $p ..... the my there is redundant i've been told. 16:24
TimToady yes, $p is a formal parameter to the block, so it's automatically lexically scoped to the block. 16:26
eric256 would if (($min_id < 0) || ($min_id > $id)) be clearer as !(0 < $mind_id < $id) 16:27
TimToady I'd kinda like to see $min_id !~ 0..$id myself 16:29
pmichaud er, that would need to be !(0 <= $min_id <= $id), yes? 16:30
Limbic_Region $min_id eq none(0 .. $id); # what's the right way to say this with a junction?
eric256 pmichaud dunno, i have a hard time with the < || situation, hurts my brain. lol
Limbic_Region $min_id ~~ none(0..$id); # perhaps 16:31
eric256 Limbic_Region that assumes they are integers
TimToady what if $min_id is 1.5?
16:31 szabgab joined
TimToady Why use a junction if a range will do? 16:31
Limbic_Region then you sleep while you are at work because you aren't getting any at home with the newborn
szabgab ?eval my @a = (1, 2, 3); my @b = map { {"v"=>$_, "d" => $_*2} } @a; say @b.elems; 16:32
TimToady what makes you think it gets any better later? :)
16:32 evalbot_9601 is now known as evalbot_9624
evalbot_9624 OUTPUT[6 ] bool::true 16:32
eric256 Limbic_Region been there done that. ;)
szabgab so how do I create hash refs in a map ?
Limbic_Region szabgab - you can say hash 16:33
eric256 szabgab hash { "v"=>$_}
szabgab ?eval my @a = (1, 2, 3); my @b = map { hash {"v"=>$_, "d" => $_*2} } @a; say @b.elems;
Limbic_Region ?eval my @a = 1..3; my @b = map { hash {"v" => $_, "d" => $_ * 2} } @a; say @b.elems
TimToady but it ought to be taking that as a hash anyway. 16:34
Limbic_Region is little slow
evalbot_9624 OUTPUT[3 ] bool::true
Limbic_Region ?eval my @a = 1..3; my @b = map { hash {"v" => $_, "d" => $_ * 2} } @a; @b.perl
evalbot_9624 "[(\"d\\t2\" => (\"v\" => 1)), (\"d\\t4\" => (\"v\" => 2)), (\"d\\t6\" => (\"v\" => 3))]"
Limbic_Region ?eval my @a = 1..3; my @b = map { {"v" => $_, "d" => $_ * 2} } @a; @b.perl
I think it was TimToady
Limbic_Region verifies
szabgab TimToady: so is my first example a bug in Pugs ? 16:35
evalbot_9624 "[(\"d\" => 2), (\"v\" => 1), (\"d\" => 4), (\"v\" => 2), (\"d\" => 6), (\"v\" => 3)]"
TimToady looks like it to me.
Limbic_Region no szabgab - but probably in evalbot
szabgab it is the same in my Pugs
rindolf eric256: I'd rather keep it with the || because I'm using two different conditions.
szabgab that's why I asked as I could not figure out
16:36 amnesiac joined
TimToady looks like maybe the presence of $_ is forcing a closure interpretation when it should only be paying attention to the =>,=> ness 16:36
szabgab I add a test somehere 16:37
16:39 sahadev joined
eric256 rindolf or something like my @ids = @$final_vec.map:{ %primes_to_ids_map{$p} }; my $min_id = sort { $^a <=> $^b } [0]; then just look up the prime from the id ;) 16:40
and pretty much all of your c style loops can be wrtten with for ( ) -> { } format. 16:41
eric256 starts building a Util::Array module that has .first:{}, .last:{}, .min, .max ;) 16:42
rindolf eric256: you have few typos in your lines.
eric256 rindolf not surprising. ;) 16:43
16:43 bernhard joined
eric256 anyone know where the documentation on array and hash methods can be found? 16:44
rindolf eric256: I'm not sure there is a way to look up the prime from the ID. 16:45
eric256 rindol... you wrote it. ;) i thought from other spots it looked like some of your code could be reduced if you had a hash mapped the other way too. 16:46
audreyt eric256: yes, in docs/Perl6/API/Array.pod
eric256: but (surprisingly) you need to write it first! :)
eric256 errr i was looking in the S\d? is that not the place to look?
audreyt eric256: you can take materials from docs/Perl6/Spec/Builtins.pod
svnbot6 r9625 | szabgab++ | multi-key hashref is flattend in map
audreyt eric256: but S29 (Builtins.pod) is probably not going to cover every single class methods
neither would it be desirable to put everything in a .pod 16:47
eric256: so maybe help factoring out some :)
eric256 are those .pod converted into HTML for easy viewing anywhere? yes i'm aware some people find pod easy to view, i'm just not one of them 16:48
audreyt try "make htmlifypods" ? 16:49
in the docs/Perl6 directory
or, once we upload Perl6::Doc to CPAN, use the search.cpan.org interface 16:50
justatheory hi ingy
audreyt or, pod2html Builtins.pod > builtins.html
or, (for now) search.cpan.org/dist/Perl6-Bible/li...le/S29.pod 16:51
timtowtdi :)
TimToady did someone say my name? 16:52
audreyt er no, it's a common soundalike
eric256 rindolf btw my %id_to_prime = reverse %prime_to_id; should work...i think
TimToady I need to get a better name... 16:53
eric256 is that where you got your name?
rindolf eric256: I see.
lumi I didn't know irssi had soundex notify
TimToady amazing what you can do with festival...
pasteling "rindolf" at 88.153.140.201 pasted "graham.p6 - latest version" (250 lines, 7.4K) at sial.org/pbot/16354 16:55
rindolf audreyt: do you have any idea how to better perl6-ify sial.org/pbot/16354 ? It's a solution to the Perl Expert QOTW 8.
TimToady though now that I test it, it doesn't actually say those two quite the same.
I'm sure if I actually did hook up #perl6 to festival my family would rebel. 16:56
pmichaud TimToady: if they haven't rebelled by now.... what makes you think they ever will? ;-)
audreyt I tried that once... doesn't really work
if you can hook nicks to different voice profiles
TimToady ]I think it might work for notification of someone looking for you though.
audreyt then maybe
rindolf: looking 16:57
ingy justatheory: :)
justatheory: you wrote Test.Simple, right?
justatheory ingy: I did.
It has my name on it, no?
ingy I use it a lot
I wrote Test.Base
justatheory Yes, I saw that you bundled it with one of your JSAN modules.
Right, that one 16:58
Why not just require Test.Simple?
eric256 audreyt on the docs front...should i move the Array part out of Builtins...or just copy it to API/Array.pod ? copy seems bad sense there would be two non-synced versions.
ingy Do you know what Test::Base is on CPAN?
it's a data driven framework over Test::More 16:59
Test.Base is the port to JS
justatheory I figured
ingy so what do you mean by your question? 17:00
TimToady eric256: this is a profound question relating to MMD vs SMD.
ingy oh bundled...
I get it
because I patch it quite a bit
TimToady in the long run it can probably only be solved by hyperlinking of some sort or other. 17:01
ingy I was wondering if you wanted the patches?
I end up bundling Test.Base and Test.Simple in other modules too.
But a Makefile does all the work
audreyt eric256: just copy 17:02
eric256: for things that takes an array as invocant 17:03
and doesn't ever care about its other argument's type (or that only one type would make sense)
I think bring them forward to API/Array makes sense
eric256 i read the README but it doesn't mention what the Spec versus API directories are
TimToady but what will we do about MMD. I'd tend to argue they should be also sorted by first arg.
but with refs from the "other" type, maybe, unless it becomes culturally obvious. 17:04
eric256 thinks we need something entirly different than pod...or some way to compose pods together
TimToady on the other hand, people adding MMD "after the fact" probably don't have access to the original docs in some cases...
obviously we just need to teach everyone to look up docs via &foo:(Array,Hash).docs() 17:05
eric256 okay my head hurts.. lol
17:06 fglock joined
TimToady MMD hyperlinks, yum. 17:06
gaal meows
eric256 but seriously what about some way to register all the function documentation once for each function, and then have some index files that pull all that info together in different ways? one synced copy, and multiple static lookup pages. just my two cents
TimToady sure, it'd be nice if p6 docs were actually searchable, unlike a certain other language I could name. 17:07
eric256 begins to ponder if pod could be abused as some sort of database for functions. or if that is abusing pod too much 17:08
TimToady pod specs are currently being nailed down, so now's a good time to ask. gee, is ingy hiding now? :) 17:09
17:09 ruoso joined
ingy hides 17:09
eric256 it would be nice to include as part of the pods specs because then it could be used in actual applications 17:10
fglock ruoso: hi! 17:11
TimToady perhaps it doesn't need to be in the initial pod specs, as long as =use is powerful enough to pull in a system of sufficient functionality. 17:12
ingy eric256: join #perldoc
TimToady because I think docs, like programming languages, need to be able to evolve as needs change, and nailing down one way to do it is probably going to be wrongish in the long run. 17:13
ruoso fglock, hi
hcchien hmm...., pugs seems a little slow on my powerbook.
ingy TimToady++
fglock ruoso: congrats for lrep.p6!
TimToady fglock++ too 17:14
ruoso fglock, it wouldn't be where it is without your work
fglock++
GabrielVieira :) 17:15
17:15 pdcawley_ joined
justatheory ingy: Yes, send me the patches. 17:15
ingy justatheory: ok, next time I'm in there I will do. 17:16
which is pretty often
justatheory Cool.
We can always chat about it on #jsan on freenode, too
fglock ruoso: I rewrote parts of the rule engine, to allow for OO grammars - but I still need a few more hours before I can commit something that works 17:17
ruoso fglock, right... I'm almost in the point to use it the way you're doing... 17:18
17:18 SamB joined
ruoso fglock, but, I'll be working in other stuff this afternoon... so if you want to switch the rule engine in lrep-compiler... feel-free... 17:19
fglock, I'm still thinking in the refactoring of Perl6.p6 17:20
eric256 i joined perldoc but there isn't anyone in there. lol
ruoso fglock, take a look at Grammar_Model.txt and see how I plan to re-organize the rules 17:21
fglock ruoso: the engine internals changed, and the code will need recompilation - but I wrote a version of lrep that can compile to the new engine
ruoso fglock, and change it at will
eric256 TimToady is there someone i can see current spec for use?
fglock ruoso: ok
ruoso fglock, we're bootstrapped now...
fglock, we can change lrep and recompile everything... 17:22
GabrielVieira what is going to be the open syntax?
ruoso :)
GabrielVieira, there is an example in lrep.p6
GabrielVieira, I don't know if that is correct
GabrielVieira but without a method attribute
17:22 r0nny joined
GabrielVieira like if is < or > or >> 17:22
TimToady eric256: do you mean =use?
GabrielVieira or r, rw, etc 17:23
eric256 yea
ruoso GabrielVieira, I used IO::File at first time...
GabrielVieira, then I let to implement it later...
GabrielVieira we were talking a time ago about that
17:23 ghenry joined
GabrielVieira TimToady whats that guys nickname? chromatic? 17:23
he made the open function.. but without an atributte 17:24
buuut..
TimToady yes, chromatic temporarily forgot that indirect object in P6 requires colon.
but it's fixed.
ruoso fglock, btw... feel free to commit there anytime even if it breaks everything :)...
fglock, broke things are more produtive
s/broke/broken/ 17:25
GabrielVieira the "lrep" file (which i imagine that is the perl6 compiled by perl6) has a open $out_fh, '>', $output_filename; syntax...
TimToady im talking about the "open for write.. read.. etc.. attribute.. :) the colon was fixed
fglock ruoso: I've already enough broken things 17:26
GabrielVieira ruoso "lrep" is the lrep.p6 compiled by lrep.p6?
fglock ruoso: new engine, new grammar, new compiler, new OO - I wonder if this will work :) 17:27
ruoso GabrielVieira, yes... I removed lrep.pl...
GabrielVieira hum
so
ruoso fglock, if not, we'll make it work :) 17:28
GabrielVieira in lrep the open function is with a "write" attribute... but lrep.p6 there inst
ruoso GabrielVieira, chromatic probably implied the ">" in Emitter::Perl5
GabrielVieira hum 17:29
so
can i fix?!
xD
eheh
i dind find perl6 open syntax... if its gonna be "open FH: $file, rw" or with > again.. 17:30
svnbot6 r9626 | fglock++ | PCR - updated grammar (compiled by a modified lrep); engine migration under way (tests fail) 17:31
ruoso GabrielVieira, Perl6::Bible 17:32
GabrielVieira, take a look there
GabrielVieira iv done
but the open function inst there yet 17:33
i thing its going to be the same
szabgab GabrielVieira: try docs/quickref/files 17:34
GabrielVieira: is my $fh = open "filename", :r 17:35
GabrielVieira hum
rindolf audreyt: here? 17:36
justatheory seen stevan 17:38
bah, no purl. :-( 17:39
stevan hey 17:40
justatheory stevan: Just noticed your Class::MOP.
Am I insane, or is it kinda similar to Class::Meta? 17:41
GabrielVieira szabgab humm
so
stevan similiar, but not the same
GabrielVieira so r: means open to read?
justatheory No, of course not the same, or else there wouldn't be two of them, eh? ;-)
stevan :)
justatheory: I think the two modules have different goals though
justatheory But the same idea: introspection/reflection, class generation, etc.
ah? 17:42
oh?
stevan class generation is a side-feature of Class::MOP
justatheory uh-huh
stevan the primary goal of C::MOP is metaclasses
which can be attached to any old p5 class
from what I could grok of Class::Meta it seemed to be more about introspection and reflection for Class::Meta based classes 17:43
I could be wrong though
GabrielVieira szabgab do u know about the :r in open function? 17:45
szabgab GabrielVieira: personally? not much :-) but it means to open to read
TimToady :r is the default, obviously.
GabrielVieira heheh 17:46
TimToady so open($filename) just works.
GabrielVieira humm
what about open to print?
ops
write :P
ruoso TimToady, that's exactly the opposite chromatic made on lrep.p6 :)
szabgab :w write :a append
GabrielVieira hum
is there a documentation about it?
szabgab :rw read and write 17:47
TimToady it's not clear yet whether '>' etc are good to continue to support.
GabrielVieira humm
ruoso TimToady, that's why I choose to use IO::File in the meanwhile.. :)
stevan justatheory: if you want, we can talk about this is more detail, just /msg me over at irc.perl.org (I lost my freenode password :)
TimToady It's also not clear that all of these are "open", which is getting rather heavily overloaded.
szabgab with '>' people sometimes think it is shell redirection 17:48
maybe print "text" > "filename" should work ?
TimToady it's supposed to be suggesting of that, but if it ends up after the fliename, it's counterintuitive, and if it's before, it's ambigious.
ruoso thinks open doesn't need to be a core function 17:49
TimToady I wouldn't spell it with '>' if we had such an operator. Maybe
print "text" ==> "filename" could be overloaded to work.
but "filename" ==> @list 17:50
would be taken as a single element list.
="filename" is about as close as you can get without special redirection ops.
and even that assumes unary = is smart about strings. 17:51
=<filename> probably works. 17:52
but that doesn't solve the open problem, which is fundamentally the fact that open is trying to intuit OOish ideas from non-OOish arguments, and there are too many dimensions to make every linear representation the "right" order of arguments. 17:57
for example, the filename wants to come before the modifiers when you're opening an ordinary file, but when you're opening a pipe, you'd like the modifiers, and then the command as a variadic list. 18:00
named argument syntax can sort of some of that, but eventually you really need to break your single function down into different methods, or the same named method on different classes. 18:01
18:01 Limbic_Region joined
szabgab shouldn't opening a pipe be a separate function ? 18:01
TimToady probably, but do we split it out on the name axis or the type axis? 18:02
eric256 open :file("filename") :r pure named params. totaly obvious ;) and you could even do :pipe(whatever would go here)
ruoso eric256++
TimToady open http: $foo
open uri: $foo 18:03
open file: $foo
open pipe: $foo
eric256 only problem is people who do open :file "x" :pipe "y" etc.
TimToady if those are types, that's just indirect form of:
http.open($foo)
uri.open($foo)
etc.
eric256 ohhh that works too.
ruoso i like it 18:04
wolverian what does open http versus uri mean?
TimToady then the question arises whether open should be polymorphic and just dispatch to the "real" underlying constructor.
ingy likes the lazy open ala IO::All
eric256 URI could be a network file wolverian
wolverian eh, of course. thanks :)
TimToady and whether "use open <uri file pipe>" should influence the handler order.
wolverian albeit that doesn't feel very pure - http.does(uri)?
TimToady the question is whether it assumes "http:" on the front. 18:05
ruoso but this is in the same level IO::File is...
or IO::*
szabgab open dir: 18:06
justatheory stevan: Sorry, I gotta take care of my sick daughter. I'll bbl
justatheory & # bbl
stevan justatheory: take your time :)
ruoso so, how does 'open http:"www.google.com"' looks like? 18:08
TimToady one is inclined to shorten open uri: to uri(), but that's inside out like P5's hex function.
under an MMD view, you want to cast the string:
open uri($foo)
maybe
ingy night all
theorbtwo I'm not sure it makes terribly much sense to try to unifiy directory open and file open; the only thing they have in common is that they both open files. You can't read bytes out of a directory, or files out of a nondirectory. 18:10
ruoso always get confused by the hex funtion...
TimToady night, ingy.
which is why hex() is gone in p6
theorbtwo Lots of newbies get confused by hex() when they want sprintf("%x"...)
Arathorn hex() always seemed to be a bit of a BASIC refugee 18:11
ruoso TimToady, isn't it the case to leave open just to files and the rest to modules?
TimToady it violates the cultural expectation that foo(bar) turns a bar into a foo.
ruoso: that's kind of what I've been working around to.
but arguably someone from the future could argue that uri should be the default rather than bare filename... 18:12
so I've been putting off designing open() because, well, I always want to have my cake and eat it too... 18:13
ruoso TimToady, for a module, maybe... for a reserved word... I don't think so...
TimToady, oneliners usually don't use open
TimToady which is why I wonder about "use open".
theorbtwo I think it'd be nicer if there was no function named open, so nonfile open could share an API with file open, just on a different module.
My oneliners often use open, but they use LWP::Simple almost as often.
ruoso votes for plain modules in place of open... 18:14
theorbtwo (We probably want to have the module for ordinary open around without using it, but that's an implementation detail.)
eric256 if we go file.open, uri.open etc then those would each be in a module right? easy to add to the same syntax form later 18:15
TimToady I think standard function open() is "proto open (Str, *%args)" or some such, and everything else is left to MMD.
theorbtwo BTW, note that there's no way to give a CWD-rel path as a file: URL.
TimToady Right, if you call as SMD, you get SMD.
if you call as a function or list operator, you get MMD. 18:16
but I think that means we don't have
open('>', $filename);
theorbtwo Shouldn't those not be in the root namespace?
Is writing "file." that hard? 18:17
TimToady SMD methods are never in the root namespace. Which "those" are you meaning?
ruoso TimToady, what about: open($file) or open(*%args,$file)
theorbtwo I mean the "file", etc, modules.
eric256 i like file.open("test" :r); or even file.open("test" :read) 18:18
ruoso eric256, why not just parameters?
TimToady nit: probably requires comma before :r there...
eric256 i don't think most people will mind file. if it means they also get things like http.open
ruoso eric256, then it's better to be IO::File.open($file,:r) 18:19
eric256 TimToady yea i wasn't sure about the comma and open could be multi with a string followed by named, or just pure named right?
ruoso using standard module names
TimToady I'm saying we can have file.open as well as open(). We've been careful to distinguish SMD from MMD calls for anything with multiple args.
eric256 ruoso why? file could be a standard module
theorbtwo Why do we want open() when we have file.open() or IO::File.open()? 18:20
ruoso eric256, it's confusing to have some modules Capitalized and some lowercase...
eric256 ruoso lowercase modules are used by default. strict and warnings aren't confusing
ruoso eric256, they are pragmas
eric256, that's why they aren't confusing
eric256 doesn't find standard modules with lowercase names confusing in the least 18:21
TimToady to2: huffman wants something short for just reading a file.
18:21 fglock left
ruoso TimToady, there's slurp... 18:21
TimToady slurp is not the same 18:22
theorbtwo ...but file access types are the kind of thing that people are going to want more of, and it'll lead to the proliferation of short, lowercase, colonless module names on CPAN-ish. 18:23
ruoso TimToady, so... just reading a file requires just open("file","mode") 18:24
eric256 theorbtwo not if its just used for the builtins, whatever those turn out to be
TimToady "Short, lowercase, colonless module names, the Final Frontier..."
no, just open $file
theorbtwo laughs.
eric256 TimToady it sounds like you *can* have your cake and eat it too
TimToady up to a point, and I think that point is open('>', $filename). 18:25
theorbtwo I think that's a reasonable point.
eric256 errr...meaning? lol i'm a little slow
ruoso so... two prototypes: open($filename) or open($mode,$filename)
TimToady unless we special-case :> or some such. 18:26
eric256 :> ewww
ruoso see no problems in using > inside quotes
18:26 bsb joined
TimToady but there's no MMD proto open (Str, Str). 18:27
eric256 open('file') ==> $fh; #read, $fh ==> open('file'); #write
TimToady congrats, you're reinventing IO::All :) 18:28
eric256 lol
TimToady only with sane pipe ops.
eric256 my $fh <== open("filename"); is kidn of pretty in its own way
TimToady If we're gonna do that, I'd rather also have 18:29
io('file') ==> $stuff
Limbic_Region TimToady - I know you aren't implementing Perl 6 for fear that it will become Perl 5 but are you working with Nicholas at all on modifying Perl 5 to support p5 -> p5 and ultimately p5 -> p6?
GabrielVieira so
open an url is going to be possible with open? 18:30
TimToady LR: yes, I wrote the first year's worth of that code. I haven't gone back and looked at what remains after integration with blead yet though. Keep getting distracted by this IRC thang...
certainly with uri.open()
probably with open uri($str) if there's an MMD proto open (Uri...)
but bare open $str is still gonna resolve to open(Str...) 18:31
which defaults to files.
unless we decide otherwise.
but I think history is on the side of open defaulting to files.
ruoso and what if ReadOnlyFile, WriteFile, AppendFile are types... 18:32
TimToady If we want something to default to uris, maybe it's wget() or some such.
ruoso and you have special tokens to them
like >'file' will create a WriteFile type
<'file' will create a ReadOnlyFile type
and so on
TimToady If they are, I don't want to know about it. :)
wolverian File does Write
TimToady IO types is one of those areas where people have gone far too much in the analytical/reductionist direction. 18:33
ruoso then open is a MMD, that has entries to open(read),open(write)
TimToady why preserve a meme that's too heavily overloaded?
GabrielVieira $content = open.file('file.txt',r); 18:34
$content = open.pipe('ls',w); # if w warns are displayed if -w they arent. :D
$content = open.url('www.google.com','80');
$content = open.https('www.google.com','6002');
$content = open.protocol('irc.freenode.org','irc','6667');
:P
eric256 ruoso if you do that then at least do open read(file) and open write(file_ instead)
Limbic_Region really likes GabrielVieira's approach fwiw 18:35
GabrielVieira :)
TimToady I don't really like a pseudo-type like "open.foo"
eric256 hmm make open the package and the method actualy be file? drop the . add a space and you have the mmd approach 18:36
TimToady all you've really done is invent a new indirect object notation.
GabrielVieira yep
ruoso open ==>'file' open <=='file' open <+='file'
ruoso brainstorming
Limbic_Region doesn't like indirect object notation but he does like clarity
GabrielVieira it need to be easier as possible
eric256 ruoso stop stealing my ideas. lol
ruoso ok... open is a mmd 18:37
eric256 $fh = open file('file.txt'); #is still clear
Limbic_Region eric256 yes
GabrielVieira maybe open, socket e pipe function resolves everything
TimToady but do we really need the extra abstraction of a string that knows what it's supposed to turn into when opened? why doesn't file() just open it? 18:39
eric256 yea i was kinda just wondering that.
GabrielVieira socket('irc','irc.freenode.org','6667') / socket('https','www.google.com','6602') / socket('http','www.google.com') 80 is default / pipe('ls') / open for files
eric256 what is gained by making all of these work with just open? and is that gain kept with the MMD approach or just abstracted into oblivion
GabrielVieira TimToady $filehandle = open(file); 18:40
eric256 i mean do they all return something thats a Handle object that the same operations can be done one?
TimToady If we're goin to have self-typed strings, then we might as well just go with the http: convention. 18:41
rather than reinventing it.
GabrielVieira $filehandle = open.file('file.txt');
$content = open.file('file.txt',r).content;
:P
eric256 open("file://filename"); open("www.google.com"); open("ftp://");
theorbtwo I'd rather prefer the uri:...'', but if you can say it either way, I'm happy.
eric256: What's perl5's open("./foo") ? 18:42
pasteling "ruoso" at 201.9.35.107 pasted "summary" (8 lines, 302B) at sial.org/pbot/16356
TimToady to2: exactly the same
theorbtwo OK.
TimToady I think open just opens files by default. and io() takes a uri-ish thing.
theorbtwo Might get confusing if people want to use old-macos style filenames. 18:43
TimToady to2: please explicate
theorbtwo Is http:foo foo/, or is it ./http/foo?
?
GabrielVieira ruoso looks nice :)
TimToady string boundaries have to be good for something...
theorbtwo Er, or is that /http/foo? I don't actually use any version of macos... 18:44
eric256 the advantage of the type being contained in the string is that then the same code could work wether its reading from a file or a website, or an ftp. the config file could just contain the entire URI ?
GabrielVieira $filehandle = open.file('file.txt'); 18:45
print $filehandle.content;
?
theorbtwo You can do that in any case if one of the types is URI.
TimToady Right, and that's presumably the io() interface stolen (in part) from IO::All.
eric256 theorbtwo hmmm true...
GabrielVieira how we get the file content?
eric256 GabrielVieira slurp it or my $content = [~] $fh;
TimToady how do you want it? 18:46
18:46 levengli joined
GabrielVieira eric256 i mean with the open function 18:46
Limbic_Region shaken not stirred
eric256 GabrielVieira open returns a file handle. you get the contents from the filehandle
TimToady what's open got to do with it?
eric256 my $content = [~] open("file");
TimToady io() returns something that can be used as a filehandle.
GabrielVieira $filehandle = open.file('file.txt'); 18:47
print $filehandle.content[5]; # prints to STDOUT the line 5
TimToady you can't reduce a scalar, eric256
eric256 my $content = [~] @{open("file")}; #? ??
of course that doesn't realy matter cause you woul djust do my $content = slurp "file";
TimToady but an io() object can be smart about list context.
theorbtwo open("file").slurp sounds good to me.
TimToady that should work, if you want it all as a single string. 18:48
slurp is not context sensitive though.
eric256 so you can't do @lines = slurp "file"; ?? thats kind of sad 18:49
theorbtwo Yeah, wasn't that what we were going for? If not, my @lines = =open("file")
TimToady sure you can, just not with slurp.
eric256 just get rid of open all together have read(uri); write(uri); and append(uri) and move on ;)
TimToady how 'bout @lines = lines "file".
eric256 why have lines when we have slurp? 18:50
GabrielVieira $filehandle = open.file('file.txt');
print $filehandle[5]; # prints to STDOUT the line 5
print slurp($filehandle); #prints all the content
theorbtwo Even better; I don't much like prefix =.
TimToady or =io('file')
probably io('file') ==> my @lines does what you want. 18:51
but the whole point of introducing slurp() is to turn off line processing. 18:52
eric256 which of course means my @lines <== io('file');
TimToady that too
though note that that's almost certainly lazy.
eric256 fits me well.
well we went round and round and didn't get anywhere ;) 18:53
TimToady I didn't even get to $job. Oops... 18:54
I'd better toodle...
theorbtwo Adios.
TimToady cioa&
s/oa/ao/ 18:55
19:03 particle_ joined 19:07 FurnaceBoy joined 19:15 _meppl joined
chip wanders past, scheming to destroy 'Scalar of' 19:23
wolverian ties chip down and demands an explanation 19:26
GabrielVieira what was decided about open? 19:28
:)
integral why don't we fix parrot instead of breaking perl6? 19:30
particle_ the door to #parrot is always open... come on in :) 19:31
integral too much C.
Arathorn why did you kill the little 'Scalar of'? it was your friend :'(
particle_ parrot could definitely use more tests, which don't require C at all 19:36
integral instead they require stupid PIR 19:37
particle_ they require PIR, or PASM, or perl6 rules, or perl5 regexes 19:38
LeTo see also: languages/pugs/t/pmc/*.t
in the parrot repo
integral particle_: perl5 regexes? doesn't perl5 come with a big test suite for those? 19:40
particle_ integral: yep, it does. and most of it (~800 tests) has been stolen to test parrot. but regression tests are rarely enough. 19:42
integral ah, I thought those one were more than regression 19:43
probably the best thing would be a regexp generate and test it in a QuickCheck style
*generator
particle_ that would be most welcome 19:44
19:44 hlen joined
eric256 GabrielVieira there was no decision, it was more just a discussion of options than trying to come to a decision 19:58
GabrielVieira humm
:P
it needs to be implemented hurry 19:59
hurry is right?
:P
there is lots os options 20:00
GabrielVieira there are 20:01
TimToady open($filename, :foo, :bar) is the basic interface for opening a filename stored in a string. 20:04
when you want to attach it to "stdio"ish routines.
sysopen() or some such is the low-level OS-ish routine that bypasses stdio/Perl::IO/whatever. It maybe need to be imported from some OSish module to be there... 20:05
piped opens are not done with open, but with some variant of run(), most likely. 20:06
where run() is the replacement for system/exec things.
chip back 20:07
TimToady all dwimmery should be isolated to an explicitly dwimmy interface, so that we don't accidently enable injection attacks like 2-arg open did in Perl 5.
chip integral: Parrot doesn't need fixing. Perl 6 needs fixing becuase it's started to suffer from the Python Disease
"There's only so much orthogonality a language can take until it becomes Python."
"Array of Integer": good "Scalar of Integer": Python disease 20:08
TimToady parrot has designated that the only true value types are int, num, and str.
Limbic_Region lines chip and larry up to see who can pee further
TimToady everything else is implicitly Scalar of
chip TimToady: You're assuming your conclusoin ... which, as a designer, is of course your privilege, but let's be clear 20:09
"True value types" is a McGuffin
eric256 thinks both TimToady and chip talk in riddles or lies...but can't decide which ;) 20:10
integral which one of you is designing perl6 and which parrot?
chip eric256: Go not to architects for wisdom for they will ask you for use cases
TimToady Scalar of is not a problem when we've already said it's dead unless explicitly declared in a lexical scope, and then it's the compiler's problem. 20:11
I see "Scalar of" as basically the "does Tieable" interface. 20:12
chip TimToady: I confess my objections, coming from me as they are, might have been (reasonably) misinterpreted as "it won't work on Parrot if you do that". Like I've observed before, I think audreyt is up to targeting Turing machines; Parrot is hardly a challenge
TimToady so we know in a lexical scope whether we have to pessimize.
It's quite possible that all three of us are talking about different elephants... 20:13
chip My point is, the "Scalar of" model means that Perl 6 is embracing the -concept- of value objects implicitly, and that seems to me a poor match for the already-established presumably-still-primary target
(i.e. Parrot, which does not have and doesn't plan to have any such abstraction)
Not to mention an extra level of indirection in a place where it can scarce be afforded. Though perhaps I'm only picking on the the bit of the elephant to which I've been exposed 20:14
TimToady A value is simply an object that is sufficiently read-only that it doesn't matter if we treat all instances of it as the same instance on some abstract level. 20:15
Limbic_Region gets the elephant reference and wonders if chip and larry are mice
chip Yes, that much I get.
LeTo chip: you are missing the advantage of shared values it seems
chip TimToady: Allowing for the extra value of indirection is expensive in complexity and introduced possibility of bugs, and when an alternative exists that is simpler, often faster, and never slower, I don't see why you abandoned it 20:17
s/value/level/
TimToady Don't see how you can claim that when efficient modern VMs depend on COW. 20:19
chip The Parrot PMC model allows for modified Scalar semantics the same way Perl 5 does: By tricking out the value to respond to another protocol. Imagine a Perl5 in which the magic vtable worked for all objects, there was only one magic structure per object, and every semantic (including base semantics) were accessed thereby. Simple! Fast!
TimToady oops, I'm being dragged off to lunch by my compatriots.
bbiab& 20:20
you can have the last word. :) &
chip what makes you think I'll stop at one? :-) 20:21
Limbic_Region chip - what's up with geeksunite?
Limbic_Region can't get to the page
chip me neither. didn't expect that. I'll investigate 20:22
szbalint oh its been like that for weeks now
I wanted to ask but didn't want to interrupt. :)
Limbic_Region well, that's not exactly good 20:23
szbalint no, it's not. 20:25
chip Weeks?! 20:26
WTF
Limbic_Region has to admit he only checks it about once a month so can't confirm szbalint's statement
Limbic_Region would check more regularly if chip blogged there (or anywhere for that matter) 20:27
last use.perl journal entry was June of last year
luqui has apparently stopped journaling the p6 weekly meeting minutes too (unless of course they are on hiatus) 20:28
Allison hasn't journaled much lately either 20:29
Jonathan Worthington dominates planet parrot with very few other contributors
Limbic_Region has been having a hard time getting his fix for what's the skinny on the Cabal 20:30
Limbic_Region feels like one of the Watchers
szbalint I admit that I only realised your situation chip around 2 weeks ago when I read the link on the perl summary thing. 20:31
So I wanted to check out your site but it was unavailable
so I used google and wikipedia and found the slashdot discussion about it, but the site was timing out.
pmichaud Limbic_Region: the weekly meetings are still taking place, although I missed a bunch of them because of paying-job-deadlines (and scope creep on that job) 20:34
chip szbalint: I think I figured out why the site isn't working. I'll pass the word to those who run it
thanks for the heads-up 20:35
szbalint I wonder if it was constantly down since I checked or up and down periodically :\
particle_ there are logs of the parrot weekly meetings at parrotcode.org: www.parrotcode.org/misc/parrotsketch.html 20:38
Limbic_Region thanks particle_ 20:40
thanks pmichaud too
particle_ btw anyone is welcome to come watch the proceedings on #parrotsketch (irc.perl.org), too 20:42
FurnaceBoy oh? 20:43
what's on offer? live badger juggling
Limbic_Region is more interested in just keeping up with what everyone is working on particle_
FurnaceBoy ?
Limbic_Region I live vicariously through others
particle_ limbic_region: well, you can watch in realtime, or read the log, it's the same to me. just glad folks are interested in what's going on 20:44
Limbic_Region particle_ - I am extremely interested in everything perl[56]/parrot/ponie/pugs related and read everything I can on how people are involved 20:45
I just haven't been too involved myself for some time
20:50 hcarty joined 20:53 kanru joined 20:55 iblechbot joined 20:59 hcarty left 21:08 Muable joined 21:09 Muable left, Muable joined 21:14 _meppl joined 21:29 _meppl joined 21:30 dolmen joined 21:34 Quell joined 21:39 broquain1 joined 21:40 leo_ joined
leo_ is anyone doing weird things on feather? 21:41
eric256 it needs akick in the pants ;)
leo_ it?
eric256 feather
21:48 _meppl is now known as _meppl_ 21:49 broquaint joined 21:50 _meppl_ is now known as meppl, anatoly joined, PerlJam joined 21:51 webmind joined, wolverian joined, chip___ joined
wolverian heh, audrey's pugs is bogging down feather :/ 21:51
leo_ what did she do? 21:52
wolverian I don't know, I just saw pugs hogging all the cpu in top.. 21:53
leo_ which script? 21:54
wolverian 'pugs'
so, not very useful
leo_ ps axww|grep pugs
wolverian can't connect anymore
21:54 LeTo joined
wolverian wait, now it's back 21:55
hrm.. all I saw was svnbot from audrey, and one defunct process. now feather isn't replying again 21:56
(s,process,pugs process,)
leo_ yeah, its not really clear, what's happening
wolverian it's the attack of martians!! 22:02
22:06 audreyt joined, anatoly joined 22:08 sahadev joined 22:09 webmind_ joined, broquain1 joined 22:10 LeTo__ joined, chip joined 22:11 taeli joined
ruoso reading S05 one more time 22:11
ruoso hopes he'll fully understands it some time 22:12
22:13 anatoly joined 22:16 webmind joined 22:17 PerlJam joined, chip___ joined
ruoso So... if the closure inside a rule returns something, it should be used as the value for the match object, else not... is it correct? 22:17
ayrnieu closures always return something. but audreyt wrote to p6* about that recently. 22:18
22:20 anatoly_ joined
ayrnieu and also: "An explicit return from the closure binds the result object for this match, ignores the rest of the current rule, and reports success" 22:20
22:20 audreyt joined, nothingmuch joined
ruoso ayrnieu, so I must really check if there is a return statement inside the block? 22:21
ayrnieu, during parsing, i mean.. 22:22
ayrnieu perhaps, if you want to handle explicit returns from the closure as S05 describes.
ruoso trying to make the rule for "real Perl 6 code inside rule closure"
ayrnieu, the problem is that I actually use closure inside Grammar::Perl6.p6
"fail" could be something like "die"? or like "return false" 22:24
ayrnieu I recall it offered as something flexible that could be a die or a 'return undef'
but in S04: The "fail" function responds to the caller's "use fatal" state. It either returns an unthrown exception, or throws the exception. 22:25
ruoso ouch... I think I won't support fail for now... :) 22:26
ayrnieu meaning that it acts like 'return $exception', not that it returns that itself. Hopefully :-)
22:26 huhlig joined
ruoso "When called as a closure, a Match object evaluates to its underlying result object" 22:27
so... the default return of the closure is the match itself
"Usually this is just the entire match string"
ayrnieu honestly, the 'explicit return' thing in rules strikes me as odd.
ruoso so... the closure is called with match defined. The default return is the match itself... if the return of the closure is something different from the match, then blablabla 22:28
makes sense? 22:29
ayrnieu ruoso - no. It has to be an 'explicit return'.
'return' is magical in rules, unlike everywhere else.
huhlig could someone look at three lines of code and tell me where I flubbed up
22:29 leo_____ joined
ayrnieu ruoso - look at an example from S05, for instance: / (\d+) { $0 < 256 or fail } / 22:30
eric256 sounds like it should be set_match_object($obj) instead
ayrnieu that closure has a return value that isn't a match object.
22:30 leo_____ is now known as LeTo
ruoso ayrnieu, this still fits to what I proposed 22:30
huhlig pastebin.com/606358 22:31
22:31 broquain1 joined
ruoso the closure, by default, would return the match itsel 22:31
22:31 chip joined
ruoso f 22:31
eric256 ruoso no because that would return 0 or 1 for true or false. which wouldn't be what it matched
ayrnieu ruoso - you mean that you insert a 'return $?SELF' at the end of the closure unless you see that it has a 'return $foo' in it?
ruoso s/unless.+$//
if there is a return before, the second return will not be called 22:32
eric256 smells a hack.. if its a special case then shouldn't it have a special call? i.e. match $obj; instead of return $obj;
ayrnieu ruoso - oh. oh :-)
ruoso - hah, I'm silly, that's a perfectly straightforward way to have the magical return.
ruoso eric256, certainly it is... 22:33
eric256, but as a closure, it makes sense to avoid creating a different syntax...
eric256, since it's just regular Perl 6 code...
22:33 webmind_ joined
huhlig sighs 22:33
eric256 but you ARE giving it different syntax in a hidden magical way which is -- to me 22:34
ayrnieu so, 'closures in perl6 rules end in an implicit ``return $?SELF'''
eric256 because even though regular clousers return the last value, these wont
ayrnieu or, you know, ';$?SELF'
ruoso ayrnieu, but this is hidden 22:35
eric256, ^^^
eric256 yes that surly is better than adding a new keyword for this... </sarcasim>
or even $?MATCH = new Object; would be better.
ruoso eric256, the magical return itself is strange...
integral "sarcasm"
22:35 Limbic_Region joined
eric256 thats what i am saying. magical return = bad 22:36
integral i like to pronounce the "sim" ;)
ayrnieu it's not magical anymore, it's just 'return' in the context of "closures in perl6 rules end in an implicit 'return $?SELF'" -- pretend that this is in S05 :-)
eric256 it is magical because the closure is now ignore implicit returns which are used everywhere else 22:37
ruoso reading S05... it really seems confusing...
ayrnieu eric - the context of the closure is magical, in that it inserts 'return $?SELF' 22:38
nirgle are there actual developers active in this channel or is this more of a "read-only" group of perl6 followers/fans
eric256 why not just $?MATCH holds the current match object. replace it with your own if you want.
ruoso TimToady, what do you think?
eric256 done, no implicit,/explicit magic
ayrnieu but that there is magicalness in /rules/ is less surprising.
integral nirgle: we're all fans! But yes, some of us develop of Pugs, and others are rather well known in designing perl6
eric256 ayrnieu but why even have the magical crap when tehre are two easy/clean/non-magical solutions 22:39
ruoso is there any example in S05 of a closure that does not magic-return?
ayrnieu eric - well, return values are simply ignored otherwise, and this makes them neatly useful.
22:39 PerlJam joined
ayrnieu eric - so it's sort of DWIMy, but it doesn't offend me anymore. 22:40
22:40 anatoly joined
ruoso "Embedded code does not usually affect the match--it is only used for side-effects" 22:40
eric256 how is ignoring implicit returns usefull? randomly removing a feature people are used to is just plan bad form unless it is needed
in this case you arn't saving anything at all by doing this, and instead are adding another layer of magic. 22:41
ayrnieu eric - well, see the random example from S05 again.
/ (\d+) { $0 < 256 or fail } /
ruoso tends to agree with eric256
huhlig ayrnieu mind looking at something quick?
ruoso eric256, but... what the hell would happen to the return of the closure...
eric256 ayrnieu i didn't say you shouldn't ignore the return. i am saying that only ignoring implicit and not explicit is bad 22:42
ruoso got it...
eric256 ruoso nothing. ignore it ALWAYS. and only care about the $?MATCH vairable. (or whatever it would be called)
ayrnieu that closure does something useful, but it has a perfectly useless return value. Either refusing to add the magic 'return $?SELF' or refusing to ignore return values leaves you with explicit 'return $?SELF' in every closure in perl6 rules.
ruoso eric256, makes sense... really
eric256 (d+) { $0 << 256 or return 0 } / or / (d+) { $0 << 256 or $?MATCH = 0 } / 22:43
22:43 Ara5n joined
nirgle integral: thanks for the intro 22:43
i'll hang out for a while
eric256 / (\d+) { $0 < 256 or return 0 } / or / (\d+) { $0 < 256 or $?MATCH = 0 } /
ruoso ayrnieu, no... if you ignore it at all, no implicit return $?SELF is needed
eric256 its about the same but the first one handles { $0 < 256 or 0 } badly
ayrnieu eric - the first what? When is 'or 0' handled badly when you want any return to be the new $?MATCH ? 22:44
ruoso eric256, and what about fail?
ayrnieu although '$foo or 0' can be reduced to '0' without looking too closely at $foo
eric256 ayrnieu you are ignoring the implicit return of 0
"return 0;" and "0;" shouldn't have different effects 22:45
ruoso eric256, yes... that's correct
ayrnieu eric - OK, then they should both be useless.
eric256 yes
thats what i'm saying. better that they are both useless and a different feature used, than overloading them just in this special case 22:46
ayrnieu eric - the alternative is explicit $?MATCH at the end of every rule when you only want to do something simple like optionally fail.
eric256 why?
fail would still work the same...what am i missing?
ayrnieu eric - the alternative to making them useless is explicit $?MATCH.\
eric - no, '{ test or fail }' does not ever work well in the 'any return is the new $?MATCH' universe. 22:47
ruoso eric256, ayrnieu, see the example code just before "Subpattern captures" in S05
eric256 err ayrnieu i'm not saying we use the return at all. thats my whole point
ayrnieu the q(implicit 'return $?SELF' at the end of closures in rules) universe, however, differs from the ignore-all-return-values universe *only* in that an explicit return does something useful.
eric - yes, I restated myself as you seemed confused. 22:48
(by my reference to fail.)
ruoso eric256, ayrnieu, the two blocks
one redefines the match
eric256 but what is gained by the default implicit return that isn't also gained by using $?MATCH = $obj instead of return $obj ?
ruoso other returns
ayrnieu so 'return $foo' is either perfectly meaningless or useful. Why not make it useful?
ruoso eric256, return $obj sets the capture
eric256, doesn't change the match itself 22:49
eric256, at least this is what seems to be in S05
eric256 ayrnieu because doing so makes implicit and explicit returns different which i think is bad
huhlig hmm
ayrnieu eric - what is gained is inoffensive DWIMy.
ruoso eric256, and still there is the "stop matching" thing
eric256 it is offensive to anyone who reads the line "closures implicitly return there last value"
it is the "except inside clousures inside rules" that i think is bad 22:50
ayrnieu eric - er, OK, but I disagree -- and I am also anyone.
ruoso eric256, ayrnieu, the spec is confuse...
ayrnieu rules are highly magical places.
eric256 ayrnieu yes so don't make them highly confusing too just to make return DWIM for some people
Ara5n loves the proliferatino of terms like 'therein' and 'forsworn' in the pX doc
eric256 breaking expected closure returns jsut to be pretty when there are perfectly usable alternatives is annoying at best 22:51
ruoso eric256, ayrnieu, we need an explicit keyword to that
ayrnieu ruoso - it's not confusing to me, just lacking here in explicit defence or implementation suggestions.
eric - um, they aren't highly confusing.
and the expected closure returns aren't broken. 22:52
ruoso "return '0';" and "'0';" should behave the same way everywhere...
eric256 i didn't say they are confusing. i say its annoying to change return behaviours on a clousure just because it will make it pretty.
ruoso++
;) thats the entire point ayrnieu they should always act the same
ayrnieu There are *two* sane alternatives. "Always ignore return values" and "Do as the standard says, which happens also to make explicit return useful"
22:52 anatoly joined
eric256 ayrnieu use a variable to hold the match, let the closure modifiy it if it wants. whats bad about that? 22:53
ayrnieu ruoso - those only behave the same when they happen to be the last expression of a block.
ruoso so... we need to have both 'failed' and 'success'
ayrnieu ruoso - of a subroutine, rather.
eric256 closure return values in rulse go unused.
ruoso closures are subroutines... aren't it?
eric256 failed shouldn't care about what we do with returns, and success is automatic unless it failed.. 22:54
ayrnieu ruoso - uh, yes, I'm just saying that "return $foo" and "$foo" are only the same when in they occur as the last expression of a subroutine.
nothingmuch obra: ping
eric256 i think there must be some other part ayrnieu of this return thing that isn't getting communicated
ruoso Summary: 1) closure return values in rules are always ignored. 2) fail stop the match with failure. 3) ok(or something) stop the match with success. 22:55
ayrnieu anyway, S05 does something useful with explicit return values. I can't defend it anymore except by repeating myself.
obra nothingmuch: I always read scrollback. just ask me things in /msg
ayrnieu with explicit return, rather.
ruoso ayrnieu, that's what I'm trying to address in the summary I just made... 22:56
22:56 broquaint joined
ayrnieu ruoso - OK. Your summary conflicts with S05 on the issue of an explicit 'return'. 22:56
ruoso ayrnieu, I know that 22:57
eric256 ayrnieu S05 isn't gospel. its just the current spec
22:57 audreyt joined
ayrnieu ruoso - OK. Where are you getting #3? 22:57
ruoso #3 is new :)
eric256 hell you could even just change it from return to matched and be done.
ruoso if something can fail, it can succeed...
:)
ayrnieu ruoso - I see.
ruoso so, the counter-part for fail is ok 22:58
as you need explicit fail
it makes sense to require an explicit ok
eric256 make matched $obj; and macro for $?SELF = $obj; or whatever
ruoso (that's what the explicit return wants to do)
matched $obj; is nice for explicit "ok" 22:59
ayrnieu OK, hear ye: ruoso's implementation ignores return values and offers a magical ok() to replace S05's magical 'return'.
eric256 sees that they are executed as methods of Match which explains wanting to st $?SELF instead of $?MATCH....whats in a name. lol
22:59 anatoly_ joined
ruoso ayrnieu, the magic "matched" is ok too 23:00
23:00 macli joined
ruoso probably better than just ok 23:00
eric256 yea you don't want to confuse it with actual Test::More tests. ;)
matched $OBJ; could desugar to $?SELF = $OBJ; $OBJ.passed = 1; return; or something along those lines, raising the flag to say, hey we are done, don't process the rest of the regex 23:01
no magic, no confusion, still pretty ;)
ruoso seems ok to me 23:02
ayrnieu there's still magic, of course.
eric256 ayrnieu yes. but not added to already existing items like 'return'
ruoso eric256, that's relevant...
ayrnieu eric - also, when do you turn $OBJ into a "Matched" objected?
er, object.
eric256 actualy i see less magic, because now you have a way to know it was explicitly returned so don't process the rest of the rule 23:03
ruoso matched is a special return that tells the rule to use it and ignore the rest...
matched extends return
eric256 ayrnieu theoricatly you are building that object ot explicitly return anyway
ruoso eric256, exactly... the match object already exists somewhere
and the explicit return doesn't overwrite the match, but the capture 23:04
at least is what it seems in S05
eric256 the macro/method/keyword could do whatever you needed, thats the nice part of it not being return
ayrnieu eric - well, no. In in the 'closures-with-implicit-$?SELF-return', there's no magic about turning strings into Matched
eric - anyway, the implementation of 'matched $foo' is something ruoso can decide when he implements it. 23:05
eric256 if you do return "10" inside of that then the macro for matched "10" would do whateever your current magic for explicit return does
ruoso ayrnieu, but the return also had to handle it
ayrnieu eric - I only wanted to point out that your 'desugar' does not work.
ruoso - no, it didn't.
ruoso no?
eric256 ayrnieu it was psuedo macro stuff not meant as is ;)
Ara5n does anyone know how up-to-date dev.perl.org/perl6/doc is? 23:06
23:06 PerlPilot joined, broquaint joined
eric256 Ara5n most documents have a last modified date you can check 23:06
Ara5n ah, of course - thanks 23:07
ayrnieu ruoso - no. in S05, with my interpretation of implicit returns of $?SELF, closures in rules are run as methods on the "Match" object and either end up returning $?SELF or something else. Those 'something else' don't need to be coerced into 'matched objects'. eric's suggested desugar is more magical than this, but you can see how magical your own implementation needs to be.
ruoso ok... matched($obj); is an extension to return that does: $explicit_return = 1;return($obj);
ayrnieu ara5n - you might compare those with the latest Perl6::Bible on CPAN.
ruoso ayrnieu, this way we keep it working the same way... just uses "matched" to be explicit 23:08
ayrnieu, what do you think? matched == explicit return 23:09
working exactly as "explicit return" is documented
eric256 ayrnieu as said my suggested desugar isn't right. that doesn't mean that matched can't be desugared to work as an explicit return
ayrnieu *nod*, so, hear ye: ruoso's implementation will have an implicit 'return $?SELF' with 'matched $foo' as with S05's current 'return $foo' -- and will presumably do something to suppress actual 'return $foo' in closures.
s/as with/replacing/ 23:10
eric256 ayrnieu you are confusing sometimes. the implementation deems what happends to the returns. if it ignores them it need not suppress them
ruoso eric256, he's talking about the implementation side... not user side 23:11
ayrnieu eric256 - what it does will be functionally equivalent to what I describe.
ruoso ayrnieu, yes... something will need to be done with eventual returns in the closure....
eric256 and wether with matched or explicit return something still needs done with the value returned/matched wether that is putting it in the capture or the match object or whatever
ruoso in the implementation side
ayrnieu although, all this fuss and the only difference is a name change :-)
ruoso but I still can leave it as a bug for now :) 23:12
the documented is "matched"
eric256 thats why i didn't understand the fight. the point is not to confuse the meaning of returned when its not what you want, if it doesn't work as is and there is a viable alternative, why fight to leave it with a name somepeople would find confusing?
ruoso ayrnieu, no... sorry...
ayrnieu, I'm wrong
eric256 there is already plenty of stuff to screw up poor newbs or converst without adding more
ruoso matched can set another variable in the closure
and ends removing the need for the default return $?SELF 23:13
I would only check the result of the closure if the $explicit_return bit is setted
ayrnieu eric - I disagree, and your rationale doesn't convince me either. But it doesn't matter.
ruoso matched($obj); would expand to $explicit_return=1;return($obj); 23:14
where $explicit_return is another variable from the closure, as $/
ayrnieu, see?
ayrnieu ruoso - this is functionally equivalent to my earlier description :-) 23:15
ruoso no... there is no need to filter other returns from the closure
and no need to default return $?SELF at the end
eric256 then returns can still be used to short circuit without ending the match 23:16
ayrnieu ruoso - OK. Then you'll implement it exactly as S05 describes, but with a 'matched' macro than you will document and encourage.
ruoso ayrnieu, hopefully, matched could be promoted to spec
eric256 just have to find out who is in charge around here ;)
thats always teh hard part...might try a post to p6l ?
ayrnieu please don't take my !hopefully to heart.
ruoso ayrnieu, returns that do not set the $explicit_return bit will be ignored
maybe a fourth person could give some oppinion... 23:17
TimToady, audreyt, stevan, someone?
23:18 anatoly joined
ayrnieu it would seem to make more sense to ask p6l. 23:18
ruoso yeah..
who writes? 23:20
eric256 ruoso you seem closest to the implementation...but i'm just guessing that from this conversation ;) 23:21
and ayrnieu doesn't like it so we dont want him too lol 23:22
ruoso :)
GabrielVieira all give my opinion.. and u just gonna do what i say!
>/
GabrielVieira just kidding :)
i didnt get the point yet.. what r u talking about? 23:23
ruoso S05
explicit return inside rule closure 23:24
ayrnieu GabrielVieira - closures in perl6 rules as defined by S05 differentiate between explicit and implicit returns. ruoso and eric256 would rather S05 define them as ignoring any kind of return value, with a 'matched()' to replace the functionality of the current explicit return. One of them may write to p6l about this, and a new S05 may come out. 23:25
23:29 chip joined, PerlJam joined
Ara5n ruoso: does lrep share any code with Pugs::Compiler::Rule and it's siblings? 23:30
(or anyone else, for that matter)
23:30 anatoly_ joined
Ara5n is confused as to why grep -r Pugs $pugs/misc/pX/Common/lrep-compiler doesn't show anything up 23:31
23:36 audreyt joined 23:37 webmind joined, broquaint joined
ruoso Ara5n, not yet 23:37
Ara5n, fglock is working on it
Ara5n cool 23:40
if I wanted to have a play with the latest p6-rules-in-p5 stuff, then, I should presumably use Pugs::Compiler::Rule rather than trying to run p6 code under lrep?
TimToady You guys all seem to be under the misapprehension that return returns a value from the innermost closure. It doesn't, not even in ordinary subs or methods. It throws a control exception to the official sub or method (or now, rule). 23:42
eric256 Ara5n yes i beleive thats the way it works
TimToady then yes we where confused
ruoso TimToady, what?
eric256 so return is *already* magical in closures then obviously that whole discussion was in vein. lol 23:43
TimToady sub foo { print; { return 1 }; print } returns from the "sub", not the inner closure.
ayrnieu ruoso - translated: "return throws an execption to the official sub or method, everywhere in perl6"
TimToady yes.
eric256 so closures already behave differently for explicit versus implicit returns.....ayrnieu that was the missing peice i kept asking about. lol 23:44
ahhh well thats going to be confusing just in general then. lol
ayrnieu TimToady - thanks.
TimToady this is consistent with that. The only magic is that the rule stores the value into the match item slot because rules have weird linkage.
eric256 ayrnieu if you knew that then why didn't you mention it? hehe 23:45
TimToady It's exactly what newbies expect return to do if they don't know that half the control structres in their code are being emulated elsewhere.
ayrnieu eric - I didn't.
eric256 ahh
TimToady newbs expect return to dump out of the clousre AND out of the calling routine?
TimToady This is all right out of A06/S06.
s:g/6/4/
theorbtwo ...and it lets bare blocks act like them. 23:46
eric256: newbs write closures with sub.
eric256 you couldn't all have been around earlier lol
TimToady Every block in your sub is a closure.
eric256 ohhh
well that does change things.. return would have to or you'd have to return several times to get out of nested loops 23:47
TimToady return doesn't care which of them are in void context, which of them happen to be controlled by "if", "while", "mumble", "whatever".
eric256 is yet agian surprised by new perl6 features. lol
TimToady eric256: you got it.
eric256 S05 reads like it is treating explicit returns special, but its not realy 23:48
maybe its just a documentation cleanup then
TimToady and since we're completely trying to obscure the built-in vs user-defined distinction, we have to define return in terms of throwing a control exception to something expecting it.
eric256 so i could have my sub catch returns thrown inside its for loop (for example?) 23:49
TimToady And all the magic is on the receiving end.
23:49 kakos joined
TimToady yes, you could, and do something weird with it. It's like a CATCH block, only it's a CONTROL block instead. 23:49
eric256 so rules can just execute the closure and use a CONTROL block to grab it only when they do "return $x"; ? 23:50
TimToady the optimizer is of course free to optimize away the exception where it can determine that a stack peelback is unnecessary, but that's just an optimization.
right.
eric256 spiffy
TimToady it's only the immediate context that determines syntactically whether the closure is in void, boolean, or rule context. 23:51
Since side effects turn out to be mostly what closures are used for, and since "doing nothing" is the simplest thing, bare closures are void context.
<?{...}> is now boolean context 23:52
so is <!{...}>
only negated.,
<{...}> installs the return of the closure as subrule and executes it.
theorbtwo Ah, right, side effects are mostly what closures /in regexes/ are used for.
TimToady right--look at yacc grammars. Most of the statements either are side effects or set $$ (equivalent to our current return semantics) 23:53
but I think "return" actually reads better for that than setting some magic variable. AT least, I think poeple can get used to it. 23:54
you can still do magical variables if you like, of course. Match objects are full of 'em. 23:55
does this all make more sense to y'all now? 23:56
(not sure how it helps to implement "return" in Perl 5 internals, of course...) 23:57
You might actually have to use a magical variable and die "_RETURN" or some such.
theorbtwo Well, you can always implement it exactly as specced: Make it die \$returned, 'reallyareturnvalue', and put an eval{} around every sub/method/rule. 23:58
TimToady but ordinary subs are gonna have to do the same thing.
probably really wants a specially blessed exception object. 23:59
theorbtwo Isn't that what I just said?
TimToady I didn't realize die did autobless these days.