svn switch --relocate svn.openfoundry.org/pugs svn.pugscode.org/pugs/ | run.pugscode.org | spec.pugscode.org | paste: sial.org/pbot/perl6 | pugs.blogs.com Set by avar on 16 November 2006. |
|||
00:21
neonse left
00:23
nekokak joined
00:42
jamessan joined
00:47
TimToady joined
01:03
silent1985 joined,
audreyt joined
01:06
mako132_ joined
01:14
stef__ joined,
stef__ left
|
|||
Nei | ?eval my $age = 7; given $age { when 4..12 { "good age".say } } | 01:22 | |
evalbot_r14912 | undef | ||
Nei | :( | ||
Tene | ?eval my $age = 7; given $age { when 4..12 { "good age".say }; default { "omgwtf".say } } | 01:25 | |
evalbot_r14912 | OUTPUT[omgwtf] Bool::True | ||
Nei | any neat way to express the intended, avoiding $_? | 01:26 | |
Tene | ?eval my $f = 7; if ( $f ~~ 4..12 ) { say "it works" } | 01:28 | |
evalbot_r14912 | undef | ||
Tene | Huh. I thought that worked. | ||
01:32
mr_ank joined
01:40
lyokato joined
|
|||
Nei | ?eval my $age = 7; given $age { when any 4..12 { "good age".say } } | 01:55 | |
evalbot_r14912 | OUTPUT[good age] Bool::True | ||
Nei | :) | 01:56 | |
?eval my $age = 3; given $age { when any 4..12 { "good age" } default { "no." } } | |||
evalbot_r14912 | "no." | ||
02:03
phpError joined
|
|||
Nei | is there a way to actually fall through in a given/when like in C? | 02:16 | |
audreyt | "continue" | 02:19 | |
Nei | ?eval my $age = 7; given $age { when 7 { continue } when 8 { "fail" } } | 02:20 | |
evalbot_r14912 | undef | ||
Nei | switch (7) { case 7:; case 8: printf("fail"); break; } --> fail | ||
audreyt | oh, you mean to fallthru without testing | 02:22 | |
S04:478 | |||
(Note that, unlike C's idea of falling through, subsequent C<when> | |||
conditions are evaluated. To jump into the next C<when> block you | |||
must use a C<goto>.) | |||
02:23
cognominal joined
|
|||
allbery_b | hm, as I red that, you can do it with: given $age { when 7 { foo } when any 7..8 { bar } } | 02:23 | |
^red^read | 02:24 | ||
audreyt | when 7|8 { bar } | ||
allbery_b | or that | ||
Nei | these are ugly, because they test twice | ||
audreyt | the C treatment, though, is very confusing to me | 02:25 | |
timtowtdi I guess... | |||
allbery_b | yeh, many folks consider C's no-implicit-break to be a major source of bugs | 02:26 | |
(lint used to warn about cases without break unless you put a /*FALLTHROUGH*/ comment, even) | |||
Nei | confusing for some, but powerful without doubt | ||
ayrnieu | not that lint is anything to emulate. | 02:27 | |
allbery_b | hm? old lint was a useful tool for catching most common semantic bugs. the lint replacements I've seen over the past several years haven't been worth much, I'll grant | 02:28 | |
Nei | can someone show me a quick example of the goto way, I'm obviously too stupid | 02:30 | |
audreyt | Nei: you are not too stupid, pugs is | ||
*goto is not implemented | |||
actually, t/blocks/goto.t doesn't really test goto LABEL. | 02:31 | ||
Nei: edit that file to add some failing tests? | |||
(do you have a commit bit? if not, what's your email addr? :-)) | |||
Nei | heh, I see | 02:32 | |
audreyt | the relevant spec is S04/The goto statement | ||
Nei | that part of s04 seems pretty brief and without illustration | ||
I guess everyone knows how goto works from p5 | |||
audreyt | well, you can port perl5's goto tests then | 02:33 | |
Nei | but thanks for the confirmation of pugs being the culprit :) | 02:34 | |
audreyt | but the #1 reason why this feature is not there, is that nothing tests for it :) | ||
Nei | I have never committed anything to pugs | ||
audreyt | do you have a commit account, though? | 02:36 | |
if not, may I have your email address? | |||
welcome aboard! | 02:38 | ||
please commit with the account "Nei" to svn.pugscode.org after receiving the commit-bit mail | 02:39 | ||
search.cpan.org/dist/Perl6-Pugs/doc...c/Hack.pod has some quickstart guide | |||
lambdabot | Title: Pugs::Doc::Hack - How to hack on Pugs - search.cpan.org | ||
audreyt | it's customary to add yourself to the AUTHORS file first, then commit it | ||
to test that svn works | |||
have fun :) I'll bbiab | |||
Nei | I'm a wee bit scared though | 02:40 | |
audreyt | you'll get used to it :) | ||
Nei | adding yourself to the authors for a tiny test, sounds a bit exaggerated | 02:41 | |
I'll see what I can do, though | 02:42 | ||
allbery_b | the real reason pugs isn't complete is that @Larry's holding out until half the internet's in AUTHORS :> | 02:43 | |
Nei | heh | 02:44 | |
02:48
silent1985 left
02:49
bonesss joined
03:15
scw joined
03:36
bonesss joined
03:38
hobbs joined,
bpalmer` joined
04:05
robkinyon joined
|
|||
robkinyon | stevan: ping | 04:05 | |
04:05
bpalmer` left
|
|||
stevan | robkinyon: ping me over on irc.perl.org please :) | 04:40 | |
unless you wanna chat here :) | |||
robkinyon | feh | 04:41 | |
05:04
lisppaste3 joined
|
|||
svnbot6 | r14913 | Nei++ | * Added myself (Nei) to AUTHORS to test svn commit, as per recommendation by audreyt. | 05:04 | |
Eidolos | :) | 05:06 | |
audreyt | Nei++ | 05:18 | |
Nei | now, if I add just some goto label | ||
that will make pugs fail hard | |||
05:19
nipra joined
|
|||
Nei | should I try to catch that somehow? | 05:19 | |
audreyt | you can use eval"" | ||
see t/README for ideas | |||
is(eval("goto FOO; FOO: 1"), 1) | 05:20 | ||
something like that | |||
svnbot6 | r14914 | Nei++ | * Test for goto LABEL | 05:25 | |
audreyt | woot | ||
Nei | I'll port the p5 tests (maybe) if this one passes | 05:26 | |
audreyt | Nei++ | ||
gaal | haha oleg does it again. variable type state monad | 05:28 | |
Nei | I understand this is not the focus, but is there some secret to improving pugs startup time? it spends 20 seconds on the prelude =) | ||
gaal | do you have a blib6/lib/Prelude.pm.yml file? | ||
and: did you 'make | |||
' or 'make fast'? | |||
also, run a new GHC, it helps | 05:29 | ||
gotta moose & | |||
Nei | I did a make, I have a Prelude.pm.yml | 05:31 | |
I'll try a new ghc | |||
Eidolos | pugs takes only a second or so to boot up here (r14912 :)) | ||
Tene | couple seconds here. | ||
10 seconds or so on desktop. | |||
Nei | my computer is exceptionally bad ;) | ||
Eidolos | Ah, not much to be done about that, especially if you used make and not make fast. | 05:32 | |
Nei | so make fast makes faster, at the expense of slower runtime? | ||
Eidolos | Yeah, pretty sure. | 05:33 | |
Nei | has someone started an easy & comprehensive p6 intro yet? there is a shitload of docs, but the exegeses/synopsis/apocalypsis stuff is a bit too much to read through for me.. I suspect maybe I'm just being blind | 05:34 | |
Tene | Nei: what sort of things would you want covered in an intro? | 05:35 | |
Nei | good question... I think something in the lines of perl5intro and perl5syn | 05:36 | |
Tene | I haven't seen one, but I might put one together sometime. | 05:37 | |
Nei | cool :) | 05:38 | |
Tene | I wish I would have thoguht of those for the last-minute presentation I threw together last week. | 05:39 | |
Eidolos | Will perl6 still have computed gotos? | ||
er, Perl6 :) | |||
That's another thing you might add a test for, Nei. | |||
perl -e 'goto "label" . (1+1); label1: die "1"; label2: die "2";' -- dies with 2 | |||
05:40
luqui joined
|
|||
Nei | thing is, imo the docs concerning goto are not very detailed | 05:41 | |
Eidolos nods. | |||
luqui | My guess is that goto LABEL is illegal, and it is either gone or spelled goto 'LABEL' | 05:46 | |
Nei | it is definitely not gone | 05:49 | |
since s05/a04 talk about it | |||
*s04 | 05:50 | ||
as for whether the label needs to be quoted... I'd disagree, it is nothing evaluated during runtime | |||
(although p5 does support the goto EXPR, as mentioned by Eidolos ) | |||
luqui | Nei, so goto has special syntax? | 05:51 | |
i.e. it is a macro? | |||
Nei | are there standard means to resolve uncernties in the specs ? | ||
luqui | ask @Larry | ||
Eidolos | Nei: await the return of The Man :) | ||
luqui | luqui (in) @Larry, but doesn't usually make decisions | 05:52 | |
Nei | on second thought | 05:53 | |
you might be right | |||
:P | |||
luqui doesn't have much clue about this matter... | 05:54 | ||
ingy | hola | ||
luqui | guten tag, ingy | ||
ingy | nihao luqui | ||
luqui | anata wa como estas? | 05:55 | |
:-p | |||
svnbot6 | r14915 | Nei++ | * [t/blocks/goto.t] Added quotes to the goto 'label' as pointed out by luqui. (This is in line with last.) | ||
ingy | ooo luqui, you make me so hot. | ||
05:56
gosha joined
|
|||
Eidolos | hmm. | 05:56 | |
ingy takes a cold shower | |||
luqui | . . . | ||
gosha | hey guys, just curious does perl have templates and generics? | ||
perl6 that is | |||
luqui | gosha, fortunately not | ||
(yes, sortof) | |||
ingy | of course it does | ||
gosha | fortunately? | ||
ingy | Perl 6 has CPAN! | 05:57 | |
luqui | it has generics in the haskell/ml sense, not the c++ sense | ||
ingy | it all just works | ||
luqui | (again, sortof) | ||
ingy ducks | |||
luqui | S06 covers some of that, S12 covers some of that, but I still think we're not totally solid on the generics model | 05:59 | |
Nei, you said "this is in line with last"? | 06:00 | ||
the test suite disagrees. is there somewhere in the specs you are quoting? | |||
gosha | Hmm. I understand I can define a list of integers like so: my Int @list. Why not generic classes like "my SomeClass @list"? | ||
Nei | ?eval my @h = 'cat', 'dog'; LOOP: for @h -> $t { $t.say; last 'LO' ~ 'OP'; } | 06:01 | |
luqui | gosha, uh, yeah, of course | ||
evalbot_r14915 | OUTPUT[cat] undef | ||
luqui | ?eval my @h = <cat dog>; LOOP: for @h -> $t { $t.say; last LOOP; } | 06:02 | |
evalbot_r14915 | OUTPUT[cat] Error: No compatible subroutine found: "&LOOP" | ||
luqui | aa soo | ||
okay, good | |||
I'm satisfied with that | |||
Nei | maybe goto should be a statement and not a block? | 06:04 | |
luqui | goto is a block? | ||
Nei | maybe not, but the file is in t/blocks/goto.t | ||
luqui | oh, so you're just talking about test organization | 06:05 | |
yeah, statements makes sense to me | |||
Nei | is the statements/last.t test concerning last LABEL .. wrong? | 06:06 | |
or is pugs wrong | |||
luqui | I'm guessing pugs is wrong | ||
S06, line 2655 | |||
06:06
gosha left
|
|||
luqui | (the C<leave> function) | 06:06 | |
06:07
bsb left
|
|||
luqui | er, line 2045 | 06:07 | |
Eidolos | Wow, the examples/cookbook directories are damn near empty. :/ | 06:09 | |
Nei | *sigh* | ||
so my initial code might have been correct as far as the specs go | 06:10 | ||
well I suppose that goto EXPR still wont go away | |||
good thing we've talked about it | |||
bah, pugs ignores last EXPR | 06:24 | ||
svnbot6 | r14916 | Nei++ | * bah >_> | 06:31 | |
Eidolos | What's the idiomatic way to add an element to an array? I don't see push in any of the testing code. | 06:35 | |
Nei | ?eval @a = 'cat'; @a.push('dog'); @a | 06:38 | |
evalbot_r14915 | ["cat", "dog"] | ||
Nei | looks like push is still there | ||
Eidolos | huh. OK, thanks :) | ||
06:45
Aankhen`` joined
|
|||
TimToady | @tell luqui yes, that is correct, there are no places in Perl 6 where a list in scalar context defaults to returning the final value. it just returns the list as an item. | 06:52 | |
lambdabot | Consider it noted. | ||
Eidolos | ?eval %x = (foo => "bar", baz => "quux"); %x ~~ "foo"; | 06:55 | |
evalbot_r14916 | Bool::False | ||
Eidolos | Does hash ~~ scalar check for existence or truth? | 06:56 | |
A04 and S04 say truth, but.. | 06:57 | ||
TimToady | S03 sez existence | ||
Eidolos | ohh | ||
Yeah I'm misreading the table, sorry. | 06:58 | ||
TimToady | assuming Hash/Any matches first. | ||
Nei: loop and goto labels are one of those areas where we just handwaved it to be "like Perl 5". It's not terribly well specced how to deal with ambiguities though. | 06:59 | ||
should "goto foo()" parse, for instance... | 07:00 | ||
I'm inclined to say that goto, next, etc force the next identifier to autoquote, and if you really need computed goto, you should have to say goto(foo()). | 07:01 | ||
alternately, only allow autoquotes of labels that are visible in the current outer scope. | 07:02 | ||
Unfortunately that doesn't help in parsing forward goto's... | |||
Nei | is there a tradition of introducing mandatory () to force non-autoquoting? | 07:04 | |
TimToady | there's a tradition of forcing *something* where autoquoting would get it wrong. | 07:05 | |
in the case of =>, "foo" => "bar" | |||
or foo() => "bar" | 07:06 | ||
07:06
ofer1 joined
|
|||
TimToady | Perl 5 has a long tradition of jumping though hoops to try to second guess the programmer. | 07:06 | |
we're trying not jump through quite so many hoops for Perl 6 | 07:07 | ||
but certain keywords are much like sigils | 07:08 | ||
if you say $foo() it parses as $foo and (), not as $ and foo() | |||
so I don't think forcing goto foo() to parse as "goto foo" and () is all that bad. | 07:09 | ||
the situation won't arise all that often in practice. | |||
Nei | mhm | ||
I wonder if you can always get away with "this wont happen so often" | 07:10 | ||
TimToady | 'course not, for things that happen often. :) | ||
Eidolos | Strings don't have a length method? | ||
TimToady | measured in what units? | ||
Eidolos | ahh, thanks :) | ||
TimToady | .chars works | ||
Nei | ?eval my $x = sub { "c" }; $x() | 07:11 | |
evalbot_r14916 | "c" | ||
TimToady | .bytes might or might not work depending on whether the particular string type lets you. | ||
Eidolos nods. | |||
Nei | ?eval sub foo { "l" }; my %x = ( foo() => "n" ); %x | 07:14 | |
evalbot_r14916 | {("l" => "n"),} | ||
Nei | I think it'd make most sense to treat the autoquoting of labels like => | ||
TimToady | .chars is guaranteed to work, but only by downgrading to the maximum allowed abstraction level, so depending on lexical context and the type of the string, might really mean graphemes or codepoints or even bytes. | 07:15 | |
Nei | so that goto foo() would jump to "l" | ||
Eidolos | :) | ||
Nei | this happens to match my intuitive opinion, but ymmv of course | ||
TimToady | except that => has the benefit of seeing foo() from the right side rather than the left. | ||
we're not installing multi-token lookaheads if we can help it. | 07:16 | ||
Nei | I dont write compilers, parsers or other sick shit | ||
TimToady | and unfortunately the parser has to decide what foo is pretty much as soon as it sees it. | 07:17 | |
07:17
marmic joined
|
|||
Nei | actually you're not making much sense | 07:17 | |
=> sees foo() on the left side afaikt | 07:18 | ||
TimToady | on its left side, but on the "foo()"'s right side, is what I meant. | ||
ingy | on the left == from the right | ||
TimToady | it sees it on the parenthesis side. | ||
Nei | mhm well I'm sure you know a lot of stuff and I dont; and surely I cannot decide what perl6 will be :) | 07:19 | |
just saying that I could see some sense in handling labels similar to how => autoquotes.. cant judge if it's "not worth the effort" | 07:20 | ||
on the other hand, if these cases rarely occur, does it still matter so gravely? | |||
TimToady | well, having put lots of such heuristics into Perl 5, I would prefer to keep things a bit simpler in Perl 6 where we can get away with it. | 07:21 | |
the heuristics belong in trying to explain error messages, not it trying to parse things despite the ambiguity. | |||
Nei | but if the lack of heuristics actually causes illogical behaviour that requires special documenting | ||
TimToady | so I'd prefer that "goto foo()" fail but give a good diagnostic why. | ||
Nei | then we might be better off disallowing LABEL altogether and always requiring or assuming EXPR | 07:22 | |
TimToady | by far the LABEL is the common case. | ||
I've written two or three EXPR goto/next's in my life. | 07:23 | ||
Nei | I don't like having to explain "well you have this goto here and in most of the cases you can omit the () but you see, if you want the goto to jump to the return of a sub, theeen you have to use goto()" | ||
TimToady | requiring goto(foo()) is not really any hardship as long as it doesn't just silently misbehave without the parens. | ||
Nei | but thats just me of course :) | ||
I think another discrepancy in my mind is that I assocate () with functions, and I dont like to view control statements as such | 07:25 | ||
TimToady | well, there is that. | ||
goto (foo()) also works. | |||
so does goto &foo() | |||
Nei | yea, of course | ||
TimToady | anything that stops it looking like an identifier. | 07:26 | |
Nei | I still need to get accustomed to the &sub() syntax that I tried to forget in p5 | ||
svnbot6 | r14917 | Ovid++ | Misses a "splice in scalar context" test. It's fixed now. | ||
TimToady | again, much like $foo vs $$foo or $(foo) | ||
Nei | how do you go to a sub in p6? | 07:27 | |
TimToady | oh, &foo.call() or some such. | ||
unlike in P5, &foo never calls foo, it's just the sub object. | 07:28 | ||
Nei | there has to be a syntax similar to goto &foo | 07:30 | |
or not :/? | |||
?eval goto foo; | 07:31 | ||
evalbot_r14917 | Error: No compatible subroutine found: "&foo" | ||
Nei | what is it doing there? | ||
TimToady | P6 supports tailcall optimization, so all it has to be is an ordinary call, really. | ||
but sometimes you want to make it explicit. | |||
Nei | it is looking for some &foo, but with which goal? | 07:32 | |
TimToady | goto isn't implemented yet. | ||
Nei | ah so | ||
revdiablo | ?eval goto goto; | 07:33 | |
evalbot_r14917 | Error: No compatible subroutine found: "&goto" | ||
TimToady | if it had found foo() it wouldn't have found goto() | ||
revdiablo | =) | ||
Nei | ye makes sense now | ||
TimToady | ?eval foo foo; | ||
evalbot_r14917 | Error: No compatible subroutine found: "&foo" | ||
Nei | so there wont be a goto &foo ? | ||
TimToady | not with that syntax. | 07:34 | |
Nei | ?eval sub foo { "l" }; &foo.goto | ||
evalbot_r14917 | "l" | ||
TimToady | that currently works, and we might keep it. | 07:35 | |
Nei | whats the difference between foo, &foo.goto and &foo.call? | ||
TimToady | .call is for use within wrappers, and things like wrappers, that want to pretend they're not on the call stack. so it may subsume .goto | 07:37 | |
basically foo is for a "real" call from the viewpoint of the user, and .call and friends are infrastructural | 07:38 | ||
so an autoloader would use .call just as it would use 'goto &foo' in P5 | 07:39 | ||
except we've split out the lookup and call parts of autoloading in P6 | |||
.call also assumes you're passing the current argument list in to another routine with the same (or similar) signature. You can override that, but it's not default for .call. | 07:40 | ||
Nei | I see, thanks for the explanations | 07:42 | |
TimToady | if we keep &foo.goto then probably goto &foo also works still. | ||
it's not like goto could do much else with a sub ref, other than fail... | 07:44 | ||
Nei | heh | ||
TimToady | implicitly calling it would be not in the spirit of P6 | ||
so oddly it's one of things that actually is a little cleaner in P6; it's just that goto &foo is smelly in P5, and that kind of carries over a little. | 07:45 | ||
Nei | well tbh I rarely use goto &sub | 07:47 | |
Eidolos | I almost used it once.. hehe. | ||
(then I turned the recursive loop into an iterative one..) | |||
Nei | but goto expr is more common imo, or at least from what I know | ||
TimToady | I've actually used goto &sub a lot more than goto LABEL. | ||
but I've written a lot of autoloaders... | |||
Nei | because you have an excuse for goto &sub, whereas goto label is mostly just BASIC | 07:48 | |
07:48
iblechbot joined
|
|||
TimToady | and any place goto LABEL is used repetitively, we've replaced it with something else, like "redo" | 07:48 | |
arguably, that's something people might want for case statements. | 07:49 | ||
the problem with having a "fallthrough" verb, though, is what to do if the next statement is not a "when". | |||
it seems like it's okay to fall back to goto for this, rather than defining a new verb. | 07:50 | ||
Nei | the flexibility of perl's given, makes this difficult | ||
but actually, goto will still not make me happy | 07:51 | ||
TimToady | and having a goto paired with a label in the target block makes it unambiguous even if an intervening statement is added | ||
Nei | given $x { when a { goto B } when b { B: goto C } when c { C: goto D } } | ||
now add a case | |||
besides its a waste of labels :/ | |||
TimToady | well, almost certainly indicates you should have been using polymorphism rather than a case statement... | 07:52 | |
Nei | there might be better ways to do what you want, agreed :) | 07:53 | |
*what I want | |||
TimToady | no, you don't want it. you just think you *might* want it someday. | ||
I don't think you ever actually will. | 07:54 | ||
Nei | it is probably too ugly ^^ | ||
07:54
TimToady joined
|
|||
Nei | just because I write stuff like that in $other_language, probably it can be done in a nicer way in perl | 07:55 | |
TimToady | at some point, as a language designer I have to cut it off and say "the opportunity cost of people learning this new feature is too great to be justified on the few possible use cases." | 07:56 | |
my tolerance for forcing people to learn features is pretty high, compared to most language designers. | |||
Nei | ^^ | 07:57 | |
TimToady | but even I have my limits. :) | ||
mostly because it also means I have to keep explaining the feature. | |||
Nei | although, a statement that would just skip the next "when" test, might work | ||
or maybe | 07:58 | ||
isnt there something to say | |||
when "previous" or ... { ..} | |||
basically an inverse fallthrough | |||
TimToady | wouldn't need anything special | 07:59 | |
given $x { my $fallthru = 1; ... when $fallthru or ... {...} | |||
Nei | basically you need to reset the fallthru variable at each new fallthru block | 08:01 | |
it doesnt look too bad, I guess | |||
TimToady | nah, just default like C. :) | ||
I'd much rather encourage people to use "next METHOD" instead. | |||
Nei | what do you mean exactly? | 08:02 | |
TimToady | the dispatchers are already set up to allow redispatch to the next-most-likely method. | ||
see S12. | |||
Nei | mhm | 08:04 | |
TimToady | basically if you're doing multi dispatch, various routines could handle your data, but you call the most specific ones first, and they can use "next METHOD" to call more generic ones after themselves. | ||
which is usually what you want fallthrough for in a switch. | |||
Nei | true | 08:05 | |
but that sounds very oo-ish | |||
TimToady | well, sure, in spots. multimethod dispatch is more about types than objects though. | ||
Nei | but how many more lines does the multimethod stuff add over a C switch, for some reason I have the impression that it is enormous | 08:07 | |
like you need to have your own sub for each case | |||
TimToady | which for short ones can be one line, just like a 'when' | ||
the problem with switches is that they can't do multidimension pattern matches without cascaded switch statements | 08:08 | ||
and they're very hard to maintain. | 08:09 | ||
especially when you want to make decisions that cut across the "wrong" dimension | 08:10 | ||
multiple dispatch solves these sorts of problems easily. | |||
Nei | do I not need a class hierarchy for that stuff to work? | ||
TimToady | you need types for it to work. a class hierarchy is one way of supplying types. | 08:11 | |
Nei | I'm too much of a n00b | ||
08:11
awwaiid joined
|
|||
TimToady | well, you don't have to learn it all at once. in the meanwhile, P6's switch statement is a lot more powerful than anything in P5... | 08:12 | |
Nei | heh | ||
I already like it :) | |||
I tried the source filter p5 switch in some project but it really should carry some bigger warnings | 08:13 | ||
TimToady | indeed, source filtering is one of those things where you use it on a problem, and then you have two problems... | ||
one of those areas where the P5 solution was too simple. | 08:14 | ||
the trick has been to design in all the necessary complexity without making the simple jobs any harder. | 08:15 | ||
I think we mostly been successful there. | |||
but there's definitely more there to learn if you decide to learn it all. | |||
it's almost a complete course in C.S. to get to the bottom of it all, in fact... | 08:16 | ||
but worth it for those who get there, we sincerely hope... | |||
and we hope there are many metastable waystations at which to rest. | 08:17 | ||
Eidolos | Hrm. | ||
Nei | :) | 08:18 | |
TimToady | with plenty of signs that say "HERE THERE BE (nice) DRAGONS!" | ||
Eidolos | I think I have a bug here with Pugs' delete. | ||
TimToady | you know it doesn't support P5 syntax? | ||
Eidolos | %food_color.delete(<Carrot Apple Cabbage>) works, but the following doesn't: delete (%food_color, <Carrot Apple Cabbage>); | ||
hehe, yes :) | |||
I'm working on upgrading the Perl Cookbook's code! :) | 08:19 | ||
(and in the meantime learning the little changes in the language) | |||
Nei | why is there push,but not delete? | ||
Eidolos | Let me try to isolate the problem. | ||
TimToady | well, you'd have to write it delete(%food_color: <...>) | ||
no space, plus a colon after the invocant | |||
Eidolos | is delete(%h1, <c d e>), @cde, "test for delete multiple keys. (Indirect notation)"; | 08:20 | |
passes tests :/ | |||
TimToady | probably a historical accident, but we might choose to preserve it. | ||
much like it really ought to be push @foo: 1,2,3, but we still allow push @foo, 1,2,3 | |||
Nei | better rid yourself of these things while you still can | 08:21 | |
TimToady | some of 'em, not all of 'em | 08:22 | |
Perl will still be a TMTOWTDI language | |||
08:24
luqui joined
|
|||
Eidolos | Hmm, OK, maybe it isn't a bug in pugs. | 08:25 | |
or at least I can't reproduce it except in the original script. | |||
Nei | does anyone actually use Form(at)s? | 08:28 | |
Eidolos | I've never used Perl5 formats, no | 08:29 | |
OK, cool, I got it to fail. | 08:30 | ||
Hmm. | 08:32 | ||
Nei | how do I force types in perl? | 08:33 | |
Eidolos | like: my Int $x; ? | ||
Nei | ?eval my Int $x | ||
evalbot_r14917 | \::Int | ||
Nei | ?eval my Int $x; $x = "a"; $x | 08:34 | |
evalbot_r14917 | \"a" | ||
Eidolos | I don't think pugs supports it yet. | ||
Nei | ok thanks | ||
Eidolos | That's weird. | 08:35 | |
I don't get the problem in pugs -e | |||
but I have a .t file that's failing. | |||
www.rafb.net/paste/results/wyHt9f11.html | 08:36 | ||
buubot | The paste wyHt9f11 has been copied to erxz.com/pb/608 | ||
Eidolos | Expected: 'Lemon', Actual: 'Banana Carrot Lemon Apple' | ||
(you have to: use Test plan => 1) | 08:38 | ||
Nei | Eidolos this really works in pugs? | 08:39 | |
TimToady | remove the space after delete | ||
Eidolos | It doesn't work here. | ||
08:39
fayland joined
|
|||
Eidolos | yep, that fixes it. Weird! | 08:39 | |
TimToady | not weird, if you understand why S02 requires function args to be adjacent | 08:40 | |
Eidolos | I see. | ||
TimToady | otherwise the parentheses are taken to be around the first argument. | ||
in order to have a very extensible language system that allows postfix operators, you have to distinguish real postops from things that aren't | 08:41 | ||
Eidolos | ahh | ||
TimToady | and function args are in the "real" category. | ||
Nei | a little bit evil | ||
TimToady | but very consistent, once you get used to it, and motivated for futureproofing reasons. | 08:42 | |
see S02 for more explanation. | |||
Eidolos | So would it work OK without any parentheses? | ||
TimToady | probably. | ||
dduncan | I have a question in the spirit of that recent supertype discussion on p6l ... maybe the answer is similar, or maybe not ... | ||
Eidolos | yeah, works OK without parens. | 08:43 | |
TimToady | k, though I should be getting to bed pretty soon... | ||
dduncan | is it possible to declare something in Perl 6 such that if a value is declared, it would automatically assume the most specific data class / the most-sub subclass that it could be part of? | ||
TimToady | you mean like 1 is an Int and not a Num | 08:44 | |
dduncan | eg, if someone declared a "subset Evens" within scope, and then after we said my $foo = 6; then the value of $foo isa Evens rather than Int | ||
TimToady | on the other hand, why is it not a UInt2 in that case? | ||
since 0..1 is large enough... | 08:45 | ||
dduncan | whatever | ||
TimToady | you can't be "isa" a subtype | ||
dduncan | okay | ||
TimToady | if you ask for the actual type of a value it will give you the "base" type on which the subset is based. | 08:46 | |
08:46
drrho joined
|
|||
dduncan | its possible that my idea is somewhat contrived, but that's why I'm putting it out here quickly rather than on p6l | 08:46 | |
Eidolos | my Evens $foo; ? | ||
dduncan | or a similar interesting feature would be, given a particular $foo, if there was a short-hand to introspect the system for the most specific type that includes that value | 08:47 | |
Eidolos | Like Haskell's :t? | ||
dduncan | I'm not that familiar with Haskell | ||
on a tangent ... | 08:48 | ||
TimToady | it sounds remarkably like multi dispatch to the most specific sig. | ||
assuming there was some particular call that all types participate in. | |||
as the single first argument | 08:49 | ||
Eidolos | :t (in Haskell) lets you inspect the type of any expression. I think it's actually most general, not specific, type that fits, because otherwise you run into that UInt2 problem. :) | ||
lambdabot | parse error on input `in' | ||
dduncan | just as we can declare a variable like "my Foo|Bar $baz;", could we alternately say "my Foo&Bar $baz;" or some such ... eg, $baz must be something that is both a Foo and a Bar ... or I suppose perhaps this constraint is usually specified with a chain instead | ||
Eidolos | :t fibs = 1 : 1 : (zip (+)) fibs (tail fibs) | ||
lambdabot | parse error on input `=' | ||
Eidolos | :t 1 : 1 : (zip (+)) fibs (tail fibs) | ||
lambdabot | Not in scope: `fibs' | 08:50 | |
<interactive>:1:29: Not in scope: `fibs' | |||
Eidolos | oh, nevermind, I'll knock it off :) | ||
dduncan | anyway, don't take my questions too seriously for the moment | ||
TimToady | for the moment we're trying to limit junctional types to where constraints, not to real storage declaratoins | ||
Eidolos | (oh, I see, I used zip where I needed zipWith, duh) | ||
among other things >_> | |||
I'll stick to Perl.. | 08:51 | ||
dduncan | okay ... but if you change your mind, that might be useful, perhaps | ||
mind you, from my own work into this area ... | |||
TimToady | well, if every type declaration automatically generates a "multi mostspecific (MyType)" then it would work | ||
or it would fail on ambiguity | 08:52 | ||
probably usually fail | |||
42 is Even and also UInt8 | |||
which is more specific? | 08:53 | ||
assuming Even is "subset Even of Int where ($_ !% 2)" or some such | |||
I guess a use case would be in order. | 08:54 | ||
dduncan | fyi, I've been spending the last few hours writing down an intro to a type system I may use in my database project which is based on sets, such that every type is a set of values, and subtypes are typically subsets, etc ... in the process was also brought up matters of multiple inheritence, such as a diamond-inheritence of Parallelogram, Rectangle, Rhombus, Square ... Square in this case is the intersection type of Rectangle and Rhombus | 08:55 | |
suffice it to say that it is a simpler landscape than what Perl is dealing with | 08:56 | ||
Eidolos | wheren't :) | ||
TimToady | yeah, and the set theory turns inside out when you switch between extensional and intensional views. | ||
dduncan | in the system I setup, all possible values belong to a universal set, which correspond's to Perl's "Any" designation (which no value can have, but variables can hold), and normal data types are subsets thereof | 08:57 | |
TimToady | well, I should have used {...}, not (...), and if I did add !% it would probably mean "not divisible evenly by", but that's inconsistent with ! in other ways. | 08:58 | |
dduncan | practically, all user-defined types have to be based on system-defined ones, either through subtyping or unioning or construction | ||
in the case of subtyping, the user hasn't added new values that can be seen, but with construction they have | 08:59 | ||
construction meaning like declaring a class with attributes | |||
in this system, while a value can be of multiple types, it has its own most-specific-type, and is automatically promoted to the most-specific-type in the system that includes it | 09:00 | ||
mind you, some of those details users probably can ignore | |||
practically, it is still like values of a subtype of Foo still being considered just a Foo | 09:01 | ||
anyway, good night! | |||
TimToady | well, according to mmd, the most specific type of 42 is 42. | ||
dduncan | in the system I described, if a type called "EvenInts" was defined, then 42 would be one of those | 09:02 | |
TimToady | but if I say "multi foo (42) {...}" it matches only type 42. | 09:03 | |
dduncan | if I had declared "multi foo (Int)" and "multi foo (EvenNum)", I assume the latter would be invoked | ||
TimToady | as long as you didn't have (foo) too | 09:04 | |
(42) rather | |||
dduncan | mind you, according to good design, it shouldn't matter ... because both such functions should have identical semantics | ||
TimToady | that's why we spend a lot of time handwaving that enums are types as well as values. | 09:05 | |
dduncan | and so the latter would only even be defined if EvenNum was defined as something else that does Int and is implemented differently underneath | ||
rather than as a subset | |||
TimToady | yeah, it gets into duck vs named typing eventually | 09:06 | |
for some definition of duck, and name... | |||
well, really gotta go snooze, my eyes are glazing over. | |||
dduncan | indeed, good night 1 and Inf | 09:07 | |
TimToady | I'll settle for 1 and * | ||
zzz & | |||
dduncan | yyy & | ||
09:17
dduncan left
09:33
RHainsworth joined,
RHainsworth left
09:51
araujo_ joined
09:52
araujo joined
10:01
elmex joined
10:05
buetow joined
|
|||
Debolaz | Will @foo>>.bar; call method bar on each object in @foo? That's what I'm reading S12 as, but I can't get it to work in pugs. | 10:14 | |
jrockway | ?eval (1,2,3)>>.sqrt | 10:16 | |
evalbot_r14917 | (1.0, 1.4142135623730951, 1.7320508075688772) | ||
jrockway | works for me :) | ||
?eval my @a = (1,2,3); @a>>.sqrt | 10:17 | ||
evalbot_r14917 | (1.0, 1.4142135623730951, 1.7320508075688772) | ||
jrockway | Debolaz: what is in @foo, and can it bar? | ||
Debolaz | class Foo { sub bar { say "Hello world!" } }; my @baz = (Foo.new,Foo.new); @baz>>.bar; | ||
Is there a typo here somewhere? | 10:18 | ||
jrockway | can you ?eval that? | ||
Debolaz | I got the sqrt example to work. | ||
?eval class Foo { sub bar { say "Hello world!" } }; my @baz = (Foo.new,Foo.new); @baz>>.bar; | |||
evalbot_r14917 | Error: No compatible subroutine found: "&>>bar" | ||
jrockway | ?eval class Foo { sub bar { say "Hello world!" } }; Foo.new | 10:19 | |
evalbot_r14917 | Foo.new() | ||
jrockway | i'm not 100% sure that ClassName.new() creates a new instance | ||
but then i don't really know :( | |||
Debolaz | Foo.new.bar works btw. | ||
jrockway | oh | 10:20 | |
what happens if you do something without side-effects? | |||
Debolaz | ?eval class Foo { sub bar { "Hello world!" } }; Foo.new.bar | ||
jrockway | bar { 42 } | ||
evalbot_r14917 | "Hello world!" | ||
Debolaz | So Foo.new obviously works in some context.. | ||
jrockway | ?eval class Foo { sub bar { "Hello world!" } }; (Foo.new(), Foo.new()).bar | ||
evalbot_r14917 | Error: No compatible subroutine found: "&bar" | ||
jrockway | ah, it's calling it on the list | 10:21 | |
(1,2).sqrt | |||
?eval (1,2).sqrt | |||
evalbot_r14917 | 1.4142135623730951 | ||
jrockway | i see... | ||
i guess >>. should work | |||
Debolaz | Am I doing something wrong here? | 10:22 | |
jrockway | not that i know, but you're asking the wrong person :) | ||
i guess you could do: | |||
?eval (Foo.new(),Foo.new()).map { 42 } | |||
evalbot_r14917 | Error: Unexpected "{"expecting operator | 10:23 | |
jrockway | i forget the syntax for map though | ||
s/forget/don't know/ | |||
:/ | |||
Debolaz | Still, the problem isn't so much getting all methods called. It's that S12 says this should work and it does apparently work on some arrays of objects but not on others.. | ||
And I suspect I may be the one who is doing something wrong, but I have no idea what. | 10:24 | ||
jrockway | well, let's look at the tests and see what they do | 10:26 | |
i know in audreyt++'s slides, she uses the sqrt example :) | |||
and that works :) | |||
Debolaz prods audreyt. | 10:27 | ||
audreyt: Help the less intelligent ones. Tell me what I'm doing wrong here. | 10:28 | ||
jrockway | i'm looking through the tests to give you an example | ||
Tene | Debolaz: what's different about the arrays that work and those that don't? | 10:32 | |
Debolaz | Tene: Only thing I can see is different is whether they contain blessed objects or not. | 10:33 | |
Tene | and which one works? | ||
Debolaz | (1,2,3)>>.sqrt works | 10:34 | |
(Foo.new)>>.bar don't | |||
Tene tests | |||
Debolaz | ?eval class Foo { sub bar { say "Hello world!" } }; my @baz = (Foo.new,Foo.new); @baz>>.bar; | ||
evalbot_r14917 | Error: No compatible subroutine found: "&>>bar" | ||
Debolaz | ?eval (1,2,3)>>.sqrt | 10:35 | |
evalbot_r14917 | (1.0, 1.4142135623730951, 1.7320508075688772) | ||
wolverian | ?eval my @foo = (1..3); @foo>>.sqrt | ||
evalbot_r14917 | (1.0, 1.4142135623730951, 1.7320508075688772) | ||
Debolaz | wolverian: Already tried this. :) | ||
jrockway | hehe, exactly the same two steps | ||
wolverian | oh, yeah, you did. | ||
jrockway | heh, i fixed some of the tests but can't commit because the repository UUID changed... | 10:36 | |
wolverian | looks like a weird parsing error :) | ||
Debolaz | ?eval class Foo { sub bar { say "Hello world!" } }; (Foo.new)>>.bar; | ||
jrockway | waiting ... :) | ||
evalbot_r14917 | Error: No compatible subroutine found: "&>>bar" | ||
wolverian | oh | ||
dammit | |||
Debolaz, 'method bar | 10:37 | ||
' | |||
not sub | |||
jrockway | ?eval class Foo { method bar { 42 } }; (Foo.new,Foo.new)>>.bar | ||
evalbot_r14917 | Error: No compatible subroutine found: "&>>bar" | ||
jrockway | it worked for him when he did Foo.new.bar remember | ||
?eval Foo.new | |||
evalbot_r14917 | Error: No compatible subroutine found: "&Foo" | 10:38 | |
10:38
ofer1 joined
|
|||
Tene | ?eval class Foo { method bar { 42 } }; Foo.new.bar; | 10:38 | |
evalbot_r14917 | 42 | ||
Debolaz | wolverian: Oops.. yeah, that should've been method, but as jrockway says, it's not the problem. | ||
jrockway goes to read S12 | |||
Tene | ?eval class Foo { method bar { say 42 } }; .bar for (Foo.new,Foo.new) | 10:39 | |
evalbot_r14917 | OUTPUT[4242] undef | ||
svnbot6 | r14918 | jrockway++ | r4@foo: jon | 2006-12-18 04:42:53 -0600 | 10:45 | |
r14918 | jrockway++ | fix a minor typo | |||
jrockway | hmm, should xx-uncategorized/hyperop.t exist still? | 10:47 | |
(t/) | |||
?eval ("f", "oo", "bar")>>.length | 10:52 | ||
evalbot_r14918 | Error: No compatible subroutine found: "&>>length" | ||
10:53
nekokak joined,
ruoso joined
|
|||
jrockway | indeed, that's a failing TODO test | 10:54 | |
i wonder why sqrt works and not length | 10:55 | ||
?eval ("foo", "bar")>>.match("foo") | 10:56 | ||
evalbot_r14918 | Error: No compatible subroutine found: "&>>match" | ||
jrockway | Debolaz: it looks like this stuff should work... the tests are TODO though | ||
11:09
xpika joined,
norageek joined
|
|||
avar | what's the authorative kwid spec? google knows nothing of it | 11:12 | |
11:21
kanru joined
|
|||
svnbot6 | r14919 | jrockway++ | r6@foo: jon | 2006-12-18 05:23:14 -0600 | 11:24 | |
r14919 | jrockway++ | Add some tests to see if hyper-method call works (suggested by | |||
r14919 | jrockway++ | Debolaz++) ( i.e (Foo.new)>>.bar ) | |||
r14919 | jrockway++ | Add a test to see if hyper works on lists of integers (>>.sqrt) | |||
jrockway | Debolaz: added some tests for what you were trying to do | 11:25 | |
however since it's 5am and I have to go to work in 3 hours, I'll see if I can find the cause (etc.) later :) | 11:26 | ||
11:41
iblechbot joined
|
|||
jrockway | should this work?: | 11:58 | |
?eval class Foo { method bar { 42 } }; $foo = Foo.new; $foo.can('bar'); | 11:59 | ||
evalbot_r14919 | Error: No compatible subroutine found: "&can" | ||
jrockway | ?eval class Foo { method bar { 42 } }; $foo = Foo.new; $foo.HOW.can('bar'); | ||
evalbot_r14919 | Error: No compatible subroutine found: "&can" | ||
jrockway | ?eval class Foo { method bar { 42 } }; $foo = Foo.new; $foo.^can('bar'); | ||
evalbot_r14919 | Error: Unexpected "^"expecting ".", "\187", ">>", "=", operator name, qualified identifier, variable name, "...", "--", "++", array subscript, hash subscript or code subscript | ||
jrockway | maybe i'm misreading S12? | ||
audreyt | no, that will work once MO is merged in | 12:06 | |
which, really, is RSN :) | 12:07 | ||
jrockway | cool :) | ||
what about the (Foo.new)>>.bar business from above? | |||
audreyt | ?eval class Foo { method bar { 42 } } Foo.new.>>.bar | ||
evalbot_r14919 | Error: No compatible subroutine found: "&>>bar" | ||
audreyt | ?eval class Foo { method bar { 42 } } [Foo.new, Foo.new].>>.bar | 12:08 | |
evalbot_r14919 | Error: No compatible subroutine found: "&>>bar" | ||
audreyt | hm, weird, I tought it worked | ||
?eval (1..10).>>.sqrt | |||
evalbot_r14919 | (1.0, 1.4142135623730951, 1.7320508075688772, 2.0, 2.23606797749979, 2.449489742783178, 2.6457513110645907, 2.8284271247461903, 3.0, 3.1622776601683795) | ||
jrockway | i added a test for that, but there was one similar | ||
audreyt | k | ||
will look | |||
jrockway | ?eval ("f", "foo", "bar")>>.length | ||
evalbot_r14919 | Error: No compatible subroutine found: "&>>length" | ||
audreyt | .chars | ||
not length | |||
jrockway | ok, so the test was wrong :) | 12:09 | |
?eval ("f", "foo", "bar")>>.chars | |||
evalbot_r14919 | (1, 3, 3) | ||
jrockway | beautiful, i'll fix that | ||
audreyt | hm, perl is 19 years old now | ||
Debolaz | audreyt :) | 12:10 | |
The example (3,8,2,9,3,8) >>->> 1; from S03 doesn't seem to work either. | |||
audreyt | currently the other dir of hyper is not implemented -- tests welcome | 12:11 | |
jrockway | ?eval 1 >>-<< (1,2,3) | ||
evalbot_r14919 | (0, -1, -2) | ||
jrockway | ?eval (1,2,3) >>-<< 1 | ||
evalbot_r14919 | (0, 1, 2) | ||
12:14
hcarty joined
|
|||
svnbot6 | r14920 | jrockway++ | r8@foo: jon | 2006-12-18 06:13:26 -0600 | 12:16 | |
r14920 | jrockway++ | s/.length/.chars/ in hyper test | |||
jrockway | ?eval (1,2,3) >>- 1 | ||
?eval (1,2,3) >>->> 1 | |||
evalbot_r14919 | Error: Unexpected ">>-"expecting operator | ||
Error: Unexpected ">>->>"expecting operator | |||
12:49
xinming_ joined
13:08
penk joined
13:20
melllwa_ joined
13:32
melllwa__ joined
13:35
penk joined
13:38
melllwa joined
13:41
gnuvince joined
13:46
rafl joined
13:49
melllwa_ joined
13:52
melllwa__ joined
14:05
melllwa joined
14:09
penk joined
14:11
robkinyon left
14:12
melllwa_ joined,
penk joined
14:13
penk joined
14:22
melllwa__ joined
14:43
ruoso joined
14:46
bonesss joined
|
|||
svnbot6 | r14921 | szabgab++ | more keywords in perl6.vim | 14:59 | |
14:59
kanru joined
|
|||
svnbot6 | r14922 | szabgab++ | more hash related tests | 15:02 | |
r14922 | szabgab++ | retab test files | |||
15:18
hcarty joined
15:40
hcarty joined
15:42
rindolf joined
15:43
melllwa_ joined
15:45
melllwa joined
|
|||
rindolf | Hi all. | 16:00 | |
jrockway | hello | ||
16:01
Eidolos_ joined,
marmic joined
16:02
jamessan_ joined
16:03
hexmode joined
16:04
stevan joined
16:18
kanru joined
16:23
stevan_ joined
16:26
jamessan joined
16:32
stevan_ joined
16:33
azazello joined
16:35
chris2 joined
16:42
kanru_ joined
17:12
weinig|away is now known as weinig
17:38
_bernhard joined
17:46
ashelyb_ joined
17:49
justatheory joined
|
|||
scrottie surveys someone else's domain | 18:08 | ||
18:14
hcarty joined
18:22
BooK joined
18:29
cmeyer joined
18:43
DebolazY joined
18:48
RHainsworth joined,
RHainsworth left
19:08
wamiks joined
|
|||
sili | huzzah | 19:10 | |
19:16
buetow joined
19:17
hcarty joined
19:25
jdv79 joined
19:26
Snafoo joined
19:37
DebolazY is now known as DebolazX
19:41
Caelum joined,
Aankhen`` joined
19:42
ofer0 joined
19:50
larsen_ joined
19:55
fglock joined
19:58
fglock left
20:02
Daveman joined
20:05
prism joined
20:14
mj41 joined
20:25
Alchemy joined
20:35
weinig is now known as weinig_
20:36
weinig_ is now known as weinig
20:42
prism joined
20:43
Dr_Pi joined
20:45
prism joined
|
|||
Dr_Pi | gaal: I'm still stuck in dial-up here in Italy. I'm hoping to get my 200Kps cell phone connection working by tomorrow afternoon. | 20:45 | |
20:49
prism joined
20:54
pbuetow joined
21:05
Azure-BOT joined
21:11
bonesss joined
21:19
Ovid joined
21:20
Ovid joined
|
|||
Ovid | Hi all. | 21:20 | |
Anyone know why rafb.net/paste/results/7EEn0898.html gives me scalar references? | 21:22 | ||
buubot | The paste 7EEn0898 has been copied to erxz.com/pb/615 | ||
21:22
Psyche^ joined
|
|||
Ovid | I think that's a bug, but I don't want to commit a test if I'm wrong. | 21:22 | |
21:28
weinig is now known as weinig|bbl
|
|||
TimToady | I'd say it's probably a buglet. happens that putting "item $elem" suppresses it. | 21:28 | |
effectively you're getting a scalar container instead of the value, but since Perl 6 doesn't really have references, it should work the same most of the time as an rvalue. | 21:29 | ||
Ovid | Ah, thanks. I'll see if I can replicate that and commit a test. Thanks. | ||
TimToady | unfortunately it lies about being modifyable. | ||
basically you've ended up with a temp lvalue, I think. | |||
that's why I had an extra "item" in one of my examples somewhere. | 21:30 | ||
also, I think luqui's patch might have broken the current gather. | |||
wolverian | must.. resist.. MMDing.. | 21:31 | |
TimToady | gather is in a state of flux to becoming a "statement_prefix" like do | ||
Ovid | Where do you put in the "item $elem"? I can't figure it out. On the other hand, I'm recompiling, so I'll check it again. However, if what you posted was legal syntax, I'll commit that as a test unless it's not reasonable (since it sounds like the syntax might change) | ||
TimToady | after the !! | 21:32 | |
Ovid | Oh, duh! I was looking at some different gather/take code just now :) | 21:33 | |
21:33
luqui joined
|
|||
luqui | hey Ovid, got your message | 21:33 | |
lambdabot | luqui: You have 1 new message. '/msg lambdabot @messages' to read it. | ||
TimToady | you can prove that it's a temp lvalue and not a ref to $elem by adding in a "d". | ||
if it were \$elem then it would presumably have the same value. | |||
or maybe not, since it's a formal parameter to a closure | 21:34 | ||
so gets cloned. nevermind | |||
luqui | Ovid, I'm guessing that it's due to my recent change to gather syntax | ||
Ovid, I'm investigating | 21:35 | ||
21:37
xpika joined
|
|||
Ovid | The 'item' fixed it in my code. Thanks. And luqui's changes apparently broke perlmonks.org/?node_id=590147, too. Bad luqui :) | 21:37 | |
lambdabot | Title: Re^2: 99 Problems in Perl6 (Lisp, Prolog, Haskell) | ||
TimToady | that's what we were referring to. | 21:38 | |
21:38
Psyche^ is now known as Patterner
|
|||
TimToady | the item thing is not luqui's fault... | 21:38 | |
or if it is, differently. :) | 21:39 | ||
luqui | it seems to be a closing brace dwimmery issue | ||
I killed the inside of the inner gather | |||
take [ | |||
gather {;} | |||
] | |||
breaks, but | 21:40 | ||
take [ gather {;} ] | |||
compiles | |||
TimToady | weird | ||
luqui | the implicit semicolon only should take effect when it is syntactically valid, right? | ||
i.e., since we are inside a [] construct, it shouldn't be happening? | |||
TimToady | hmm | 21:41 | |
except the idea of "do" and "gather" is to introduce a statement level parse... | |||
so arguably it should auto-semi there, and then return out to ] | 21:42 | ||
luqui doesn't follow | |||
TimToady | we set up "do" to just expect a statement after | 21:43 | |
but what happens if you say | |||
$x = [ do for @foo { | |||
... | |||
} | |||
] | 21:44 | ||
; | |||
luqui | ah, the statementness of the for will do the autonewliney thing... | ||
should do override that? | |||
TimToady | we're trying to put gather/contend/etc into the same syntactic category now. | ||
luqui | (side note, what about try?) | 21:45 | |
TimToady | do sets up expectation of a statement following, which may or may not be a block. | ||
try too | |||
$x = do LABEL: goto LABEL; | |||
luqui iack | 21:46 | ||
er, ack | |||
TimToady | seems to me if do mumble can be terminated by ; it can also be terminated by lonely } | ||
luqui | hmm | 21:47 | |
so Ovid's code is in fact an error? | |||
TimToady | which code? | ||
p6u? | |||
luqui | er, yours I guess | ||
perlmonks.org/?node_id=590147 | |||
lambdabot | Title: Re^2: 99 Problems in Perl6 (Lisp, Prolog, Haskell) | ||
TimToady | It used to parse. | ||
luqui | before gather was a statement introducer | 21:48 | |
TimToady | if a statement_prefix is followed by a block, that's the only argument | ||
21:48
devogon joined
|
|||
TimToady | shouldn't matter whether you assume ; there. | 21:48 | |
Ovid | I know it's too late to do anything about it, but I find myself writing "is copy" more than I care to in signatures. Is there a shortcut? (rafb.net/paste/results/ENLPqk79.html) | ||
buubot | The paste ENLPqk79 has been copied to erxz.com/pb/616 | ||
21:49
lumi_ is now known as lumi
|
|||
luqui | if you assume a ; on the inner gather, then there's a ; inside an array, which is bad | 21:49 | |
s/array/array constructor/ | |||
TimToady | but we don't have to assume it there | ||
luqui | the reason we don't is because it's inside an array constructor? | 21:50 | |
TimToady | because the gather already slurps the block and treats it as an arg | ||
just as $x = do {...} + 3 does | |||
luqui | $x = do { 1 } | 21:51 | |
+3 | |||
say $x; # 1 | |||
er, semicolon after the +3 | |||
is that not the issue we're talking about? | 21:52 | ||
TimToady | that would imply ; after } because it's outer level. | ||
luqui | okay, so it seems that my assessment is correct, even though you're not telling me so | ||
21:52
debugger| joined
|
|||
luqui | the reason we don't assume a ; after the gather is because it's not outer-level | 21:53 | |
debugger| | hey pbuetow :D | ||
pbuetow | Halluh! | ||
21:53
pbuetow is now known as buetow
|
|||
debugger| | <--- bLader | 21:53 | |
luqui | aha! it wasn't my fault, I just exposed a bug that was already there! :-) | ||
my $x = [ do { 1 } | |||
+ 3 ]; | |||
# parse error | |||
TimToady | cool | ||
Ovid: I think the "is copy" on slurpy arrays at least can eventually go away. | 21:54 | ||
it's just the elements that are readonly, not the array itself. | |||
much as @_ in Perl 5 works | |||
Ovid | That would be very handy. "99 Problems" are much more concise without "is copy" all over the place. | ||
TimToady | interesting other question is whether $x = [ do stuff(); ] is legal. | 21:55 | |
Ovid | I'm only up to 22, though. Christmas shopping for family members I've only just met. Very stressful. | ||
TimToady | because if that works, then this is possible: | 21:58 | |
sub group2 (*@a is copy) { | |||
gather while @a { | |||
take [ | |||
gather loop (my $h = @a[0]; @a and $h eq @a[0]; take shift @a) {} | |||
] | |||
} | |||
} | |||
luqui | hmm... | 21:59 | |
svnbot6 | r14923 | luqui++ | Added test for auto-semicolon not at top level bug. | ||
luqui | that is spooky to me | ||
TimToady | is $x = [ do stuff(); ] spooky to you? | 22:00 | |
luqui | yeah | ||
TimToady | don't see how it's much different from $x = [ do {...} ] | 22:01 | |
distinguishing from $x = [ do {...} + 1 ] | |||
luqui | yeah... but... | ||
TimToady | ] is a know escape from the current subparse | 22:02 | |
*known | |||
luqui | it looks wrong. I suppose that is the big difference | ||
TimToady | well, you could presumably leave out the semi and say $x = [ do stuff() ] and get the same effect | ||
22:03
Snafoo joined
|
|||
TimToady | but parsewide stuff() is at the statement level. | 22:03 | |
s/wide/wise | |||
luqui | uh huh | ||
does that imply: my $x = do stuff();; | 22:04 | ||
is correct, and only one semi would be wrong? | |||
TimToady | don't think so | ||
one statement termination does for both. | 22:05 | ||
have to bracket to get it to work otherwise | |||
basically on that level do, gather, try etc are just modifiers on the following statement. | 22:06 | ||
luqui | $x = do [ stuff(), 3 ] # how is this parsed? | ||
er | |||
$x = [ do stuff(), 3 ] | 22:07 | ||
TimToady | presumabably the same as $x = [ do { stuff(), 3 } ] | ||
luqui | so do is really loose binding | ||
TimToady | $x = try gather contend do stuff(); # still only one ; | 22:08 | |
luqui | and $x = do foo for 1..5; is the same as $x = do { foo for 1..5 }; | ||
TimToady | yes | ||
luqui | okay | ||
Ovid | No matter how many times I run this function (rafb.net/paste/results/j1xXsN10.html), the final result is always ("a", "a", "a"). is this a bug or am I doing something stupid? It's supposed to return $count number of random elements from a list. | 22:09 | |
luqui | hmm.. I guess I don't see how the ; is part of the statement | ||
buubot | The paste j1xXsN10 has been copied to erxz.com/pb/617 | ||
TimToady | well, in a sense it isn't. | ||
it's just a terminator | |||
luqui | right, it's at the statement list level, not the statement level | 22:10 | |
so I guess that is why I don't buy $ x = [ do stuff(); ] | |||
unless that ; is a multidimensional array separator (uh... is it?) | |||
(I don't actually remember how the multidimensional stuff turned out) | |||
TimToady | Ovid: well, pick(3) is specced to do that but is unimplemented. | 22:11 | |
luqui | Ovid, maybe I don't grok your code... why @list[ @list [... | 22:12 | |
TimToady | yeah, that part doesn't make sense to me either. | 22:13 | |
luqui | it seems @list :: int -> Str, so you can't index it with its own return | ||
Ovid | Ah, sheesh. Thanks luqui. That will teach me not to do 99 Problems while drinking Rum-n-Coke :) | ||
Sorry for the stupidity. | |||
TimToady | try Sprite instead. | ||
and maybe Vodka... | |||
jrockway | Ovid: go for the espresso + coke + coffee icecubes someone posted on their use perl; journal :) | 22:14 | |
22:14
py1hon joined
|
|||
TimToady | well, even if ; were a multidimensional array separator, there's nothing after it to separate. | 22:14 | |
Ovid | Well, I'm out of Laphroaigh, so this is all I got (and Laphroaig is cheaper on this side of the pond) | ||
luqui | okay, so I don't buy [ do stuff(); ] | 22:15 | |
TimToady | I think using ; as statement terminator eats it up for other purposes, so it would never be interpreted as a dim sep | 22:16 | |
luqui | it's a _separator_, not a terminator | ||
TimToady | no, it's an optional terminator. | ||
luqui | hm. is this essentially correct: | 22:17 | |
TimToady | it's optional where } and eof make it obviously missing. | ||
not difficult to add ] to that list when there [...] outside. | |||
luqui | stmtlist ::= stmt ; stmtlist | stmt | ||
stmt ::= (empty) | ... | |||
barring the dwimmery | 22:18 | ||
TimToady | gotta go to $job, unfortunately... | 22:19 | |
luqui | kay | 22:20 | |
it'll make me stop arguing and start fixing this bug | |||
:-) | |||
TimToady | ^_^ | ||
ja ne. & | |||
Ovid | See you. Thanks for your help. | ||
jrockway | btw, while there's life in the channel :) is this correct: | 22:21 | |
?eval (1,2,3) >>+<< 1 | |||
evalbot_r14923 | (2, 3, 4) | ||
luqui | yeah | ||
TimToady | not according to current spec | ||
luqui | oh | ||
jrockway | right, that's what I thought | ||
luqui | you changed it again! | ||
TimToady | but current spec is not implemented | ||
jrockway | it shoudl be >>+>> 1 | ||
luqui | ack! | ||
Ovid | :) | ||
jrockway | the pointy things point to what you want to be dwim'd | ||
xpika | ?eval (1,2,3) >>*<< 2 | ||
evalbot_r14923 | (2, 4, 6) | 22:22 | |
TimToady | >>+<< does no dwimmery | ||
xpika | ?eval (1..100) >>*<< 2 | ||
evalbot_r14923 | (2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28, 30, 32, 34, 36, 38, 40, 42, 44, 46, 48, 50, 52, 54, 56, 58, 60, 62, 64, 66, 68, 70, 72, 74, 76, 78, 80, 82, 84, 86, 88, 90, 92, 94, 96, 98, 100, 102, 104, 106, 108, 110, 112, 114, 116, 118, 120, 122, 124, 126, 128, 130, 132, 134, 136, 138, 140, 142, 144, 146, 148, 150, 152, 154, 156, 158, 160, 162, 164, 166, 168, 170, 172, 174, 176, 178, 180, 182, 184, 186, 188, 190, 192, 194, 196, 198, 200) | ||
luqui | by no dwimmery, you mean that it doesn't autoexpand? | ||
jrockway | xpika: yes, it works for lists that are more than 3 elements long :) | ||
TimToady | correct. | ||
later & | |||
jrockway | so should i fix the tests for this then? | ||
luqui | with :todo<feature> ? | 22:23 | |
22:23
Aankhen`` joined
|
|||
jrockway | there are tests for >>+<< DWIM-ing | 22:23 | |
those should fail | 22:24 | ||
and >>+>> should pass | |||
as should <<+>>, i guess | |||
22:24
buetow left
|
|||
jrockway | i'll wait until tomorrow, because it's difficult to work with unicode on the machine i'm at right now (cygwin, ugh...) | 22:27 | |
?eval 1 <<+>> 1 | 22:31 | ||
evalbot_r14923 | Error: Unexpected "<<+>>"expecting operator | ||
Ovid | There's no .shuffle method for arrays specced, is there? | 22:32 | |
luqui | No. Though I don't see why there shouldn't be. | 22:33 | |
obra | That'd make a nice cpan6 sample module demonstrating how to extend a base type | ||
luqui | touche | ||
obra | So, luqui, what's brought you back to six-land? | 22:34 | |
luqui | school ending | ||
Ovid | I was wondering that myself :) | 22:35 | |
luqui | this is finals weeks | ||
s/s$// | |||
and I'm taking the spring off | |||
jrockway | to work on perl6 exclusively? :) | 22:36 | |
svnbot6 | r14924 | luqui++ | Auto-semicolon was too liberal with statementizers (like "do" and "gather"). | ||
r14924 | luqui++ | Fixed that, hopefully without breaking the statementizers (the tests in | |||
r14924 | luqui++ | t/syntax passed, at least). | |||
luqui | uh no | ||
I'd love to, but need $$ | 22:37 | ||
Ovid | So, er, I'm looking at perlcabal.org/syn/ and I don't see the syntax for extending base types. What do I look at? (and is it implemented?) | ||
lambdabot | Title: Official Perl 6 Documentation | ||
luqui | Ovid, it's just like extending non-base types | ||
"is also" I believe | |||
jrockway | S12, btw | ||
obra | luqui: nice. congrats on getting some free time :) | ||
and welcome back | 22:38 | ||
luqui | thanks. Don't get your hopes up; last time I was back it wasn't for very long | ||
it's not clear that this time will be different | |||
but I hope it will be | |||
Ovid | luqui: I know that you've had ups and downs here, but I really hope you stick with it. | 22:39 | |
So where would I find the syntax for extending non-base types? | |||
luqui | it's not really "here" that is the problem | ||
it's elsewhere | |||
I like this community :-) | |||
Ovid, S12 somewhere | |||
Ovid | And most of us like you too :) | ||
Ah, I see it. | 22:40 | ||
luqui | S12 line 1515, section "Open vs Closed classes" | ||
wolverian | wasn't .pick supposed to work as a shuffle if you do @foo.pick(@foo.elems) or so? | 22:41 | |
jrockway | ?eval class Str is also { method length { self.chars } }; "foo".length | 22:42 | |
evalbot_r14923 | 3 | ||
luqui | wolverian, yeah, that would do it | ||
jrockway | awesome :) | ||
wolverian | ?eval ("a".."c").pick(3) | ||
evalbot_r14924 | Error: No compatible subroutine found: "&pick" | ||
luqui | wolverian, working on that now | 22:43 | |
jrockway | ?eval my @foo; for all(1..10){ push @foo, $_ }; @foo | ||
evalbot_r14924 | Error: Unexpected ";"expecting term postfix, operator or block construct | ||
jrockway | something like that could technically shuffle the list | ||
?eval my @foo; for all(1..10){ push @foo, $_ } @foo | |||
evalbot_r14924 | Error: Unexpected "@foo"expecting operator or block construct | ||
jrockway | ENOSLEEP :) | 22:46 | |
oh, also... should this work: | 22:47 | ||
my @data = (1,2,3); my @out; @data ==> map { 42 } ==> @out; @out; | |||
?eval my @data = (1,2,3); my @out; @data ==> map { 42 } ==> @out; @out; | |||
evalbot_r14924 | Error: Unexpected " map" | ||
TimToady | pick is specced in docs/Perl6/Spec/Functions.pod | 22:50 | |
Ovid | Is "is also" not yet implemented? | 22:51 | |
TimToady | feeds aren't really implemented yet. | ||
wolverian | luqui++ | ||
TimToady | Ovid: dunno. | ||
syntactically, though @data ==> is very much like do in taking a bare Code on the right. | 22:53 | ||
Ovid | Looks like it's recognized, but broken. This prints "[]" twice: rafb.net/paste/results/0h3itz58.html (syntax from perlcabal.org/syn/S12.html) | 22:54 | |
buubot | The paste 0h3itz58 has been copied to erxz.com/pb/618 | ||
jrockway | Ovid: is also appeared to work above, right? | 22:55 | |
Ovid | jrockway? Where? | 22:56 | |
jrockway | ?eval class Str is also { method length { self.chars } }; "foo".length | ||
evalbot_r14924 | 3 | ||
jrockway | ?eval "foo".length | ||
evalbot_r14924 | Error: No compatible subroutine found: "&length" | ||
TimToady | ?eval class Foo { say "hi" }; class Foo { say "lo" } | ||
evalbot_r14924 | OUTPUT[hilo] Bool::True | ||
jrockway | Ovid: are you thinking of something else? | 22:58 | |
TimToady | ?eval class Str { method length { self.chars } }; "foo".length | 22:59 | |
evalbot_r14924 | 3 | ||
TimToady | I'd say "is also" is currently the default. | ||
jrockway | the spec says that should warn or error though | ||
class redefinition | |||
and redefinition implies replace | 23:00 | ||
Ovid | Not sure if evalbot recognizes that spread over multiple lines. (Oh, it looks like it might). All I know is that I tried to implement .shuffle for the Array class and it failed miserably. I don't know if it's me or Pugs. | ||
jrockway | ?eval my @array = (1,2,3); @array.WHAT | ||
evalbot_r14924 | ::Array | ||
luqui | I can't say I like .WHAT, .WHO, etc. very much. They are not very descriptive | 23:01 | |
jrockway | ?eval class Array is also { method shuffle { (1,2,3) } }; (3,1,2).shuffle | ||
evalbot_r14924 | (1, 2, 3) | ||
luqui | (.WHERE isn't too bad) | ||
jrockway | :) | ||
time to head home & | |||
23:07
seano joined
|
|||
svnbot6 | r14925 | luqui++ | Implemented @list.pick(num). | 23:09 | |
luqui | ?eval [1,2,3].pick(2) | 23:14 | |
evalbot_r14924 | Error: No compatible subroutine found: "&pick" | ||
svnbot6 | r14926 | luqui++ | Made pick faster. | 23:15 | |
luqui | next step: implement >>.pick for infinite lists, using the axiom of choice | 23:18 | |
sayonara | |||
Ovid | I have no idea, but when I run "make realclean" with Pugs and it hits the line "mv Makefile Makefile.old > /dev/null 2>&1", I have to hit "return/enter" to make it continue (mac os x). Anyone know why? | ||
23:28
polettix joined
23:30
gnuvince joined
23:39
luqui joined
|
|||
TimToady | Ovid: is your mv aliased to mv -i? | 23:45 | |
jrockway | do shell aliases apply to makefiles? | ||
23:46
Psyche^ joined
|
|||
TimToady | who knows on a mac... | 23:46 | |
Ovid | TimTodoady: no. | ||
TimToady | acts like it... | ||
does it hang if you rm Makefile.old first? | |||
py1hon | could change it to mv -f in the makefile | ||
jrockway | that sounds right | 23:47 | |
Ovid | I'll have to wait for a bit. Rebuilding pugs again. | ||
jrockway | otherwise it will prompt | ||
actually, i'm looking at the GNU mv manpage | |||
openbsd's mv is the same though... that could be the issue | |||
maybe redirect dev null to stdin also? | |||
TimToady | course, if it takes it as "false"... | 23:48 | |
jrockway | acutally, "mv -f Makefile Makefile.old" seems cleanest | ||
yeah | |||
py1hon | that wouldn't help, it'd hang and hitting enter wouldn't do anything | ||
23:48
Snafoo joined
|
|||
jrockway | not having makefile.old doesn't sound like the worst thing in the world | 23:48 | |
py1hon: no, getchar will fail | |||
EOF | |||
py1hon | oh, der | ||
jrockway | /dev/null is a stream of EOFs :) | ||
py1hon | yeah, i knew that ;p | ||
jrockway | it would be the same as hitting C-d | 23:49 | |
23:49
Snafoo left
|
|||
py1hon | so, is there anything usefull a c coder could do? | 23:50 | |
jrockway | parrot | 23:51 | |
py1hon | how is that these days? last i looked (awhile ago) it was still in the "rapid work by mostly one person" phase | 23:52 | |
TimToady | they've actually managed to diversify that somewhat now | 23:53 | |
jrockway | no, there are lots of people involved now | ||
jnthn | py1hon: If the "mostly one person" you refer to is who I think you are, that person isn't so involved now. | ||
Due to $WORK_STUFF | |||
jrockway | plenty of stuff for people new to the project to do :) | ||
jnthn | Come join the fun! irc.perl.org, #parrot :-) | ||
jrockway | how come #parrot is on MagNET and perl6 is on Freenode? | ||
TimToady | why not? | 23:54 | |
jnthn | :-) | ||
py1hon | jnthn, possibly, i'm having trouble remembering names |