perl6-projects.org/ | nopaste: sial.org/pbot/perl6 | evalbot: 'perl6: say 3;' | irclog: irc.pugscode.org/ | UTF-8 is your friend! Set by moritz_ on 4 May 2009. |
|||
00:16
justatheory left
00:36
alanhaggai joined,
alanhaggai left,
amoc joined
00:38
alanhaggai joined
01:00
abra left
01:15
DemoFreak left
01:29
Whiteknight left
01:45
ilogger2_ joined
02:14
eternaleye_ joined
02:36
mikehh_ joined
03:32
eternaleye joined
03:40
orafu joined
03:52
cognominal joined
03:56
meppuru joined
03:57
justatheory joined
04:05
LadyLuna1y joined
05:07
justatheory joined
06:01
meteorjay joined
06:05
M_o_C joined
06:07
xinming joined
06:09
dduncan joined
06:17
dduncan left
06:43
kate21de joined
07:01
r0bby joined
07:25
NoirSoldats joined
07:35
tombom joined
07:57
c9s joined
08:16
someguy joined
08:22
someguy left
08:39
ejs1 joined
08:47
Eevee joined
08:51
iblechbot joined
|
|||
Tene | There are lots of incorrect pages on perlfoundation.org/perl6/ | 09:14 | |
09:27
DemoFreak joined
09:48
meteorjay joined
10:03
bacek_ joined
10:11
ejs1 joined
10:28
fridim joined
10:30
pmurias joined
10:40
alanhaggai joined
|
|||
pugs_svn | r26749 | moritz++ | [t/spec] get rid of an instace of "is also" | 10:43 | |
moritz_ | std: sub f { 3 } sub g { 3 } | 10:50 | |
p6eval | std 26749: OUTPUT«##### PARSE FAILED #####Statements must be separated with semicolon at /tmp/8m2GakLY7m line 1:------> sub f { 3 } sub g { 3 } expecting any of: infix or meta-infix infix stopper standard stopper statement statement modifier loop | ||
..terminatorFAILED 00:02 3... | |||
pugs_svn | r26750 | moritz++ | [t/spec] get rid of "is also" in unspace.t | 10:55 | |
r26751 | moritz++ | [t/spec] get rid of some evals in unspace.t | |||
literal | std: rx/ <foo(1, 2, 3)> / | 10:58 | |
p6eval | std 26749: OUTPUT«ok 00:03 37m» | ||
literal | std: rx/ <foo_bar-baz(1, 2, 3)> / | ||
p6eval | std 26749: OUTPUT«ok 00:02 37m» | ||
literal | std: rx/ <foo_bar-baz'quux(1, 2, 3)> / | 10:59 | |
p6eval | std 26749: OUTPUT«ok 00:02 37m» | ||
moritz_ | std: [=>] <A B>, undef | ||
p6eval | std 26749: OUTPUT«ok 00:03 38m» | ||
pugs_svn | r26752 | moritz++ | [t/spec] correct and simplify chaining.t | 11:00 | |
dalek | kudo: a74a9cf | moritz++ | t/spectest.data: we pass S12-methods/chaining.t |
11:03 | |
literal | @tell TimToady STD.pm line 2234 doesn't make much sense. $> == $() ? | 11:25 | |
lambdabot | Consider it noted. | ||
11:28
Whiteknight joined
|
|||
moritz_ | it should probably be '$> variable' | 11:33 | |
literal | yeah | ||
pugs_svn | r26753 | moritz++ | [STD.pm] typo found by literal++ | 11:34 | |
moritz_ | forgiveness vs. permission ;-) | ||
literal | hehe | 11:43 | |
11:48
rindolf joined
11:49
abra joined
11:57
cognominal joined
12:11
LadyLunacy joined
12:16
kate21de joined
12:20
minazo joined
12:24
wknight8111 joined
12:27
Psyche^ joined
12:28
Psyche^ joined
|
|||
literal | std: 1 <=> 2 | 12:55 | |
p6eval | std 26753: OUTPUT«ok 00:02 35m» | ||
literal | rakudo: 1 <=> 2 | ||
p6eval | rakudo a74a9c: ( no output ) | ||
literal | rakudo: say (1 <=> 2) | ||
p6eval | rakudo a74a9c: OUTPUT«-1» | ||
diakopter | twimc: borrowing from Perl 6 - gavingrover.blogspot.com/2009/05/gr...admap.html | 13:13 | |
jnthn | Aye, they directly mention Perl 6 too. :-) | 13:18 | |
13:37
masak joined
13:42
skids joined
|
|||
masak | Tene: is Loldispatch available online somewhere? | 13:47 | |
14:03
aindilis joined
14:08
hacktor joined
14:10
hacktor left
14:12
fuad joined
|
|||
diakopter | jnthn: right, that's what I meant. | 14:13 | |
pugs_svn | r26754 | moritz++ | [t/spec] s/is also/augment (also in file name) | 14:27 | |
masak | moritz_++ | 14:28 | |
moritz_ | note that it was not s/.../.../g | ||
masak | no, it was s/.../... | 14:29 | |
:) | |||
kinda open-ended. | |||
moritz_ | ;-) | ||
14:32
sri_kraih joined
|
|||
pugs_svn | r26755 | moritz++ | [t/spec] s/is also/augment/ in open_closed.t | 14:33 | |
r26755 | moritz++ | | |||
r26755 | moritz++ | Also get rid of lives_ok { ... } around class defintions; the class | |||
r26755 | moritz++ | composition happen at compile time anyway, so that was pretty pointless. | |||
moritz_ | ok, 'is also' usage down to 5 files in t/spec, and they really need it (because it's what they test) | 14:34 | |
masak | moritz_: how do you mean? | 14:35 | |
I thought 'is also' was deprecated. | |||
moritz_ | masak: I mean I removed all needless occurences of that feature, however it's called syntactically | ||
masak still doesn't understand | |||
I'd better greo for it myself to grok it :) | 14:36 | ||
moritz_ | masak: I didn't remove all occurences of the deprecated 'is also' yet because I don't want to leave that untested in Rakudo | 14:37 | |
masak | ok. | ||
moritz_ | masak: I did s/is also/augment/ in some places that rakudo doesn't run anway... | ||
but most of the occurences weren't necessary for running the tests, so I removed them (or replaced by something simpler) | 14:38 | ||
masak | excellent. | ||
so those 'is also' that remain are those that Rakudo runs, and that can't be replaced by somethine else? | 14:39 | ||
:q | |||
oops, window focus fail. | |||
I notice none of the test files that use 'is also'/'augment' do 'use MONKEY_PATCHING' | 14:40 | ||
moritz_ | yes, I'm going to change that soonish as well | ||
masak | moritz_: do you need anything from Rakudo to be able to go through with it? | ||
14:51
nihiliad joined,
ZuLuuuuuu joined
|
|||
pmichaud | fwiw, I'm find if we regress on the 'is also' tests. | 14:53 | |
*fine | |||
15:05
payload joined
|
|||
jnthn | Aye. I think the use we make of is also in the setting will soon let us know if we broked it. :-0 | 15:07 | |
s/0/)/ | |||
15:08
pmichaud joined
|
|||
moritz_ | masak: not really; I can simply fudge it out | 15:11 | |
masak | moritz_: fair enough. but that means we go down in passed tests... | ||
I thought there might be a good way to prepare for it. | 15:12 | ||
moritz_ | masak: sure, implemnt 'use MONKEY_PATCHING' and 'augment' ;-) | ||
masak | :) | ||
15:17
justatheory joined
15:22
fuadaw joined
|
|||
pugs_svn | r26756 | moritz++ | [t/spec] rename is_also_instead.t and update syntax | 15:32 | |
15:33
ZuLuuuuuu left
|
|||
pmichaud | how many tests do we go down? | 15:35 | |
(approx) | 15:36 | ||
10? 100? | |||
moritz_ | I'm removing all, then I'll run the harness and tell you | ||
perhaps 50 to 100 | |||
pmichaud | I'll still live with the regression. | ||
we can always start to ship a MONKEY_PATCHING.pm module to get "use MONKEY_PATCHING" to not fail :-P | 15:37 | ||
15:37
M_o_C joined
|
|||
moritz_ | that's something that can easily be fudge away | 15:37 | |
don't worry on that front | |||
pmichaud | that too. | ||
15:37
fuadaw left
|
|||
masak | pmichaud: an actual module would be dependent on the cwd of the user, and/or PERL6LIB. | 15:38 | |
15:39
justlooks joined
|
|||
pmichaud | masak: I'm thinking we might end up with a standard lib-location for rakudo-distributed modules. | 15:39 | |
masak | \o/ | ||
pugs_svn | r26757 | moritz++ | [t/spec] remove rest of "is also" on classes | ||
moritz_ | pmichaud: first step, move Test.pm to lib/, IMHO | ||
masak | pmichaud: did I tell you about the time I tried to remove Test.pm from the November repo? | ||
pmichaud | I think you mentioned it, but I forget the punchline | 15:40 | |
masak | turns out I couldn't bring myself to do it, because November's Test.pm is still objectively better than Rakudo's. | ||
15:40
PhatEddy joined
|
|||
moritz_ | what's the difference? | 15:40 | |
diagnosis? | |||
masak | I don't recall exactly in which ways, but likely candidates are got/expected and is_deeply. | ||
those are the two things we added. | 15:41 | ||
pmichaud | I think got/expected in in Rakudo's Test.pm now. | ||
masak | and they're deeply useful in our test suite. | ||
moritz_ | I'm pretty sure we backported is_deeply to Rakudo. | ||
masak | :) | ||
moritz_ | pmichaud: I don't think so | ||
pmichaud: I tried to incorporate some of Ovid's patches, but had a few problems | |||
pmichaud goes to look at November's Test.pm | 15:42 | ||
afk for a bit | 15:43 | ||
dalek | kudo: cbc1bf6 | moritz++ | t/spectest.data: regress on a few tests tests that now use "augment" instead of "is also" |
15:44 | |
Tene | ack | 15:46 | |
I just missed him | |||
pmichaud | back | 15:47 | |
15:48
Psyche^ joined
|
|||
pmichaud | From a cursory look, I think I'd be fine with adopting November's Test.pm in place of Rakudo's. | 15:48 | |
PhatEddy | I've got a short regex program that hangs rakudo here: token chunk { <[a..z]>* }; say 'ok' if 'index/' ~~ /[ <chunk> '/'?]*/ | 15:53 | |
anything to do beyond mailing in a rakudobug? | 15:54 | ||
moritz_ | PhatEddy: it's known that PGE hangs on quantified zero width matches | ||
15:56
eternaleye_ joined
|
|||
pmichaud | you might want | 15:57 | |
token chunk { <[a..z]>+ }; ... / [ <chunk> ** '/' ]? / | 15:58 | ||
PhatEddy | sorry - just didn't occur to me right off to search rt from PGE ... | 15:59 | |
moritz_ | PhatEddy: it's known, but I don't know if it's in RT | 16:04 | |
16:07
baest joined,
smtms joined,
c1sung joined
16:08
pdc303 joined
16:09
broquaint joined,
spx2 joined
16:10
krunen joined,
Eevee joined
16:13
payload1 joined,
H1N1[S] joined
16:18
cognominal joined
16:19
integral joined
16:26
cavelife^ joined
16:30
amoc joined
16:37
masak joined
16:56
mberends joined
|
|||
mberends | masak: another nice blog, about yarn :) | 16:57 | |
masak | mberends: oh hai | ||
thanks. :) | 16:58 | ||
mberends | does there need to be a yarn pumpkin as well as a proto pumpkin? | ||
masak | nah, not yet, methinks. | 16:59 | |
in fact, I'm not sure there "needs" to be a proto pumpkin... I just like the thought of the pumpkin enough to keep it up. :P | |||
mberends | it's quite worrisome sleeping without a pumpkin, not knowing whether the world will be the same as when I drifted off... | 17:00 | |
masak | *lol* | 17:01 | |
jnthn | .oO( mmm....pumpkin soup ) |
17:02 | |
masak rolls pumpkin over on mberends' desk | |||
mberends will use git pull --rebase more often in future | |||
masak | mberends: I meant to write that recursive-deps stuff today, but I was distracted by yaks. | ||
Infinoid | damn yaks | 17:03 | |
mberends | I'm going to cage-clean HTTP::Daemon now | 17:04 | |
masak | mberends++ | ||
17:09
mikehh_ joined
|
|||
dalek | kudo: e6363e8 | pmichaud++ | docs/spectest-progress.csv: spectest-progress.csv update: 383 files, 11085 passing, 1 failing S32-io/IO-Socket-INET.t 2 - echo server and client |
17:14 | |
17:15
knewt joined
|
|||
s1n | i think this is a parse error: | 17:23 | |
rakudo: class A { my $.foo; sub test() { say "oh hai!"; } }; my A $a .= new; $a.test(); | |||
p6eval | rakudo e6363e: OUTPUT«Could not locate a method 'test' to invoke on class 'A'.current instr.: 'die' pc 16816 (src/builtins/control.pir:225)» | ||
s1n | notice the misplaced 'my' seems to screw with how the rest of the class is being parsed | 17:24 | |
any thoughts? | |||
jnthn | s1n: The error is completely correct. | 17:25 | |
A has no method test. | |||
It has a sub test though. :-) | |||
rakudo: class A { my $.foo; method test() { say "oh hai!"; } }; my A $a .= new; $a.test(); | |||
p6eval | rakudo e6363e: OUTPUT«oh hai!» | ||
s1n | jnthn: i was getting that with a multi-method... | 17:26 | |
rakudo: class A { my $.foo; multi method test() { say "oh hai!"; } }; my A $a .= new; $a.test(); | |||
p6eval | rakudo e6363e: OUTPUT«oh hai!» | ||
s1n | wtf | ||
what exactly is the difference between sub and method? | 17:27 | ||
moritz_ | ok, 11074 tests still passing | 17:28 | |
s1n: a method has an invocant | |||
in $a.test, $a is the invocant | |||
jnthn | Also, a method gets entered into the methods table and can be called as one. A sub does not. | 17:29 | |
s1n | why doesn't p6 just dwim and add the invocant if i called it with one? :) | ||
i really don't want to have to know that much, i just want to define a method on a class | |||
jnthn | Then define one! | ||
Using the keyword designated for that purpose. :-) | |||
moritz_ | s1n: because perl 5 didn't do the distinction, and it was a mess | 17:30 | |
s1n: if you are forced to declare it, optimizations and introspections can work | |||
s1n | i would just like it to automatically know "hey, that's a method on the class, let's add the invocant" or "hey, that's a stand-alone method, don't add the invocant" | 17:31 | |
i already defined the class scope, why do i need to use a different keyword? | 17:32 | ||
jnthn | Because you can also, quite legitimately, put a sub in a class too. | ||
s1n | which do you think is more common? | ||
jnthn | Which is something that is called without an invocant. | ||
In classes? methods. | 17:33 | ||
s1n | so... why not have dwim keyword which automatically figures it out, unless i want something unusual | ||
unless method was intended for that | 17:34 | ||
because i keep screwing it up and placing subs/methods incorrectly and spend hours debugging it | |||
jnthn | method is the keyword for "I'm defining something that can be invoked as a method on this class" | ||
In a class, you probably usually will want to be writing methods. | |||
s1n | jnthn: the point is i already defined the class, everything inside it is _logically_ defined on the class by default, right? | 17:35 | |
otherwise, class is just a hackish way of doing packages from p5 | |||
i want a class, when i define 'class A { .. }' everything inside that closure should default to be defined against that class | 17:36 | ||
jnthn | A class is a type of package, just as a role, a module, a grammar, etc is. | ||
s1n | everytime i define a class, i constantly have to define the class contents within the contents of the class | ||
jnthn | Myself, I'd rather not having subs suddenly changing their meaning in different types of package. If something is different it's probably best off if it looks different. | 17:37 | |
s1n | personally, i hate having to keep saying what's inside the class when i've already said what the class' scope is | ||
jnthn | Anyways, if it bugs you and others enough, it's only a proto routine_declarator:dwimcode away. :-) | ||
s1n | all i'm getting at is the class is already defined in the closure, everything in it _should_ belong to it by default | 17:38 | |
jnthn | It does, but there's a difference between "belongs in the package of the class" and "belongs in the method table of the class". | 17:39 | |
Tene | s1n: It's also useful to define class-scoped subs. You don't want those showing up as methods on the class. | ||
s1n | Tene: i know what class scoped methods are | ||
Tene | s1n: I said class-scoped *subs*. That aren't methods on the class. | ||
class A { sub helper_function_one { ... } } | 17:40 | ||
s1n | i can't help but think java got this right, i have to add 'static' to define something against the class | ||
Tene | "Inside of a class declaration, 'sub' gets a new meaning, and we have a different keyword we have to use for what 'sub' used to mean." | 17:41 | |
Is a bad rule. | |||
jnthn | Java doesn't have a sub keyword. | ||
s1n | i think i've mistakenly used sub/method incorrectly about 10 times, and each time it takes me hours to figure out what i've done wrong | ||
moritz_ | jnthn: java doesn't have subs at all | 17:42 | |
s1n | to me, the sub/method thing is unintuitive and i will always screw it up | 17:43 | |
jnthn | moritz_: I know, I was more drawing out that there's no keyword at all in Java for declaring a chunk of code. | ||
moritz_ | that it's (IMHO bad) C++ heritage | 17:44 | |
s1n | you can, but it has to either be static on a class, or an anon closure | ||
(that is, you can do { code } in both languages) | 17:45 | ||
you just can't call it, it's just called in whatever closure it's currently in | |||
code { more code } even more code => just plows through each of those in order | 17:46 | ||
moritz_ | ie it's not a declaration, just a new scope | 17:47 | |
s1n | moritz_: yeah, basically | ||
Tene | s1n: You really think that it would be a good idea for 'sub' to magically mean something different in classes, and require 'sub-yes-really-a-sub' to mean what 'sub' used to mean? You think that would be more intuitive and lead to fewer mistakes? | 17:50 | |
s1n | Tene: i dunno, but i'm sure i can't be the only one screwing that up | 17:51 | |
Tene | That's the first time I've heard anyone mention it. That doesn't necessarily mean much, though. | ||
s1n | it seems intuitive to me to have one keyword for all methods and one that says "this one is just a named closure and isn't defined on the class" | 17:52 | |
Tene | My feeling is that it's not so much unintuitive as it is just a (needed, IMO) change from Perl 5. | ||
s1n | and everything else? | 17:53 | |
Tene | s1n: 'sub' in a class means the same thing as 'sub' in a namespace and 'sub' anywhere else. | ||
s1n | i think i'm failing to express my point | ||
Tene | how is "'sub' means exactly the same thing everywhere" less intuitive than "'sub' means the same thing everywhere, except in class blocks, where you have to say 'really-sub' to mean what 'sub' means everywhere else"? | 17:54 | |
Hm. I think I already said that. | |||
Or I'm failing to understand. | |||
s1n | class A { method-on-A; method-on-A; method-not-on-A; } versus class A { method; method; method-not-on-A } | 17:55 | |
Tene | I have no idea what that means. | ||
s1n | i've already declared the class, everything in it is in the class unless i say otherwise | ||
jnthn | s1n: I think what you're missing is that there's different ways to be "in the class". | 17:56 | |
Tene | a sub isn't a method, though! | ||
s1n | then why is it called "submethod"? | ||
why not "code { }" | |||
Tene | erm, submethod is different from sub | ||
jnthn | s1n: As soon as you want sub to mean something else in there, you then have to go through all the other package types (role, grammar, etc) and say "so what does sub mean in there?" | ||
s1n | Tene: how does that make sense?? | ||
jnthn | And then we get back to "memorizing lists of things". | ||
Which is something Perl 6 tries to avoid. | 17:57 | ||
s1n | jnthn: i'm not sure i understood what you mean | ||
jnthn | In a world where people can declare their own package types and routine types in derived forms of Perl 6, I think keeping the meanings of routines and the meanings of packages orthogonal is probably a win, even if it's at the expense of some dwim-i-ness. | 17:58 | |
s1n | we have method, sub, and submethod and they all mean something pretty different. no one else sees that as confusing? | ||
jnthn | No, just as I don't see "we have module, grammar, class, role all meaning something pretty different" as confusing either. | ||
Tene | Different names for different things. it would be a lot more confusing if we only had one name for all of those things, or all of those names for one thing. | ||
exactly | |||
jnthn needs to eat - bbiab | 17:59 | ||
s1n | okay, then i hope that works out for everyone else because they all sound the same to me and no one else seems to think it's even the slightest bit confusing | ||
of course, you both have worked _on_ rakudo, so your views may be slanted | 18:00 | ||
moritz_ | s1n: casual users don't have to care about submethods | ||
Tene | s1n: do you actually have a proposal for how things should be instead? I might have missed it. | ||
I came in a bit late. | |||
s1n | moritz_: how are casual users going to know the difference? | ||
Tene | i'm still not quite sure what your complaint is. | 18:01 | |
s1n | Tene: i thought i did but i guess not | ||
moritz_ | s1n: the just read a tutorial which covers the basics, and it will deal with subs and/or methods. They'll use what they'll be taught. | ||
it worked the same for Perl 5: the documentation uses some idioms, and people copied them | |||
s1n | moritz_: i would agree, which means people are less likely to use or understand sub/submethod | 18:02 | |
because when they define a class, just just want to define a function on the class | |||
Tene | s1n: can you explain "on the class"? | 18:03 | |
moritz_ | they want to define a method on the class ;-) | ||
and nearly all other languages call that thing "method" as well | 18:04 | ||
s1n | okay, lemme try with another example in another language | ||
class A { void foo() { ... } }; #c++, foo is defined as a method on instances of A | 18:05 | ||
requires no additional knowledge other than i put it inside A's definition | |||
moritz_ | s1n: at the cost of less flexibility | 18:06 | |
s1n | moritz_: how so? | ||
moritz_ | s1n: you can't declare a function in a class in C++ | ||
s1n | it defaults inside | ||
18:07
smtms joined
|
|||
s1n | moritz_: class A { static void foo() { ... } }; | 18:07 | |
moritz_ | s1n: that's a static method, not a function. | ||
s1n | wtf is the difference? | ||
Tene | that's a... what mroitz said | ||
moritz_ | s1n: how do you call a static method? | ||
s1n | A::foo() | ||
moritz_ | well, in Perl you call it as A.foo() | 18:08 | |
and a sub as A::foo() | |||
or, if imported, simply as foo() | |||
s1n | so what does A.foo() mean? shouldn't it be $a.foo()? | ||
moritz_ | A.foo() means "call a method on class A" | 18:09 | |
s1n | then what is A::foo()? | ||
Tene | s1n: the issue is that @larry feel strongly that keywords suddenly having different behaviors in different places is a very bad thing. | ||
moritz_ | that's calling a function in A's namespace | ||
which is *not* a method call | |||
Tene | because in Perl 5 it has lead to a large list of arbitrary things to memorize. | 18:10 | |
moritz_ | and thus determined by lexical scope and namespace | ||
Tene | instead of "This construct behaves this way", you had to memorize "This construct behaves in these three ways in these three different situations" | ||
moritz_ | a method call is always independent of namespace and scope | ||
s1n | forget it, it's not worth it | 18:11 | |
18:13
masak joined
|
|||
Tene | hi masak | 18:13 | |
masak: I added LolDispatch to web. it maybe needs a less silly name? | |||
18:21
ejs1 joined
|
|||
moritz_ is a bit annoyed that his blog still doesn't show up in the ironman feed, and mst doesn't respond to emails anymore | 18:24 | ||
masak | Tene: I think the name is very fitting. :) | 18:25 | |
Tene: but you should definitely blog about it, and about the pastebin. | |||
s1n | let's say i wanted to introduce or change some syntax (like a grammar) within the language, do i do that with protos? | 18:34 | |
moritz_ | usually not | 18:35 | |
either with macros | 18:36 | ||
or something like | |||
augment slang Regex { token backslash:std<\Y> { YY }; } | |||
that would introduce a new \Y token, which matches the literal YY | 18:37 | ||
(very silly, but what I used in a test recently) | |||
rakudo: rx:P5// | |||
p6eval | rakudo e6363e: OUTPUT«Colons cannot be used as delimiters in quoting constructs at line 1, near ":P5//"current instr.: 'parrot;PGE;Util;die' pc 129 (runtime/parrot/library/PGE/Util.pir:86)» | ||
moritz_ | rakudo: m:P5// | 18:38 | |
p6eval | rakudo e6363e: OUTPUT«Colons cannot be used as delimiters in quoting constructs at line 1, near ":P5//"current instr.: 'parrot;PGE;Util;die' pc 129 (runtime/parrot/library/PGE/Util.pir:86)» | ||
pugs_svn | r26758 | moritz++ | [t/spec] improve fudging of capture.t; vim modeline | 18:41 | |
r26759 | moritz++ | [t/spec] avoid newlines in test descriptions | |||
s1n | moritz_: can i augment any keyword or STD expression? | 18:46 | |
moritz_ | s1n: yes | 18:47 | |
s1n | so i can do something like 'augment slang If { ... }'? | 18:48 | |
moritz_ | no | ||
s1n | #i don't know what the syntax in STD is for 'if' | ||
well, i was trying to say, can i augment a keyword like 'if', is that just not possible? | 18:49 | ||
moritz_ | augment slang MAIN { token statement_control:sym<if> { IFF } } | 18:50 | |
then you can write 'IFF 3 < 4 { say "yes" } ' | |||
s1n | can i change IFF to be if with some other change? | 18:51 | |
that looks like i'm only allowed to alias things, i want to actually augment the existing tokens | |||
moritz_ | actually my example was bogus | 18:52 | |
s1n | heh | ||
moritz_ | you'd neet do put in the regex to match a whole `if' statement, including condition, else, elsif blocks etc. | ||
s1n | even when you're just augmenting it? | ||
moritz_ | see STD.pm, lines 1256ff | ||
s1n goes off to look | 18:53 | ||
moritz_ | what do you mean by "just augmenting"? | ||
s1n | well, augment, to me, means i'm just augmenting existing behavior in some way, not redefining it | ||
moritz_ | so you want to change the semantics, not the syntax? | 18:54 | |
s1n | moritz_: both :) | ||
moritz_ | s1n: if you want to change both, you'd be better off with a macro | ||
s1n | are there spectests for macros? | ||
moritz_ | yes, a few | ||
s1n | Missing test file: t/spec/S12-class/is_also_instead.t | 18:56 | |
moritz_ | uhm, did I forgot to push? | 18:57 | |
18:58
abra joined,
fuad joined
|
|||
moritz_ | s1n: cbc1bf6140f9c31872b51ddf9c6a7161845c789c should have fixed that | 18:58 | |
s1n | moritz_: ahh, okay, i checked that out yesterday, so i updated | 18:59 | |
rakudo: macro f { '1 + 1' }; f.say; | 19:00 | ||
p6eval | rakudo e6363e: OUTPUT«Could not find non-existent sub fcurrent instr.: '_block14' pc 64 (EVAL_16:49)» | ||
moritz_ | rakudo doesn't do macros | ||
s1n | oh, bummer :( | ||
moritz_ | which is why there are so few tests | ||
s1n | okay, well, can i do this then: macro if { True }; if False { say "oh hai"; } | 19:02 | |
moritz_ | no | 19:03 | |
if you tell me what you want to achieve, maybe I can help you better | |||
19:04
jan___ joined
|
|||
s1n | moritz_: i want to alter the syntax and semantics of a keyword, let's start with the if statement | 19:11 | |
let's see, we can maybe add something like the comma operator from c? | |||
(just an example to get me started) | |||
moritz_ | so what does the comma operator from C do? | 19:12 | |
s1n | kinda like shortcuircuting, so you can have multiple clauses | ||
bad way of doing && :) | |||
moritz_ | well, the comma is taken in Perl 6 already | 19:13 | |
so that's kinda hard | |||
s1n | so let's invent one | ||
btw, it's not entirely like &&, just trying to give an example: en.wikipedia.org/wiki/Comma_operator | 19:14 | ||
moritz_ | let's say you want ,, to do the same thing that && does | ||
then you could do something along these lines: | |||
macro infix:<,,>($a, $b) { quasi {{{ $a && $b }}} } | 19:15 | ||
s1n | i could then do 'if True ,, False { say "never happens" }' | 19:16 | |
19:16
payload joined
|
|||
moritz_ | right | 19:16 | |
s1n | but that's not modifying 'if', it's adding a new infix operator | 19:17 | |
i'm trying to think of something else we could do to modify sym:if... | 19:18 | ||
19:18
M_o_C joined
|
|||
s1n | maybe always return True | 19:18 | |
maybe if is a bad example | 19:19 | ||
maybe make 'loop' behave like 'while'? | |||
(one Bool clause) | |||
19:20
cspencer joined
|
|||
moritz_ | augment slang MAIN { token statment_control:loop is parse &statment_control:while { quasi {{{ while $/<xblock><EXPR>.compile { $/<xblock><pblock>.compile } }}} } } # perhaps something along these liens | 19:22 | |
dalek | kudo: 496e1f0 | moritz++ | t/spectest.data: a few more files for t/spectest.data |
19:25 | |
19:26
jferrero joined
19:29
masak joined
|
|||
masak | does 'augment slang' require MONKEY_PATCHING, or something similar? | 19:30 | |
fuad | masak:hello friend | ||
moritz_ | masak: dunno | ||
masak | fuad: greetings, fuad. also known as usr. :) | ||
fuad | yeah:) | 19:31 | |
im here again | |||
moritz_ only knows urs | |||
masak | fuad: me too. :) | ||
fuad: as you can tell, the network I use in the evenings is flaky. | |||
19:31
[particle] joined
|
|||
fuad | hi moritz_ | 19:32 | |
moritz_ | hi fuad ;-) | ||
s1n | moritz_: that's an interesting macro, i'd like to see how that works out :) | 19:33 | |
moritz_ | s1n: me too ;-) | ||
s1n | i'm kinda interested in being able to do things like that, to see what i can get the lang to do :) | 19:34 | |
19:37
abra joined
|
|||
masak | s1n: re subs/methods, I've been using classes and methods for almost a year now, and I don't experience the issue you're describing -- accidentally combining class/sub, then trying to call the sub as a method and then spending hours searching for the problem. | 19:38 | |
s1n | masak: then i must be an idiot | ||
masak | s1n: I suggest you examine whether this might not be a correct design in Perl 6 after all. | ||
s1n: I didn't say that. | 19:39 | ||
s1n | masak: what do you mean examine if it's a correct design? | ||
masak | s1n: it might simply be that you have more Perl 5 experience than I do. | ||
s1n: I mean that for me, it works very well. | |||
s1n: I use methods and subs interchangably in classes, and I don't often confuse them. | |||
s1n | masak: well, i have more c/c++ experience than anything else, so that's where i'm coming from | ||
masak | ok. | 19:40 | |
jnthn | masak: If you're using methods and subs interchangably, you might have issues. ;-) | ||
masak | jnthn: how so? | ||
s1n | masak: it's a matter of how every other language treats methods | ||
masak | jnthn: I can call subs from methods. no harm in that. | 19:41 | |
s1n: Perl 6 doesn't necessarily aspire to conform to how other languages do things. :) | |||
s1n | masak: right, and everyone else here seems bent on keeping the current behavior | 19:42 | |
jnthn | masak: Ah, that was a sentence with more than one reading. :-) | ||
I get the one you meant now. | |||
masak | s1n: including me. but I wouldn't describe it as 'bent on'. I just don't find a problem with it. | ||
s1n | my main point was that sub/method/submethod all sound the same and mean the same thing to me mentally. i just wanted to define a function in the class (instance function), i really didn't want to have to think "gee, what kind of function is this" because i already put it inside the class | 19:44 | |
masak | jnthn: would it be possible to issue a warning message in s1n's confusion case, something like "did you mean to declare 'test' as a method?" ? | ||
s1n: I see your point. | 19:45 | ||
s1n: I use the distinction sub/method to my advantage within classes, so I'm not sure I would welcome your solution. | |||
moritz_ | once macros and syntax changes work, the obvious solution is to define your own Perl 6 slang | ||
masak | "there will be modules." | ||
s1n | well, if i put the class as a single line declarator, that makes sense to have to say, but i put the function _inside_ the class closure, it just made sense that it would figure it out for me | 19:46 | |
masak | s1n: there's still some dissonance between your model and mine, it seems. | 19:47 | |
I cannot make sense of your last utterance. | |||
s1n | heh | ||
masak | "figure it out for me" -- please elaborate. | ||
jnthn | masak: The error message is already very clear. "There's no method called foo on class A." Well, that suggests I think quite clearly enough "go look through class a for method foo". :-) | ||
*A | 19:48 | ||
masak | jnthn: agreed. | ||
jnthn | There's lots of Rakudo errors that aren't great, but that's one of the less bad ones, IMO. | ||
19:48
explorer__ joined
|
|||
fuad | jnthn:Hi mate | 19:48 | |
masak | jnthn: nod. | 19:49 | |
s1n | when i think of code, i think in psuedocode, then translate. i thought "gee, i want to add a function to instances of this class", i accidentally translated that in perl6 to a 'sub' and i spent forever trying to find where i messed up on the function | ||
jnthn | fuad: hi :-) | ||
s1n | i put the sub inside the class but it didn't know that i meant method because it's inside class A{} | ||
sub and method are too mentally similar to me and i messed it up | |||
fuad | jnthn:im yesterday`s guy which have used nickname usr,so from now im with this nickname;) | ||
masak | s1n: ok, so this is from the perspective of someone learning Perl 6, and that someone doesn't know subs from methods? | 19:50 | |
jnthn | fuad: Ah, OK. :-) | ||
s1n | masak: this is from the perspective of someone wanting to put a function inside a class and perl6 not knowing that i will likely never mean sub and usually mean method | ||
subs will probably go outside classes, methods inside | 19:51 | ||
unless i've yet again misunderstood things | |||
the only reason why i even discussed this was in the hopes that _someone_ might see my frustrations and say "hmm, is this the best way to do this?" | 19:53 | ||
masak | s1n: does your usage of the word 'function' include both subs and methods? | ||
s1n: it's quite brave of you to enter a community in the hopes of changing its mind. :) | |||
s1n | masak: my usage of function is a closure, where i put it or explicit definition is what separates method/sub | ||
masak | s1n: ok, 'closure' and 'function' is another pair of terms which could create confusion in discussions between us. :) | 19:54 | |
s1n | masak: not trying to change it's mind, i just want the best product that will be fun to use and will attract lots of users, anything i can do to achieve that, the better | ||
masak: how about "a block of code that can be called from somewhere by name" heh | |||
masak | s1n: again, I'm one of those users. I'm happy with this aspect of Perl 6. you seem not to be. | 19:55 | |
s1n: that definition works. | |||
s1n: it differs from my view of a closure as something ordinarily anonymous. | |||
s1n | masak: right, like i said, i seem to be the only one | 19:56 | |
masak: a closure is just that block without a name :) | |||
masak | s1n: yes. but a sub or a method in Perl 6 is not just a block with a name. | ||
s1n | i always think conceptually before i write anything, it allows me to work with _many_ languages on a regular basis :) | ||
masak | s1n: my only recommendation is to try using the 'method' keyword with an open mind. | 19:57 | |
s1n | masak: all i can really do is provide feedback | 19:58 | |
masak | s1n: sure. that's what #perl6 is for. | 19:59 | |
s1n | i don't necessarily have a solution (Tene) or maybe even a really good explanation (moritz_), i'm doing the best i can with the mental converters for perl6 that i have :) | ||
i hunted down the same mistake after a number of hours enough to want to say something | |||
no one agrees, so i guess the world keeps turning | 20:00 | ||
masak | s1n: yes, I've often come into #perl6 with complaints having had similar experiences. | ||
s1n: but not with this one. | |||
s1n | heh | ||
masak | s1n: it might be your unique C/C++ background that makes you turn down this particular garden path. | ||
s1n quits climbing uphill | |||
skids skips technical nitpicking on what "closure" actually means because he'd probably just get owned by a CS major :-) | 20:01 | ||
masak | skids: :) | ||
skids: a closure is just a thunk. :P | |||
skids | thunk is an overloaded term even by CS standards. | 20:02 | |
s1n | i have to think conceptually like this because i work with no less than 5 languages at work, perl6 for a hobby, and the graduate degree that has no language focus (only conceptual ideas with implementations in whatever) | ||
at the very least, i'd like to be able to alter this behavior | 20:05 | ||
20:06
LadyLuna1y joined
|
|||
skids | So you have no intention of ever using class-global subs (no invocant, but part of a class?) | 20:07 | |
s1n | no i might, but i'd like something like 'static method foo' instead of 'sub foo' | 20:08 | |
but that's just a c/c++ weenie talking :) | |||
that way all methods in a class are really instance methods for the class, and there is no sub :) | 20:09 | ||
jnthn | s1n: The other thing to remember is that if you declare a method foo you can't just call it as a subroutine foo() in Perl 6. Sub dispatch and method dispatch are different things. | 20:10 | |
s1n | that way i can merrily do "class A { method foo{}; method bar{}; static method baz{} }" and mentally seperate baz out as something different | 20:11 | |
jnthn: i have no idea what you meant by that lol | |||
masak | mberends: so, are you using that pumkin right now? | ||
20:11
FurnaceBoy joined
|
|||
skids | s1n: you could do method foo is export... just you'd always have to have the invocant as first arg. | 20:12 | |
s1n | skids: sadly, i once again didn't understand that | 20:14 | |
skids | method foo is export will also generate an exported sub in the namespace. multi method foo is export will let you do it from more than one class with the same method name. | 20:15 | |
jnthn | s1n: class A { method foo() { }; method bar() { foo() } } # This call to foo() is an error, you need to call it as a method | ||
s1n: class A { sub foo() { }; method bar() { foo() } } # This call to foo() works fine since you're using sub-calling syntax to call a sub | |||
s1n | jnthn: to me, that's a failure in design, because self should be implied | ||
skids | You don't always want self on helper functions. | 20:16 | |
jnthn | s1n: It's just about avoiding confusion between method dispatch and sub dispatch. | ||
s1n | jnthn: still doesn't sound like a good idea | 20:17 | |
jnthn: you honestly think people aren't going to make that mistake enough to be put off by it? | |||
jnthn | s1n: The maning of "push @foo, 42" changing because your class happened to define a push method to me seems like a worse one. | ||
*meaning | |||
20:18
frew|work joined
|
|||
s1n | jnthn: i dunno, it seems unnatural that self is not implied | 20:19 | |
jnthn | Only if you want to overvalue object orientation at the expense of other paradigms. | ||
s1n | jnthn: does perl6 have a full fledge object model or a second class object model? seems to me that method dispatch takes precedence | 20:21 | |
20:21
pmurias joined
|
|||
jnthn | I'm not even sure how you'd distinguish the two. | 20:22 | |
I think it's safe to say that Perl 6 is a multi-paradigm language, and that object orientation is one paradigm that it provides a lot of support for. But it's not the only one that matters either. | |||
frew|work | jnthn: couldn't we have both sub and method? | 20:24 | |
s1n | it's okay that no one else agrees with me now, but the first thing i'll do with macros is obsolete sub and change method to behave as i mentally mean it to | ||
jnthn | frew|work: We do. | ||
frew|work | but method doesn't imply self? | ||
jnthn | frew|work: Yes, and also that the thing is callable as a method. | ||
s1n | frew|work: only if the invocant is specified | ||
jnthn | Which if you're calling it as self.foo() it is :-) | 20:25 | |
s1n | even within the class itself, self has to be specified | ||
frew|work | but if I have this I'm good: | ||
jnthn | Right. If you're calling another method. | ||
s1n | again, bring on the macros :) | ||
frew|work | method(:$self, $foo) {} | ||
jnthn | frew|work: Did you mean for the colon to be after $self ? | ||
frew|work can't remember invocant syntax | 20:26 | ||
sure? | |||
yeah | |||
jnthn | ($self: $foo) | ||
frew|work | that's not so bad. And it should be easy to do what s1n wants with a grammar extension right? | ||
jnthn | std: method(:$self, $foo) {} | ||
p6eval | std 26759: OUTPUT«##### PARSE FAILED #####Unexpected block in infix position (two terms in a row, or previous statement missing semicolon?) at /tmp/xqquTAUi16 line 1:------> method(:$self, $foo) {} expecting any of: infix or meta-infix infix stopper standard | ||
..stopper termina... | |||
frew|work | when that works | 20:27 | |
jnthn | Ah, yes. Space needed if you're declaring an anonymous method. | ||
std: method (:$self, $foo) {} | |||
p6eval | std 26759: OUTPUT«##### PARSE FAILED #####Can't put required parameter after variadic parameters at /tmp/4p6wHXhHnY line 1:------> method (:$self, $foo) {} expecting any of: parameter post_constraint trait whitespaceFAILED 00:02 36m» | ||
jnthn | std: method ($self:, $foo) {} | ||
gah! | |||
p6eval | std 26759: OUTPUT«##### PARSE FAILED #####Unable to parse multisig; couldn't find final ')' at /tmp/Pqv2c0yv3f line 1:------> method ($self:, $foo) {} expecting any of: parameter signature whitespaceFAILED 00:02 36m» | ||
frew|work | nice try. | ||
jnthn | lol, OK, I give up | ||
20:27
szbalint joined
|
|||
jnthn | std: method ($self: $foo) {} | 20:27 | |
p6eval | std 26759: OUTPUT«ok 00:02 36m» | ||
jnthn | phew | ||
frew|work | std: method ($self: $fo) {} | ||
p6eval | std 26759: OUTPUT«ok 00:02 36m» | ||
20:28
antiphase joined
|
|||
skids | yeah, the colon, comma equivalence is going to take some habituating here too. | 20:28 | |
frew|work | it makes sense | ||
s1n | rakudo: class A { method foo($self: $fo){ say "oh hai" }; method bar { foo; } }; my A $a .= new; $a.bar; | ||
p6eval | rakudo 496e1f: OUTPUT«too few arguments passed (0) - 2 params expectedcurrent instr.: 'parrot;A;foo' pc 173 (EVAL_23:82)» | 20:29 | |
s1n | is that wrong? | ||
jnthn | s1n: Yes. | ||
erm | |||
well, the code is wrong, Rakudo is right. | |||
pmurias | s1n: btw what languages do you use at work? | ||
skids | It does make sense, it's just getting my autonomous spurious-punctuation-and-overparenthesization system trained for it. :-) | ||
jnthn | rakudo: class A { method foo($self: $fo){ say "oh hai" }; method bar { self.foo(42) } }; my A $a .= new; $a.bar; | 20:30 | |
s1n | pmurias: c, c++, (c-tran even), perl, shell scripting, java, python | ||
p6eval | rakudo 496e1f: OUTPUT«oh hai» | ||
s1n | jnthn: i was wanting to not have to say self | ||
jnthn | rakudo: class A { sub foo($fo){ say "oh hai" }; method bar { foo(42) } }; my A $a .= new; $a.bar; | ||
p6eval | rakudo 496e1f: OUTPUT«oh hai» | ||
jnthn | Then write that second one. | ||
But remember that declares a sub, not a method. | 20:31 | ||
frew | I think it would be cool if method defaulted the invokant into $self if one wasn't specified | ||
pmurias | what's the point? | ||
jnthn | frew: It's always available as "self". :-) | ||
s1n | frew: jnthn just recommended otherwise | ||
pmurias | you have self | ||
frew didn't know that | |||
what's the point of defining $self if self is available? | |||
jnthn | frew: Not much. :-) | 20:32 | |
frew: method foo(@list: $x) { ... } can be useful though if your invocant is an array for example. | |||
But the scalar from is less useful. | |||
pmurias | method foo(&f) {...} | 20:33 | |
frew | well yeah, but if you are building a regualr class... | ||
skids | It's for when you don't want to code in the first person :-) | ||
jnthn | ;-) | ||
frew regularly doesn't code in first person, but that's javascript | |||
prototypical OO, though weird, can be very sexy | |||
pmurias | s1n: if one is confusing methods and subs wouldn't having them under a joint keyword confuse him even more | 20:34 | |
? | |||
frew agrees with pmurias | 20:35 | ||
now that I know that self is always available I don't see why you want to do what you want to do s1n | |||
skids | method talks($he: $babble) # coded by extrovert ... method talk($you: $babble) # coded by dominatrix | 20:36 | |
frew | does anyone know if we could have some kind of function case statement in p6? so that you could do something like this: | ||
my $foo = given $foo { when 'bar' { 'baz' } }; | 20:37 | ||
s1n | pmurias: it wouldn't be under one keyword, the class-based method would need a modifier like multi | ||
Tene | got a basic blog app running in 20 mins on rakudo. :) | ||
s1n | frew: fyi, self isn't _always_ available, not in BUILD | ||
pmurias | class-based method = ? | 20:38 | |
Tene | I heard masak did a speed-run blog app earlier, and I wanted to try. | ||
frew | but self doesn't really exist in BUILD yet, does it? | ||
pmurias | it should | ||
frew: submethods are just methods you don't inherit | 20:39 | ||
frew | it should exist or self should work? | ||
pmurias | it exists | ||
Tene | will post when I get to my hotel. | ||
s1n | i'm going to just take a backseat on this argument, it's clear my opinion is at odds here, i'd rather just deal with it until i get macros | ||
frew hopes macros don't end up being sketch like filters are in p5 | 20:41 | ||
I know they are supposed to be real macros, but still | |||
s1n | if they're anything like c++ macros that let me fundamentally change anything as i see fit, i'll be a happy camper :) | 20:42 | |
frew | but shouldn't we theoretically be able to change syntax in p6 w/o a macro? | 20:43 | |
just modify the grammar right? | |||
pmurias | yes | ||
frew | which can be done in code | ||
jnthn | rakudo: my $tester = { given $^condition { when 42 { say "the answer" }; when 0 { say "nothing" } } }; $tester(42); $tester(0); | ||
s1n | yeah, but macros let you do it in a module without redistributing the perl6 STD grammar | ||
p6eval | rakudo 496e1f: OUTPUT«the answernothing» | ||
frew | oooh | ||
jnthn | frew: See above in answer to your question. | ||
rakudo: my &tester = { given $^condition { when 42 { say "the answer" }; when 0 { say "nothing" } } }; tester(42); tester(0); # may work too | 20:44 | ||
p6eval | rakudo 496e1f: OUTPUT«the answernothing» | ||
frew | woo! | ||
jnthn | yay | ||
frew | awsome | ||
jnthn | That's a bit neater. :-) | ||
frew | this means I will be writing dispatch tables 90% less often! | ||
jnthn | frew: Don't forget there's multi-dispatch too. :-) | 20:45 | |
frew | oh I know | ||
and I miss it at work | |||
jnthn | In this case it's more code, though. | ||
s1n | actually, that was something i was looking for exactly for something else! thanks! | ||
frew | :-) | ||
20:45
donaldh joined
|
|||
frew | I am writing a web based test thing for at work, and multi dispatch and that version of given/when make the code even neater | 20:46 | |
s/for at/for use at/ | |||
20:59
zamolxes joined
21:00
fridim joined
21:01
nemstep joined
|
|||
moritz_ | I've added enough new tests that the overall number of passing tests increased ;-) | 21:13 | |
11179 | |||
frew | haha | ||
fuad | moritz_ im off to bed dude,have a nice time.Take care:) | ||
frew | how good do you think the coverage is for the language as a whole? | ||
fuad | jnthn:take care dude,im out:) | 21:14 | |
moritz_ | frew: dunno, perhaps 60% | ||
jnthn | fuad: See you. :-) | 21:15 | |
moritz_: Nice! :-) | |||
moritz_ | but most of the coverage isn't really good | 21:17 | |
for example macros and object pipes are nearlly not tested, only a tiny bit | |||
but that's really hard to do as long as no compiler implements them | 21:18 | ||
patmat | i wish everyone a good night!! | 21:21 | |
moritz_ | good night | ||
fuad | g`night patmat | ||
jnthn | night | ||
moritz_: Yeah, I agree on the "hard to test without a compiler getting close to attempting them" thing. | 21:22 | ||
moritz_ | jnthn: speaking of which, are there any new features you want to do soonish, and which need more tests? | ||
jnthn | moritz_: In theory, everything in news.perlfoundation.org/2009/04/hag...t_tra.html | 21:23 | |
;-) | |||
moritz_ | jnthn: yeah, I looked at it some time ago, and picked the item from the bottom ;-) | 21:24 | |
21:24
meppl joined
|
|||
jnthn | moritz_: There's this section called the project plan that gives an odering... ;-) | 21:25 | |
erm, ordering... :-) | 21:26 | ||
moritz_: Traits tests are good though of course. :-) | |||
D3 should be not too hard to write tests for. | |||
But we may already have some. | |||
moritz_ takes a look | 21:27 | ||
jnthn | D2 has some coverage. | ||
pugs_svn | r26760 | moritz++ | [t/spec] don't use outer lexicals in submethods.t | 21:28 | |
r26761 | moritz++ | [t/spec] fudge capture.t for rakudo | |||
r26762 | moritz++ | [t/spec] bring new-symbols.t more in line with S02 and S05 | |||
r26763 | moritz++ | [t] update TASK, tests for unary [!=] etc | |||
mberends | general question, is it wrong that 'constant FOO =42;' in a module does not put FOO in the script using the module? Also tried adding 'is export', no dice. | 21:30 | |
jnthn | mberends: It's wrong, and is export will be the way to do it. | 21:31 | |
moritz_ | rakudo: module A { constant FOO is export(:DEFAULT) = 3 }; say FOO | ||
p6eval | rakudo 496e1f: OUTPUT«Null PMC access in isa()current instr.: 'parrot;List;!flatten' pc 6781 (src/classes/List.pir:215)» | ||
jnthn | But is export on a constant currently doesn't work. | ||
moritz_ | ticket! | ||
21:31
eternaleye joined
|
|||
jnthn | oh noes where's masak?! | 21:31 | |
moritz_ | where's masak when you need him? ;-) | ||
mberends | shall I report it? ... ok moritz_ | ||
moritz_ | mberends: go ahead please | ||
jnthn | ...I love how "ticket" and "masak" are about synonyms now. | ||
mberends | masak's neighbour probably switched off their communal router. | 21:32 | |
moritz_ | "can you masak it?" ;-) | ||
mberends | just a poor imitation, i'm afraid ;-) | ||
skids notes small edit distance masak --> mistake --> ticket | |||
jnthn | Rakudo has so many masaks. | 21:34 | |
.oO( But I'm working to get rid of them. Mwaha. ) |
|||
moritz_ | does $obj.?method returns a list? | 21:35 | |
I know .+ and .* does | |||
jnthn | moritz_: Not AFAICR. | 21:37 | |
moritz_: Just undef or the result. | |||
moritz_ | jnthn: thanks | 21:38 | |
jnthn | moritz_: Feel free to review my .WALK tests too. | ||
moritz_ | rakudo: say 3.3.int | 21:44 | |
p6eval | rakudo 496e1f: OUTPUT«3» | ||
pugs_svn | r26764 | moritz++ | [t/spec] improve and extend parallel dispatch tests | 21:51 | |
moritz_ | rakudo: use Test; plan 1; is_deeply((1, 2), [1, 2]) | 21:54 | |
p6eval | rakudo 496e1f: OUTPUT«1..1ok 1 - » | 21:55 | |
frew | rakudo: use Test; plan 1; is_deeply([1, 2), [1, 2]) | ||
rakudo: use Test; plan 1; is_deeply([1, 2], [1, 2]) | |||
p6eval | rakudo 496e1f: OUTPUT«Statement not terminated properly at line 1, near "([1, 2), ["current instr.: 'parrot;PGE;Util;die' pc 129 (runtime/parrot/library/PGE/Util.pir:86)» | 21:56 | |
rakudo 496e1f: OUTPUT«1..1ok 1 - » | |||
moritz_ | I guess is_deeply has no way to distinguish these | ||
frew | rakudo: use Test; plan 1; is_deeply((1, 2), (1, 2)) | ||
p6eval | rakudo 496e1f: OUTPUT«1..1ok 1 - » | ||
frew | hm. | ||
well isn't it supposed to be the same? | |||
moritz_ | not quite | ||
if you assign it to a scalar, (...) is promoted to a Capture (which is immutable) | 21:57 | ||
but [...] is a (mutable) Array | |||
frew | rakudo: my $foo = [1,2,3]; | 21:58 | |
p6eval | rakudo 496e1f: ( no output ) | ||
frew | why is that legal? | ||
rakudo: my $foo = (1,2,3); | |||
moritz_ | why shouldn't it be? | ||
p6eval | rakudo 496e1f: ( no output ) | ||
frew | well, I thought we didn't have references like we did in p5, so I figure that $foo = [1,2,3] kinda kills the point of sigils | ||
moritz_ | actually it's the other way round: we don't need Perl5esq references because everything is an object anyway | 21:59 | |
you can still use @a and %a to enforce particular types | |||
you can also write $a = [1, 2, 3]; is Perl 5 | 22:00 | ||
frew | rakudo: my $foo = [1,2,3]; $foo[1]; | ||
p6eval | rakudo 496e1f: ( no output ) | ||
frew | rakudo: my $foo = [1,2,3]; say $foo[1]; | ||
p6eval | rakudo 496e1f: OUTPUT«2» | ||
frew | so all @ really does is force it to be an array | 22:01 | |
moritz_ | it still does a little more | ||
for example 'my @a' is not only a type constraint | |||
but it instantiates an array object | |||
'my Array $x; $x.push(3)' wouldn't work, because there's no Array object in $x yet | 22:02 | ||
frew | weird... | ||
moritz_ | (unless by some magic autovivification; but it sure wouldn't work in the general case) | ||
frew | so $foo = [1,2,4] is like... a lightweight version | 22:03 | |
moritz_ | lightweight compared to what? | ||
frew | I dunno, the real object? | ||
moritz_ | the object in $foo is just a real array object like the one in @foo | ||
(when you do my @foo = 1, 2, 3;' | |||
frew | but not yet instantiated? | 22:04 | |
moritz_ | s/'/)/ | ||
sure it's instantiated | |||
frew | oooh | ||
sorry | |||
I didn't read what you said carefully enough | |||
that makes sense | 22:05 | ||
so my Array $a .= new; is equiv (more or less) to my @a; | |||
moritz_ | more or less, yes ;-) | 22:06 | |
there are still other effects that I forgot | |||
for example @a = ... imposes list context | |||
$a = ... imposes item context, even if there's an Array stored in $x | 22:07 | ||
frew | this making () and [] unnecessary | ||
mberends | oops, rakudobug sent, forgot to prefix subject with [BUG] | ||
frew | but ultimately this means that @ is much more sugar than it was before, correct? | ||
moritz_ | yes | 22:08 | |
rakudo: say (1, 2, 3).perl; say (1, [2, 3]).perl | |||
p6eval | rakudo 496e1f: OUTPUT«[1, 2, 3][1, [2, 3]]» | ||
moritz_ | # not quite unnecessary ;-) | ||
you *can* write Perl 6 like PHP, with only the $ sigil | 22:09 | ||
but it's not idiomatic, and not recommended | |||
frew | what does that even mean? | 22:10 | |
frew doesn't know PHP | |||
moritz_ | PHP uses $ on all variables | ||
frew | oooh | ||
moritz_ | they have a bit less syntax, and try to make up for it with more than 3000 functions in the default namespace ;-) | 22:11 | |
frew | yeah, I knew about that | ||
moritz_ | but ridiculing PHP is no fun; it's too easy | 22:12 | |
frew | I just think that something annoying could happen that could confuse people ( sub foo { return [1,2,3] }; my $bar = foo ) | ||
is there a way to avoid that? | |||
moritz_ | yes, return (1, 2, 3) instead ;-) | 22:13 | |
frew | will that give an error? | ||
moritz_ | no | ||
frew | but [] will give an error? | 22:14 | |
rakudo: sub frew { return [1,2,3]; } my $station = frew; say $station; | 22:15 | ||
p6eval | rakudo 496e1f: OUTPUT«Statement not terminated properly at line 1, near "my $statio"current instr.: 'parrot;PGE;Util;die' pc 129 (runtime/parrot/library/PGE/Util.pir:86)» | ||
frew | rakudo: sub frew { return [1,2,3]; }; my $station = frew; say $station; | ||
p6eval | rakudo 496e1f: OUTPUT«1 2 3» | ||
frew | rakudo: sub frew { return (1,2,3); }; my $station = frew; say $station; | 22:16 | |
p6eval | rakudo 496e1f: OUTPUT«1 2 3» | ||
frew isn't sure what the difference is | |||
pugs_svn | r26765 | moritz++ | [t/spec] set a few svn props | 22:17 | |
r26765 | moritz++ | | |||
r26765 | moritz++ | (git-svn)-- for not handling them, and svn-- for not having a sane default | |||
moritz_ | rakudo: sub a { (1, 2, 3) }; sub b { [1, 2, 3] }; for a { print "a" }; for b { print "b" }; | ||
p6eval | rakudo 496e1f: OUTPUT«Could not find non-existent sub forcurrent instr.: '_block14' pc 90 (EVAL_17:59)» | ||
moritz_ | rakudo: sub a { (1, 2, 3) }; sub b { [1, 2, 3] }; for a() { print "a" }; for b() { print "b" }; | ||
p6eval | rakudo 496e1f: OUTPUT«aaab» | ||
moritz_ | frew: that's the difference | ||
frew | weird... | 22:18 | |
so why doesn't for iterate over the list? | |||
because [] means list right? | |||
moritz_ | because [] means "a scalar holding an Array" | ||
and () means "a list" | 22:19 | ||
frew | ok | ||
got it. | |||
moritz_ | believe me, that has been confusing to all of us. | ||
frew | it's a little strange to my perl5 shaped brain, but one day I'll get used to it and maybe see the benefit | ||
do you grok it and dig it now? | |||
moritz_ | the basics | 22:20 | |
jnthn | [ 1, 2, 3 ] gives you a reference to an array. (1, 2, 3) gives you a list that will flatten. | 22:23 | |
moritz_ | don't mention references, you evil thing! | ||
frew | I'm just gonna stop thinking about it. | ||
jnthn | moritz_: Yeah, I know, but it's how it looks underneath. :-P | ||
22:24
sparc joined
|
|||
moritz_ | the problem with thinking in references is this: | 22:24 | |
rakudo: sub a(@b) { print "b" for @b }; a([1, 2, 3]) | |||
p6eval | rakudo 496e1f: OUTPUT«bbb» | ||
moritz_ | if we pass a reference in, where does the dereferncing happen? | 22:25 | |
jnthn | It doesn't, it's just a case of binding. | 22:26 | |
moritz_ | so binding dereferences? ;-) | ||
frew | zomg | 22:27 | |
frew is still confused | |||
don't explain to me | |||
I'm tired of thinking about it really | |||
jnthn | frew: It Just Works. ;-) | 22:28 | |
moritz_: Perhaps best to think of it is | |||
frew | I just think that putting an array in a scalar is confusing and maybe shouldn't work.... It just doesn't seem like something I'd ever want to do | ||
jnthn | rakudo: my @a = [1,2,3]; for @a { .say } | 22:29 | |
p6eval | rakudo 496e1f: OUTPUT«1 2 3» | ||
jnthn | rakudo: my @a := [1,2,3]; for @a { .say } | ||
p6eval | rakudo 496e1f: OUTPUT«1 2 3» | ||
jnthn | So it's not about binding. | ||
But note that the @ on the LHS puts the RHS in list context. | 22:30 | ||
A [...] doesn't interpolate into a list. | |||
mberends | rakudo: my $a = [1,2,3]; for $a { .say } | ||
jnthn | However, when you pass it as an argument, there's no list context stuff going on there. So the array reference just gets bound. | ||
p6eval | rakudo 496e1f: OUTPUT«1 2 3» | ||
jnthn | gah, I said reference again! | 22:31 | |
jnthn thinks we should write the dictionary of Perl 6 swear words. | |||
"length" :-O | |||
"reference" :-O | |||
frew | good idea | ||
jnthn | It wasn't mine. :-) | ||
.oO( if in dobut, disclaim all responsibility ) |
22:32 | ||
*doubt | |||
skids | .oO(if in donut, eat way out) |
22:50 | |
dalek | kudo: a27bbb6 | moritz++ | build/PARROT_REVISION: bump parrot revision to get Unicode identifiers in named arguments, chromatic++ |
||
jnthn | chromatic++ :-) | ||
rakudo: sub мат(:$добре) { say $добре ?? "ГРОВНО!" !! "ЕБАТ" }; мат(:добре); мат(:!добре); | 22:55 | ||
p6eval | rakudo 496e1f: OUTPUT«error:imcc:syntax error, unexpected USTRINGC, expecting STRINGC ('unicode:"\u0434\u043e\u0431\u0440\u0435"') in file 'EVAL_17' line 53error:imcc:syntax error, unexpected USTRINGC, expecting STRINGC ('unicode:"\u0434\u043e\u0431\u0440\u0435"') in file 'EVAL_17' line | ||
..56error:im... | |||
jnthn | Oh, too soon... | 22:56 | |
23:11
eternaleye joined
23:50
wknight8111 joined
23:55
japhb__ joined
|