Pugs t-shirts www.cafepress.com/pugscode | Pugs 6.2.9 released | pugscode.org | pugs.kwiki.org | paste: sial.org/pbot/perl6 | www.geeksunite.net Set by stevan on 15 August 2005. |
|||
svnbot6 | r6387 | putter++ | pugsbugs/parsing_do_my.t: do{my $a = 3; $a} yields Undeclared variable: "$a" | 00:01 | |
fglock_ | hi | 00:47 | |
Pugs has few people in my timezone span :( | 00:51 | ||
dudley | what timezone? I often feel the same way. (GMT -6) | 00:53 | |
fglock_ | GMT-3 | ||
I have some 'List' code that I think belongs to Prelude | 00:54 | ||
but I'm not sure I can place it there without breaking something | 00:55 | ||
dudley | Throw it in, there's always "svn revert" :) | ||
bbiab | 00:56 | ||
fglock_ | How can I load Pugs without the precompiled Prelude (I mean, recompiling Prelude) | ||
dudley | fglock_: if you turn it off in config.yml, does it recompile? | 01:06 | |
I thought I heard someone mention that a while back, but I've never tried it. | |||
fglock_ | (trying) | 01:07 | |
dudley: it should work, but it requires that Pugs be recompiled | 01:15 | ||
?eval (1,2,3).ref | 01:16 | ||
evalbotzy | ::Array | ||
fglock_ | is there a way to create a 'List' | ||
dudley | ?eval ::Array.isa(List) | 01:22 | |
evalbotzy | bool::true | ||
fglock_ | (!) | 01:24 | |
?eval my $x=List.new; $x.ref | |||
evalbotzy | ::List | 01:25 | |
fglock_ | he | ||
dudley | whoa, pugs just segfaulted | ||
gantrixx | so if an child object inherits all methods from the parent, can the methods be overwritten in the child or must they be defined in the parent as submethods? | 01:32 | |
fglock_ | gantrixx: the child class can override methods | 01:34 | |
dudley | I thought submethods weren't inherited... | 01:44 | |
fglock_ | submethods aren't inherited | 01:46 | |
dudley | Oh, you were saying define them as submethods so they won't be inherited. Nevermind. | ||
fglock_ | (or maybe I didn't understand the question, sorry) | 01:47 | |
I found that I can redefine 'Lazy' in Prelude. I don't know if this will break 'Array' yet | 01:48 | ||
dudley | Why do that in the Prelude? | 01:49 | |
I mean, why do you need to redefine 'Lazy' ? | |||
fglock_ | Lazy is not defined yet - it is actually a non-lazy list | 01:50 | |
I've written it as a module, but I'm trying to integrate it back in Pugs | |||
dudley | Ah. Right. | 01:51 | |
fglock_ | I can't have Haskell to call Lazy.new without messing with Pugs source, but I can redefine '..' to create a lazy list. | 01:53 | |
dudley | Why not mess with Pugs source? It just sounds like it would be more at home in the Pugs core than the prelude. | 01:57 | |
But then again, I have no idea what I'm talking about ;-) | 01:58 | ||
fglock_ | Prelude is portable - it gets compiled to PIR/PIR2, so it's one less thing to port to JS, P5, etc. | 02:02 | |
dudley | Good enough for me | 02:04 | |
fglock_ | native implementations would be more optimized | 02:06 | |
cool - (1..Inf).shift works!! | 02:12 | ||
I'll try to make it in one line for the evalbot | 02:13 | ||
?eval class Lazy{has Code $.cstart}multi infix:<..> (Int $a,Int|Num $b){my $i=$a;Lazy.new(cstart=>sub{my $tmp=$i;undefine $tmp if $tmp>$b;$i++;$tmp});}multi method shift (Lazy $x:) returns Any {return &{$x.cstart}();}say (1..Inf).shift; | 02:28 | ||
evalbotzy | 1 bool::true | ||
scook0 | ?eval my $Foo::3; $Foo::3 = 'hello'; say $Foo::3 | 02:44 | |
evalbotzy | hello bool::true | ||
scook0 | ?eval my $Foo::::::bar = 'goodbye'; say $Foo::::::bar | 02:48 | |
evalbotzy | goodbye bool::true | ||
fglock_ | I can't make '@a= **(1..10)' work (flatten lazy list) - I get 'Unknown syntactic construct: Syn "**"' | 02:52 | |
it was declared with 'multi prefix:<**> ( Lazy $x ) { $x.flatten }' | 02:54 | ||
scook0 | fglock_: it's parsing as a Syn, rather than as an App... | ||
fglock_ | what is a Syn? | 02:55 | |
scook0 | fglock_: (difficult to explain) | 02:56 | |
something that can't be represented by a sub call | |||
the point being that your multi doesn't even get considered | |||
(weird that there's no implementation for it though) | 02:57 | ||
fglock_ | I'll try another name - I can fix it later | ||
scook0 | fglock_: try going into Parser.hs, line 1121 | ||
, preSyn "* **" | 02:58 | ||
fglock_ | I can't recompile pugs here - too little ram :( | ||
scook0 | oh, ok | ||
fglock_ | I did it once - took 2 hours | 02:59 | |
scook0 | I wonder if there's a test for it? (probably not) | ||
fglock_: make unoptimised is faster | |||
I have 256MB, and unoptimised is at least tolerable (though still not fun) | 03:00 | ||
svnbot6 | r6388 | putter++ | JavaScript-FrontEnd/ARuntime.pm: the (very) humble beginnings of a JavaScript-on-p6 runtime. | 03:06 | |
scook0 | ?eval my $::x = 3; say $::x | 03:08 | |
evalbotzy | Error: unexpected ":" expecting word character or "::" Empty variable name | ||
dudley | what is Syn short for? | 03:12 | |
scook0 | "Syntactic Construct" | 03:13 | |
dudley | thanks | ||
03:21
autark is now known as jp-autark
|
|||
arcady | wow, soon we'll be able to run javascript on perl6 on javascript | 03:21 | |
fglock_ | redefining Lazy breaks Array, because @a=1..10 is the same as @a = $lazy, which creates an array with one element | 03:22 | |
scook0 | arcady: let me know when Perl 6 runs on an infinite stack of turtles :) | 03:23 | |
fglock_ | good night - time zone overflow :) | 03:30 | |
scook0 | ?eval $?PUGS_VERSION | 04:00 | |
evalbotzy | \'Perl6 User\'s Golfing System, version 6.2.9, August 3, 2005 (r6378)' | ||
svnbot6 | r6389 | scook0++ | More Parser refactoring: | ||
r6389 | scook0++ | * Introduced ruleDelimitedIdentifier to factor out common code | |||
r6389 | scook0++ | Also removed prefix-** from the list of Syn parsers, since it | |||
r6389 | scook0++ | was giving fglock trouble, and doesn't seem to be implemented | |||
r6389 | scook0++ | anyway | |||
gantrixx | If one object in one file inherits from another object in another file, do I have to do a "use ParentClass" ? | 04:16 | |
scook0 | gantrixx: I think so | 04:18 | |
(otherwise how else would it find it?) | |||
gantrixx | yes, it does | ||
ok, I think I know the problem. In order to use attributes from the parent class I have to use the $self.parentattrib correct? | 04:23 | ||
svnbot6 | r6390 | scook0++ | * Updated Parser docs to reflect refactoring | ||
r6390 | scook0++ | * Removed some dead code (killed by refactoring) | |||
gantrixx | or is that out of date now? | ||
because it says *** Undeclared variable: "$self" | |||
scook0 | well, $self isn't a special variable name | ||
try $?SELF | 04:24 | ||
gantrixx | what really is $?SELF? | ||
scook0 | (or explicitly naming your invocant) | ||
inside a method, $?SELF is the object that the method was invoked on | |||
like C++/Java's 'this' | |||
gantrixx | so do I also use @?SELF.attrib for an attribute that is an array? | 04:25 | |
scook0 | no, because that would imply that SELF is an array | 04:28 | |
svnbot6 | r6391 | putter++ | JavaScript-FrontEnd/ARuntime.pm: a few more bits. | ||
scook0 | you would just use $?SELF.attrib | ||
gantrixx | so $?SELF is a reference? Just like we would us $self in Perl5? | 04:29 | |
except this is built in | |||
scook0 | gantrixx: I think so | 04:30 | |
you can also use $self, provided you mention it in your method parameter list (like in P5) | |||
method foo($self: $x, $y, $z) | |||
gantrixx | ok, why does $SELF have a ? in it (i.e $?SELF ) | 04:31 | |
scook0 | I don't think people are actually supposed to use $?SELF directly (though they can if they want to) | ||
gantrixx: short answer: because it's special | |||
gantrixx | so is $_ | ||
scook0 | to avoid polluting the normal identifier namespace | ||
gantrixx | but it isn't $?_ | ||
scook0 | hmm | 04:32 | |
(maybe $_ is very special) | 04:33 | ||
either way, having to type $?_ would kind of defeat the point of having $_ | |||
gantrixx | I think that is one feature of Perl5 that I've heard complaints about. Perl5 is such that the code can become very cryptic. | 04:34 | |
scook0 | S02 mentions $? variables | 04:35 | |
(but curiously, S12 never mentions $?SELF) | 04:36 | ||
I don't think P6 will make it harder to write cryptic code | |||
but it should make it easier to write non-cryptic code | |||
(provided the person reading the code has actually bothered to learn the language) | 04:37 | ||
that's probably the main reason people say P5 is "hard to read" | |||
gantrixx | P5 can be hard to read, depends on the programmer | 04:38 | |
scook0 | yeah | 04:39 | |
some of that is because of the language, some of it is because of the programmer | |||
P6 is trying to remove the language-induced difficulty | |||
gantrixx | two things that can make P5 hard to read: 1) you can use cryptic symbols like $_ and 2) there is more than one way to write the same statement | ||
I had to maintain some code from a guy that wrote things in a very funny way. It always had me refering to the Camel book to figure out exactly what he was doing. It would have been soo much easier if he followed conventions. | 04:40 | ||
scook0 | reading retarded code is never fun | ||
I recently had to help someone try to read some nasty C++ | 04:41 | ||
gantrixx | One collegue was saying that is one of the strengths of Python, you don't have the flexibility to be retarded | ||
scook0 | gantrixx: you'd be surprised at what people are capable of | 04:42 | |
gantrixx | I'm not a Python programmer | ||
doesn't seem to be a big calling for it in the consulting biz, but there are a lot of open source guys using it these days | |||
scook0 | but it is true that Python, in general, makes it harder to write unreadable code | ||
(but not impossible) | |||
I mean, if you took the C++ program I was talking about | 04:43 | ||
and transliterated it into Python | |||
you'd still have no idea | |||
eventually I gave up on even trying to understand the code | |||
and just re-wrote it myself in P5 | |||
(my second-ever P5 program!) | 04:44 | ||
gantrixx | In my experience it is more important to be "wordy" and explicit in your code (making it easier to maintain for the sucker who inherits it) than to try to be tricky and compact with everything | ||
I've rewritten code that I couldn't understand before also | |||
scook0 | well I didn't so much re-write it as re-implement it from scratch | 04:45 | |
putter | autrijus: re compiling javascript to javascript... for completeness I'll note that while js on p5, and js on haskell, might actually be useful, the real motivation for starting the js frontend was really to get the first p6 language "pass-thru"? started. ie, js on p6 on PIL2JS. ;) | ||
scook0 | the problem with being 'wordy' | 04:46 | |
is that sometimes you end up with a lot of code that is easy to read line-by-line | 04:47 | ||
but just as incomprehensible as a whole | |||
gantrixx | well yes, there is such a thing as over-kill | ||
scook0 | that's the problem I run into with Python and Java | 04:48 | |
the languages prevent you from doing complex things | |||
but the complexity has to go somewhere | |||
so your program ends up much more difficult to follow | |||
putter | Java has nifty code policy checkers and transformers. P6 will probably need them too. | ||
gantrixx | So far P6 syntax seems pretty nice. I start a new P5 contract on 8/29. It will be a shame to go backwords. | 04:50 | |
scook0 | the main reason I became interested in P6 was that I was always interested in Perl as a concept | ||
putter | Picture the most horrible p5 code you've seen, then add macros, unicode, junctions, etc. It will be quite easy for the tasteless to create something _truely_ unreadable. | ||
scook0 | but I had heard some nasty things about it in reality | ||
gantrixx | I'm interested in P6 because I'm interested in a long life for Perl. I'd like to see Perl as much of a staple as C/C++ | 04:51 | |
scook0 | putter: but these features also make it possible to write more readable code, /if/ you're trying in that direction | 04:52 | |
gantrixx | long life is a big selling point for many clients | 04:53 | |
scook0 | gantrixx: I think P6 will have a long life -- look how long it's been going for already :) | ||
putter | scook0: yes. but p6 does provide better tools for writing incomprehensible code. so a question is, what are the concequences? will CPAN need a stylecheck barrier? will corporations need to see a readable cannonical form to avoid them discarding p6 as unmaintainable? what other issues does it raise...? | 04:56 | |
scook0 | putter: interesting points... | 05:00 | |
I think there was some mention of 'policy modules' | |||
putter | that would be neat. | 05:01 | |
scook0 | so you could ensure your code contains no macros, no junctions and no unicode operators | ||
gantrixx | OK, here is a funny one. If I want to set attributes in a child class that it inherited from teh parent class, how do I do that? | ||
scook0 | just by saying "use FooCorp::CodingStandard" | ||
putter | and rules + PIL will allow some powerful games. | ||
scook0 | gantrixx: in a method in the child class? | 05:02 | |
I think you just do $?SELF.inherited_attr = val | |||
(I think a lot of the fine details of OO are still up in the air, so some of this is me guessing) | 05:03 | ||
gantrixx | No I mean BlackJack::Card.new( name=>$name, suit=>$suit) but $.name and $.suit come from PlayingCard::Card with BlackJack::Card inherits | ||
scook0 | gantrixx: are you trying to set them explicitly or implicitly? | 05:04 | |
putter | scook0: googling for perl6 policy.module didnt turn up much. any other phrases that come to mind? | 05:05 | |
gantrixx | I'm trying to set them as you see above | 05:06 | |
scook0 | putter: there's a mention of "policy" modules at www.perl.com/pub/a/2005/04/p6pdiges...50403.html | 05:07 | |
but that may not be what I'm thinking of | |||
(It could be that I misinterpreted the term, and invented the concept myself) | 05:08 | ||
but either way it's useful functionality | |||
dudley | scook0: I definitely remember hearing talk of it before, so it's not entirely in your head :) | 05:09 | |
putter | scook0: thanks. :) | 05:12 | |
putter is reassured that our fearless leaders are sufficiently insane to make p6 very nifty... | |||
dudley doesn't think the insanity of our fearless leaders was ever in doubt... | 05:14 | ||
putter | ;) | 05:15 | |
dudley | Anybody here know Scala? | ||
putter | I skimmed it, but nothing more. | 05:16 | |
dudley | I'm wondering if there's a way to work around Scala not allowing type synonyms at top level | 05:17 | |
putter | arg, (non-html language specs)-- sorry, no idea. | 05:19 | |
end of day. good night all. & | 05:20 | ||
dudley | good night | ||
gantrixx | Is there a way to list all the attributes of an object? | 05:21 | |
scook0 | gantrixx: you'd need introspection for that | 05:24 | |
it probably will be possible | |||
but I doubt it's implemented | |||
gantrixx | I'm just thinking for debugging purposes it might be nice | 05:25 | |
you know to make sure it inherits what it was supposed to inherit | 05:26 | ||
dudley | For debugging and for IDE/automated refactoring stuff, too | ||
gantrixx | vi is my IDE | ||
I'm a hammer and chissle guy | 05:27 | ||
dudley | emacs is mine | ||
scook0 | I like IDEs in theory, but in practice they tend to bug me | ||
dudley | I'm a thermonuclear jackhammer guy | ||
scook0: Me too. Eclipse is incredibly annoying. | 05:28 | ||
scook0 | I'm content with any editor with a decent GUI and syntax highlighting | ||
emacs is another thing I like in theory, but can't stand in practice | |||
dudley | It has so much potential and does so many things well, but the whole package just doesn't quite do it. | 05:29 | |
gantrixx | gvim does syntax highlighting | ||
scook0 | If there was a version of emacs that followed modern GUI conventions, I'd be all over it | ||
gantrixx | it would be cool if gvim would implement tabbed editing | ||
dudley | emacs is pretty much the least of a near-infinity of evils | ||
scook0 | I'm using GEdit at the moment | ||
gantrixx | if vi = hammer + chissel, notepad = chopsticks | 05:30 | |
dudley | I can't use emacs in a GUI. It drives me absolutely nuts. | ||
scook0 | gantrixx: notepad = one chopstick | ||
it's 2005, people should at least be using editors that indent new lines for you | 05:31 | ||
gantrixx | I just don't see how notepad is even useful for anything | ||
scook0 | well, notepad is literally just a textbox with load/save dialogs | 05:32 | |
can't even handle unix newlines :( | |||
gantrixx | If you get an "error line 32", try using notepad to find the error, it's difficult | 05:33 | |
it doesn't wrap lines | |||
it's a real hinderance | |||
scook0 | but it's the only plain-text-editor you get out-of-the-box on windows | 05:34 | |
dudley | isn't there an 'edit' or something in dos? | 05:35 | |
mugwump | edlin++ | ||
gantrixx | when I'm forced to use a windows box, I usually spend a day loading the win32-gnu tools, gvim, virtual desktop manager, firefox, etc | 05:36 | |
mugwump | I think they dropped it in about DOS 4.0 though ;) | ||
gantrixx | oh, and activestate perl5 | ||
scook0 | 'edit' still works on my XP box | ||
in fact, unlike notepad it will automatically keep your indentation level when you go to a new line | 05:37 | ||
mugwump | mmm.... "edlin" was very similar to UNIX "ed", a fine editor when your /usr is offline | ||
scook0 | I had to use 'ed' the other day | ||
in a shell script for a uni assignment | 05:38 | ||
but I certainly wouldn't want to try regular editing with it | |||
gantrixx | it is a bit surprising that MS doesn't include some of the free stuff | 05:39 | |
what would it hurt if they offered BASH as a command line interpreter? | 05:40 | ||
I really don't see how that would hurt there business strategy | |||
scook0 | speaking of which, I wonder what the 'Monad' shell thingy is like... | ||
gantrixx: probably more of an ideological/cultural thing | 05:41 | ||
nothingmuch | morning | 06:19 | |
dudley | morning | 06:21 | |
nothingmuch | Devel::TypeCheck is out | ||
or at least should be out soon | 06:22 | ||
search.cpan.org/~bargle/ | |||
xinming | Is there a method for Array which will help Join the array into string? | 06:59 | |
oops. just now, I asked this In #perl, And someone is sticking on my question with perl 5 grammer. :-) | |||
I know as, .as('%03d', ', ') which will mean if you get the element of from a array "slot", it will be formated as `$(%03d),` But Do I have to join them myself? | 07:00 | ||
* DeathWo1f has quit (Remote closed the connection) | |||
arcady | there is "join", isn't there? | ||
xinming | arcady: yes, What I want to know is, if there a "built-in" join for Array. | 07:01 | |
arcady | what do you mean? | ||
@a.map { .as("%03d") }.join(", ") or something like that | 07:02 | ||
xinming | arcady: ... | ||
arcady: I mean, It will hold a string "internally"... | 07:03 | ||
arcady | okay, I'm not getting what you mean by that | 07:04 | |
xinming | arcady: I can't turning the way of thinking sometimes. :-( | 07:05 | |
s/turning/turn/ | 07:06 | ||
arcady | so wait, what exactly needs to be holding a string internally? | 07:07 | |
scook0 | what about [~] ? | 07:08 | |
arcady | oh yes, that works | 07:09 | |
is there a >>.<< ? | |||
scook0 | arcady: huh? | 07:10 | |
xinming | arcady: some time, If you don't wish to declare a scalar to hold the "slurped" array yourself. | ||
This is the problem I ever encountered... hmm, But, From my poor Programming experience. This might not be necessary really... :-) | 07:11 | ||
arcady | scook0: apply a method to each element of an array | 07:14 | |
scook0 | arcady: there's @foo Ā».bar | ||
(don't think its implemented yet) | |||
which will call .bar on each elem of @foo | |||
xinming | my @ary; @ary.as("abc: %s"); my $slurped := @ary.scalar; And then, Every time you push a element into the array, you won't need to join yourself... and also, Every time you modify the one of the elemts in the array, The $slurped varaible will get the new result. | 07:15 | |
arcady | that's... way too much magic that is happening there, I think | ||
scook0 | I would recommend something like: | 07:17 | |
arcady | scook0 I think they've decided on not having >>(op) or (op)<< and just having >>(op)<< | ||
otherwise it's just unparseable | |||
scook0 | arcady: really? when was this? | ||
xinming: instead of having a scalar, you could have a sub | 07:18 | ||
my &slurped = { @ary.scalar } | 07:19 | ||
(or whatever) | |||
then when you call slurped() | |||
it has the most up-to-date value | |||
arcady | ?eval (1,2,3)>>+<<2 | ||
evalbotzy | (3, 4, 5) | ||
arcady | ?eval (1,2,3)>>+2 | ||
evalbotzy | Error: unexpected ">" expecting term postfix, operator, postfix conditional, postfix loop, postfix iteration, ";" or end of input | ||
xinming | ?eval (1, 2, 3) >>+ 2 | ||
evalbotzy | Error: unexpected ">" expecting operator, postfix conditional, postfix loop, postfix iteration, ";" or end of input | ||
arcady | it may not have been decided but it is the current state of things | 07:20 | |
scook0 | ?eval -Ā« [1, 2, 3] | ||
xinming | ?eval (1, 2, 3) <<+ 2 | ||
evalbotzy | -3 | ||
Error: unexpected "<" expecting operator, postfix conditional, postfix loop, postfix iteration, ";" or end of input | |||
arcady | ?eval -<< (1,2,3) | ||
evalbotzy | (-1, -2, -3) | ||
scook0 | ?eval (-Ā« [1, 2, 3]).say | ||
evalbotzy | -3 bool::true | ||
arcady | whoa | ||
scook0 | oh, oops | ||
arcady | ?eval 2 +<< (1,2,3) | ||
evalbotzy | Error: unexpected "<" or "+" expecting operator, postfix conditional, postfix loop, postfix iteration, ";" or end of input | ||
arcady | oh | 07:21 | |
nothingmuch | morning | ||
arcady | that makes sense | ||
scook0 | opĀ« is for prefix ops | ||
arcady | morning | ||
yes | |||
scook0 | Ā»op is for postfix | ||
Ā»opĀ« is for infix | |||
arcady | so which one is .? | ||
scook0 | arcady: . is postfix | 07:22 | |
or postcircumfix | |||
(can't remember) | |||
arcady | no, definitely not postcircumfix | ||
that's like [] | |||
xinming | ?eval my $lval; sub get { return $lval }; sub set () is rw { $lval }; set = 100; my $t = get; $t.say; | ||
evalbotzy | 100 bool::true | ||
xinming | ?eval my $lval; sub get { return $lval }; sub set () is rw { $lval }; set = 300; my $t = get; $t.say; | ||
evalbotzy | 300 bool::true | ||
scook0 | I don't think the . itself is considered an operator | 07:23 | |
I believe the whole .meth(args) is considered postfix | |||
nothingmuch | it isn't | ||
arcady | oh | ||
nothingmuch | scook0: you're right | ||
nothingmuch forgot the dvi-vga converter at home =( | 07:24 | ||
no second monitor today | |||
scook0 | nothingmuch: awww | ||
nothingmuch | yeah | ||
scook0 | dual-monitors is great fun | ||
nothingmuch is very very spoiled with his montiro | |||
monitors | |||
xinming | so, anyone here can give ma example to compose these two functions into one? | ||
nothingmuch | a 17" powerbook + 17" samsung LCD | 07:25 | |
xinming | and, also, without declaring a my $lval outside. | ||
nothingmuch | the samsung is not the best monitor in the world, but it's pretty good | ||
scook0 | xinming: you mean 'as' and 'join'? | ||
nothingmuch | xinming: 'state $lval;' | ||
xinming | scook0: No... | ||
nothingmuch | but that'll only work for one sub | ||
xinming | ?eval my $lval; sub get { return $lval }; sub set () is rw { $lval }; set = 300; my $t = get; $t.say; | ||
evalbotzy | 300 bool::true | ||
scook0 | oh, sorry, I didn't see your evalbot stuff | ||
nothingmuch | ?eval sub value is rw { state $lvalue; $lvalue }; value = 100; my $v = value; $v.say; | 07:26 | |
evalbotzy | Error: Can't use readline() or getc() in safemode. | ||
nothingmuch | ?eval sub value is rw { state $lvalue; $lvalue }; value = 100; my $v = value; $v | ||
evalbotzy | Error: Can't use readline() or getc() in safemode. | ||
nothingmuch | huh? | ||
?eval my $lvalue; sub value is rw {$lvalue }; value = 100; my $v = value; $v | |||
evalbotzy | Error: Can't use readline() or getc() in safemode. | ||
nothingmuch | wtf am I doing wrong? | ||
xinming | what does the keyword state do? It seems it doesn't appear in synopsis. | ||
nothingmuch | xinming: state is like static in C | ||
scook0 | it keeps its value between sub calls | 07:27 | |
nothingmuch | where in perl 5 you said 'my $var; sub routine { $var ||= $initial_value; ... }' you can now say 'sub routine { state $var = $initial_value } | ||
xinming | nothingmuch: If so, The space of the var for state will never be freed, right? | ||
nothingmuch | hmm | 07:29 | |
maybe in a closure, once the closure is freed so is the value | |||
xinming | In this case, I think the sub should be declared with my or our... | ||
or my | 07:30 | ||
nothingmuch | yeah, if you say 'my sub routine { state $x = some_func() }' then $x should be reset at scope exit, i would guess | ||
xinming | nothingmuch: But this hasn't been supported in pugs. :-) | 07:32 | |
nothingmuch | i don't think pugs has reached this level of detail yet | ||
xinming | nothingmuch: What's null key really in perl 6? | 07:34 | |
nothingmuch | null key? | ||
xinming | nothingmuch: ( => 'value' ) | ||
nothingmuch | that's a syntax error, i think | 07:35 | |
xinming | And how to I access it? or in perl 6, I won't be parsed. | ||
nothingmuch | you can say undef => 'value' | ||
then it's a pair with the left side being undef | |||
if your hash's shape is told to store more than just strings, than you can say my %hash = (undef => 'value'); | |||
and then just %hash{undef}; | |||
xinming | ?eval ( undef => 'value' ); | ||
evalbotzy | ('undef' => 'value') | ||
nothingmuch | oh wait, that autoquotes | 07:36 | |
xinming | ?eval ( => 'value' ); | ||
evalbotzy | Error: unexpected ">" expecting term | ||
xinming | ?eval { undef => 'value' ); | ||
evalbotzy | Error: unexpected ")" expecting operator, term postfix, postfix conditional, postfix loop, postfix iteration, ";" or "}" | ||
xinming | ?eval { undef => 'value' }; | ||
evalbotzy | {('undef' => 'value')} | ||
nothingmuch | ?eval Pair.new(undef, 'value') | ||
evalbotzy | Error: Must only use named arguments to new() constructor | ||
nothingmuch | damnit, now to find Pair.new | ||
scook0 | ?eval (undef) => 'value' | ||
evalbotzy | (undef => 'value') | ||
scook0 | woo! | ||
nothingmuch | scook0++ | 07:37 | |
scook0 | you just have to circumvent the parser's cleverness | ||
in fact, you'd have to do that for any bareword-function-call | 07:38 | ||
xinming | ?eval my %h = { (undef) => 'value' }; my $b := %h{undef}; $b = "test"; %h.kv; | ||
evalbotzy | ('', 'test') | ||
scook0 | ?eval sub bob {3}; bob => 'value' | ||
evalbotzy | ('bob' => 'value') | ||
xinming | Is an empty string undef? | 07:39 | |
scook0 | ?eval sub bob {3}; (bob) => 'value' | ||
evalbotzy | (3 => 'value') | ||
scook0 | ?eval ~(undef) | ||
evalbotzy | '' | ||
xinming | or, is (undef) an empty string | ||
scook0 | when you stringify (undef), it turns into ''. | ||
?eval defined('') | 07:40 | ||
evalbotzy | bool::true | ||
scook0 | ?eval defined(undef) | ||
evalbotzy | bool::false | ||
xinming | scook0: How to I preserve the undef ? | ||
scook0: the example I used above | |||
scook0 | xinming: you would need a hash that can accept keys that are not strings | 07:41 | |
at the moment, it automatically turns all key values into strings (I think) | |||
no easy way to preserve the undef at the moment | |||
xinming | scook0: So, the hash in perl, will hash key not accept the non-string object by default? | 07:42 | |
scook0 | xinming: I think that is the default | ||
you will be able to specify hashes that can have other values | |||
but it's not implemented | |||
xinming | scook0: hmm, I know, we can use my %hash is MyHash syntax. | 07:43 | |
scook0 | xinming: you can also use my %hash is shape(Any) -- see S09 | ||
now that I think about it, I'm not sure whether or not hashes should accept undef... | 07:44 | ||
but that would be getting into not-specced-yet territory anyway (re: typed undefs) | 07:45 | ||
xinming | ?eval "my $a; $a = 5; $a.say".eval; | 07:54 | |
evalbotzy | Error: Undeclared variable: "$a" | ||
xinming | will this be valid in perl 6? | ||
nothingmuch | xinming: use '' | 07:55 | |
?eval 'my $a; $a = 5; $a.say'.eval | |||
evalbotzy | 5 bool::true | ||
xinming | ... | ||
forgot the qq and the q. ;-) | |||
nothingmuch | what you wrote is like ("my " ~ $a ~ "; " ~ $a ~ " = 5; " ~ $a.say).eval | 07:56 | |
xinming | nothingmuch: yes, I know, I just forgot to use '' instead of "" | ||
nothingmuch wants lunch to arrive | 07:57 | ||
xinming wants money to fall from the sky. | 08:01 | ||
webmind | that'll be bad for inflation | 08:02 | |
:) | |||
xinming knows the it's bad for inflation, so xinming might want beauty instead... | 08:04 | ||
s/the// | 08:05 | ||
hmm, May I ask a non-perl6-related question here? | 08:13 | ||
autrijus | you just asked one | 08:15 | |
and the answer is yes | |||
xinming | blogs.msdn.com/danlehen/archive/200...46259.aspx | 08:16 | |
and search for the string | |||
That is truly one of the most amazing things | |||
in the comment. | |||
search "That is truly one of the most", I wonder if there are really funny comments written in English there. :-) | 08:17 | ||
autrijus | it's mildly funny yes :) | ||
xinming | autrijus: You can understand Chinese. and There are many such comments written in Chinese. So, I wonder If there is such comment which written in English. Except this one. | 08:18 | |
大åøēčÆēå¦ā大é³åø声ę«é“ēæ³āļ¼ē¹å¦āęØå¼äŗé¾č§é天āļ¼ä½æęēē½ę°ēå°äŗåøęļ¼ēå°äŗęŖę„ļ¼ę“天é¹é³ļ¼ééē锶ęč®øäøč¶³ä»„å½¢å®¹å¤§åøęē« ēäøäøļ¼å·«å±±č”äŗļ¼éæę±ęµę°“ę“é¾ä»„ęÆę大åøēęęļ¼é»é大åļ¼ęÆčåč©ļ¼ä½ ēē §å¤©äøļ¼ęč§äøéļ¼éØé²čēļ¼ę³½č¢«äøę¹ļ¼éčæä½ ę·±éēęåļ¼ęä»æä½ēå°äŗä½ é¹°č§ē¼é”¾ļ¼é¾č”čę„ēä¼å²øč±å§æļ¼ä»æä½ | 08:20 | ||
ēå°äŗä½ ęę§å¦ę¤½å¤§ē¬ļ¼å天äøęē« ēęŗę §ē„ęļ¼ä»æä½ēč§äŗä½ ęåå锾ļ¼ę±å±±ę ę°ēč±ę¦ę°ę¦ļ¼ | |||
autrijus | xinming: yow. | 08:22 | |
autrijus rushes to /clear | |||
xinming | That's just copy and past... | ||
... | |||
autrijus | xinming: I've read enough text that praises Chiang Kai Shek and Mao... please spare me further things like this :) | 08:23 | |
xinming | autrijus: hmm, I think I would prefer seeing the finish of pugs rather than read these articles. :-) | 08:24 | |
autrijus | riiight. | 08:25 | |
autrijus goes back to hack | |||
Supaplex feeds xinming /dev/urandom until his $TERM goes *poof* | 08:48 | ||
xinming | Supaplex: Hmmm. Sorry... | 08:49 | |
Supaplex | heh, tiz ok. | ||
I use to enjoy meannacing peeps IRC sessions with chunks of /dev/urandom or beeps (^G aka ) hehe. | 08:50 | ||
revdiablo | heh, actually xinming's paste showed up fine in my client+terminal. looks kinda neat. | ||
I even have a font with all the glyphs | 08:51 | ||
xinming | Supaplex: Do you wish to hear the sound of the kernel? :-) | ||
Supaplex: cat /proc/kcore > /dev/dsp | |||
Supaplex | haha | ||
xinming | ?eval class C { has $.a = 1; }; | 08:52 | |
evalbotzy | Error: unexpected "=" expecting trait, "handles", ";" or "}" | ||
Supaplex | I'm enjoying knobtweakers.net tracks too much to listen to the kernel atm. | ||
xinming | Can pugs use the all the perl 5 libs for now? | 08:53 | |
maybe most... Infact. | |||
autrijus | xinming: only if you link against perl5 when building pugs, and there are known problems with certain XS modules like DBD::Pg. | 08:56 | |
Supaplex | what a shame | 08:58 | |
autrijus | indeed; which is why we are working toward compiling to perl5 code. | 09:00 | |
then you can work with any perl5 code. | |||
xinming | running perl 5 code is "a bit" too slow... | 09:06 | |
autrijus | xinming: for what purposes? | ||
xinming | autrijus: hmm, I just now try to use "use CGI", And It seems it will slowly finsihed... :-) | 09:07 | |
autrijus: well, I know it's not perl 6 really, I just do some practising. :-) | 09:08 | ||
autrijus | xinming: oh... but it's perl6's CGI | ||
if you want to use perl5 CGI, you need to say | |||
use perl5:CGI; | |||
xinming | In fact, use CGI works also. at least, run at the same speed. | 09:09 | |
autrijus: by the way, Is there any difference between fun_call.say and fun_call().say ? | |||
?eval f { 'test' }; f().say; | 09:10 | ||
autrijus | xinming: if &fun_call is in scope | ||
evalbotzy | Error: No compatible subroutine found: "&f" | ||
autrijus | then no, no difference. | ||
xinming | ?eval sub f { 'test' }; f.say; | ||
evalbotzy | 'test' | ||
xinming | ?eval sub f { 'test' }; f().say; | ||
evalbotzy | test bool::true | ||
xinming | autrijus: But in fact, here we got the different result. | 09:11 | |
autrijus | wow... a bug. | ||
write tests :) | |||
f.say is somehow parsed as f(say()). | |||
xinming | autrijus: :-) Well, I will record all the bugs I now encountered. And will write the test after I "finished" learning perl 6. | 09:13 | |
scook0 | (wow, the parser is just chock full of redundancy...) | 09:18 | |
xinming | In perl 5, If you say "use Data::Dumper", But In perl 6, it doesn't works, so what the differences between "use Data::Dumper" and "use Data:Dumper" are? | 09:19 | |
scook0: well, that's better than nothing. :-) | |||
scook0: for me, At least I can learn how to use perl 6 programming in "real" world. | |||
scook0 | xinming: ooh, that's a good one :) | 09:20 | |
and I'm working on getting rid of some of it | |||
xinming | hmm, Ok, Just go ahead, I will try to figure out the difference between Data::Dumper and Data:Dumper myself. :-) | 09:21 | |
masak | how come practically all of my tests fail? | 09:23 | |
xinming | ?eval my $var =3; $var *= (5, 9); $var.say; | 09:28 | |
evalbotzy | 6 bool::true | ||
xinming | hmm, Why It is 6 please? | ||
revdiablo | ?eval +(5,9) | 09:29 | |
evalbotzy | 2 | ||
integral | is it the , or the () that is the list constructor? | 09:30 | |
scook0 | integral: , is the list constructor | ||
integral | ok | ||
scook0 | but because of precedence, most of the time you need () also | ||
hence the confusion | |||
xinming | ?eval my $var =5; $var *= (5, 9); $var.say; | ||
evalbotzy | 10 bool::true | ||
integral | I thought the precedence had been "fixed" in perl6? | ||
ie , is now above = ? | |||
scook0 | integral: some people want that | 09:31 | |
but last I heard it was still the same | |||
integral | oh, ok. I thought it was a done deal ages ago | ||
scook0 | it really should be changed though | ||
iirc, the only reason to stay the same was so you can do parallel processing in C-style loops | 09:32 | ||
(which is a pretty bogus reason, if you ask me) | |||
integral | which are now decidedly not C-style now ;) | ||
xinming | ?eval my $var; say $var; | 09:34 | |
evalbotzy | bool::true | ||
integral | xinming: what did you mean when you said "use Data::Dumper" didn't work in perl6? | 09:35 | |
xinming | integral: Sorry, I was wrong. :-) | 09:40 | |
integral | oh | ||
xinming | integral: But Is there any difference between using : and ::? | ||
integral | :: separates namespaces, but : separates attributes | 09:41 | |
xinming | hmm, who update the CGI.pm in blib6/lib/ by the way? | 09:55 | |
Just try 'use CGI;' | |||
svnbot6 | r6392 | scook0++ | * Merge some more parser redundancy | 10:13 | |
r6392 | scook0++ | * Oops, ruleDelimitedIdentifier shouldn't use lexeme identifiers | |||
r6392 | scook0++ | * ruleDelimitedIdentifier now matches leading delimiters | |||
10:39
autark is now known as jp-autark
|
|||
xinming | ?eval NaN | 10:41 | |
evalbotzy | NaN | ||
xinming | ?eval +NaN | ||
evalbotzy | NaN | ||
xinming | ?eval "test'~NaN | ||
evalbotzy | Error: unexpected "t" expecting block, "\\", "$!", "$/", "$" or "\"" | ||
xinming | ?eval ~NaN | ||
evalbotzy | 'NaN' | 10:42 | |
xinming | ?eval 'test' ~NaN | ||
evalbotzy | 'testNaN' | ||
coral | ?eval int(NaN) | 10:47 | |
evalbotzy | -269653970229347386159395778618353710042696546841345985910145121736599013708251444699062715983611304031680170819807090036488184653221624933739271145959211186566651840137298227914453329401869141179179624428127508653257226023513694322210869665811240855745025766026879447359920868907719574457253034494436336205824 | ||
coral | it's negative now? | ||
oh, that was Inf. n/m | |||
arcady | ?eval int(Inf) | 10:53 | |
evalbotzy | 179769313486231590772930519078902473361797697894230657273430081157732675805500963132708477322407536021120113879871393357658789768814416622492847430639474124377767893424865485276302219601246094119453082952085005768838150682342462881473913110540827237163350510684586298239947245938479716304835356329624224137216 | ||
xinming | I think, Perl will be a language which will stop people from going deeper... :-S | 11:01 | |
anyone here would explain this for me? `'test' ~NaN` `"test'~NaN` | 11:03 | ||
scook0 | ?eval "test" ~ NaN | 11:08 | |
evalbotzy | 'testNaN' | ||
scook0 | ?eval 1/0 | 11:09 | |
evalbotzy | Error: Illegal division by zero | ||
xinming | in fact, ~ should be a infix:<~> But, with default "infix" operator, there should be no space before or after the operator. | 11:10 | |
user defined infix:<~> must have space... | |||
don't know if I am right. | 11:13 | ||
scook0 | ?eval "test"~NaN | ||
evalbotzy | 'testNaN' | ||
scook0 | (in your example, you mismatched " and ') | 11:14 | |
xinming | ... | 11:16 | |
@_@ | |||
carelessness is a bad thing really. :-) | |||
?eval my $a = 1 but false; $a.bit; | 11:18 | ||
evalbotzy | Error: No compatible subroutine found: "&false" | ||
xinming | ?eval my $a = 1 but not true; $a.bit; | 11:19 | |
evalbotzy | Error: unexpected "t" expecting block construct, ":", term, term postfix, operator, "does", "but", "is", "^..^", "cmp", "<=>", "^..", "..^", "..", ";" or end of input | ||
scook0 | actually, if there's confusion between infix and postfix operators, the infix must have a space, and the postfix must not | ||
(but I don't think any built-in operators will be ambiguous that way) | |||
xinming | ?eval my $a = 0 but true; $a.bit; | 11:20 | |
evalbotzy | Error: unexpected ";" expecting term | ||
xinming | ?eval my $a = 0 but true ; $a.bit; | ||
evalbotzy | Error: unexpected ";" expecting term | ||
xinming | scook0: 1+5 here, IMHO this should be clear with "user defined" operator. just like, 1 + 5 will use the user defined operator. | 11:22 | |
and 1+5 will call the "perl 6" operator | |||
scook0 | no, I don't think so | ||
what I was talking about is if you have: | 11:23 | ||
infix:<++> and postfix:<++> | |||
then you might have to write | |||
$a++ | |||
or | |||
$b ++ $c | 11:24 | ||
but not '$a ++' or '$b++$c' | |||
(I think that's right...) | |||
xinming | hmm, then, How to call the "default" postfix:<++> | ||
scook0 | xinming: not sure what you mean by "default" | 11:25 | |
are you talking about user-defined vs. built-in operators? | 11:26 | ||
xinming | scook0: yes, built-in operator. | ||
scook0 | hmm | ||
normally I don't think you would replace the built-in ones | 11:27 | ||
you would just add new versions for your own classes/types | 11:28 | ||
(though you probably could change the built-in ones if you REALLY wanted to) | |||
xinming | scook0: hmm, by the way, Do you mean the operator can be... infix:<MINE_+> ? | 11:29 | |
or infix:<mine-> | |||
scook0 | xinming: you want to be able to write `3 MINE_+ 4`? | 11:30 | |
or are you talking about `MyClass.new + MyClass.new` | 11:31 | ||
xinming | scook0: the first example. | ||
if It's able to apend some letters to define a operator. | |||
scook0 | you can define new operators using whatever symbols you want | 11:33 | |
even unicode | |||
xinming | ?eval true; | ||
evalbotzy | Error: unexpected ";" expecting term | ||
xinming | scook0: thanks. | ||
?eval true(); | |||
evalbotzy | Error: No compatible subroutine found: "&true" | ||
xinming | ?eval true(1); | ||
evalbotzy | bool::true | ||
scook0 | ?eval sub infix<ā>($a, $b) { $a + $b + 1 }; 1 ā 1 | 11:34 | |
evalbotzy | Error: unexpected "<" expecting word character, "::", bare trait, subroutine parameters, trait or block | ||
scook0 | ?eval sub infix:<ā>($a, $b) { $a + $b + 1 }; 1 ā 1 | ||
evalbotzy | 3 | ||
xinming | :-) | 11:35 | |
?eval sub infix:<puls>($a, $b) { $a + $b + 1 }; 1 puls 1 | |||
evalbotzy | 3 | ||
xinming | ?eval sub infix:<puls>($a, $b) { $a + $b + 1 }; 1 puls 5 | 11:36 | |
evalbotzy | 7 | ||
xinming | amazing. :-) | ||
?eval sub func; | 11:44 | ||
evalbotzy | Error: unexpected ";" expecting word character, "::", bare trait, subroutine parameters, trait or block | ||
xinming | ?eval sub func{ }; | ||
evalbotzy | undef | ||
xinming | ?eval sub func{ ... }; | ||
evalbotzy | undef | ||
xinming | ?eval sub duplicate($n, *%flag, *@data) {...} | 11:54 | |
evalbotzy | undef | ||
xinming | evalbotzy: sub duplicate($n, *%flag, *@data) {...} | ||
evalbotzy: ?eval sub duplicate($n, *%flag, *@data) {...} | 11:55 | ||
?eval -> $a { ... }; | 11:57 | ||
evalbotzy | sub {...} | ||
xinming | If I want to use role and grammar things, Do I have to use PUGS_EMBED="perl5 parrot" | 12:04 | |
mugwump | you don't need either; parrot can be in your PATH | 12:05 | |
it starts a parrot subprocess and talks to it via pipes... | |||
xinming | mugwump: hmm, I mean, Do I have to compile parrot? | ||
mugwump | If you want to use Perl 6 rules, and not just PCRE, yes. | 12:06 | |
xinming | mugwump: thanks | ||
?eval sub fun will do { 'will'.say } { 'main'.say }; fun(); | 12:07 | ||
evalbotzy | Error: unexpected "w" expecting bare trait, subroutine parameters, trait or block | ||
xinming | ?eval sub function { caller; }; function(); | 12:10 | |
evalbotzy | Control::Caller.new(('file' => '<eval>'), ('line' => 1), ('package' => 'main'), ('sub' => undef), ('subname' => undef), ('subtype' => undef)); | ||
xinming | ?eval sub function { caller Sub; }; function(); | 12:11 | |
evalbotzy | undef | ||
iblech | nothingmuch: You have mail :) | 12:12 | |
xinming | hmm... | ||
nothingmuch | iblech: checking | ||
iblech | ?eval sub sub1 { caller Sub }; sub sub2 { sub1() }; sub2() | ||
evalbotzy | Control::Caller.new(('file' => '<eval>'), ('line' => 1), ('package' => 'main'), ('sub' => sub {...}), ('subname' => '&main::sub2'), ('subtype' => 'SubRoutine')); | ||
xinming | why it doesn't return function? | ||
iblech | Because it returns the *calling* functions | ||
s/s$// | |||
But there is no calling function, only the calling toplevel | |||
xinming | oh,ok | 12:13 | |
?eval my @x=[1,2,3;4,5,6;7,8,9]; @x[0..10; 1,0; 1...:by(2)] | 12:22 | ||
evalbotzy | Error: unexpected "[" expecting expression | ||
xinming | ?eval my @x=[1,2,3;4,5,6;7,8,9]; @x[:by(2)] | ||
evalbotzy | Error: unexpected "[" expecting expression | ||
xinming | hmm, what does :by(2) mean ? | 12:23 | |
QtPlatypus | ?eval 1..10:by(2) | ||
evalbotzy | Error: unexpected ":" expecting digit, "_", fraction, exponent, term postfix, operator, "does", "but", "is", "^..^", "cmp", "<=>", "^..", "..^", "..", postfix conditional, postfix loop, postfix iteration, ";" or end of input | ||
QtPlatypus | Its supposed to mean that the range goes up by steps of 2 | ||
xinming | QtPlatypus: So, ( 1..10 ) will become ( 1..20 )? | 12:24 | |
scook0 | xinming: no, I think it's (1, 3, 5, 7, 9) | 12:25 | |
mugwump | ?eval &infix:<..>(1, 10, :by(2)) | ||
evalbotzy | Error: No compatible subroutine found: "&infix:.." | ||
mugwump | ?eval &Num.infix:<..>(1, 10, :by(2)) | ||
evalbotzy | Error: Undeclared variable: "&Num" | ||
mugwump | ?eval &Num::infix:<..>(1, 10, :by(2)) | 12:26 | |
evalbotzy | Error: unexpected ":" expecting "::", term postfix, operator, postfix conditional, postfix loop, postfix iteration, ";" or end of input | ||
xinming | is it equal @ary >>+<< 2 ? | ||
mugwump | alright, I give up on that approach :) | ||
scook0 | xinming: no, it means "count up in steps of 2" | 12:27 | |
(not that it's implemented) | |||
mugwump | ?eval (1..10).grep:{ $_ ^& 1 } | 12:28 | |
evalbotzy | Error: unexpected ":" expecting term postfix, operator, postfix conditional, postfix loop, postfix iteration, ";" or end of input | ||
xinming | Oh, Ok, so, (1, 2, 3, 4, 5, 6, 7):by(2) will get a new @ary = (1, 3, 5, 7) | 12:30 | |
scook0 | hmm | ||
mugwump | ?eval (1..7.5) | ||
evalbotzy | (1, 2, 3, 4, 5, 6, 7, 8) | ||
scook0 | I don't now how clearly :by() has been specced at this point | 12:31 | |
mugwump | ?eval (1,3..10) | ||
evalbotzy | (1, 3, 4, 5, 6, 7, 8, 9, 10) | ||
mugwump | ?eval ( (1,3)..10) | ||
evalbotzy | (2, 3, 4, 5, 6, 7, 8, 9, 10) | ||
xinming | ?eval (1,3..10):by(2) | ||
evalbotzy | Error: unexpected ":" expecting term postfix, operator, postfix conditional, postfix loop, postfix iteration, ";" or end of input | ||
scook0 | it might even have been ditched...can't remember | ||
xinming | ?eval ( (1,5)..10) | 12:32 | |
evalbotzy | (2, 3, 4, 5, 6, 7, 8, 9, 10) | ||
iblech | (1,5) is numified first, and, as it contains two elems, it numifies to 2 | 12:33 | |
Compare this to: | |||
?eval (1|5)..10 | |||
evalbotzy | (1, 2, 3, 4, 5, 6, 7, 8, 9, 10) | ||
iblech | ?eval ((1|5)..10).perl | ||
evalbotzy | '((1, 2, 3, 4, 5, 6, 7, 8, 9, 10) | (5, 6, 7, 8, 9, 10))' | ||
xinming | iblech: I know what junctions do. :-) | 12:34 | |
?eval ( all(1, 5).. 10 ) | |||
evalbotzy | (1, 2, 3, 4, 5, 6, 7, 8, 9, 10) | ||
iblech | xinming: Cool :) | ||
xinming | ?eval ( any(1, 5)..10 ) | ||
evalbotzy | (1, 2, 3, 4, 5, 6, 7, 8, 9, 10) | ||
iblech | You need the (...).perl in evalbot | ||
xinming | ?eval ( any(1, 5)..10 ).perl | ||
evalbotzy | '((1, 2, 3, 4, 5, 6, 7, 8, 9, 10) | (5, 6, 7, 8, 9, 10))' | ||
xinming | ?eval ( all(1, 5)..10 ).perl | ||
evalbotzy | '((1, 2, 3, 4, 5, 6, 7, 8, 9, 10) & (5, 6, 7, 8, 9, 10))' | 12:35 | |
mugwump | ?eval sub foo { }; &foo.perl | ||
evalbotzy | '\\sub {...}' | ||
mugwump | ?eval sub foo { }; &infix:<..>.perl | ||
evalbotzy | '\\sub {...}' | ||
mugwump | ?eval sub foo { }; &infix:<..x>.perl | ||
evalbotzy | Error: Undeclared variable: "&infix:..x" | ||
mugwump | ?eval sub foo { }; &infix:<..>(1,5) | ||
evalbotzy | (1, 2, 3, 4, 5) | ||
mugwump | ?eval sub foo { }; &infix:<..>(1,5,:by(2)) | ||
xinming | by the way, Is there any difference between sub f { } and sub f { ... } | ||
evalbotzy | Error: No compatible subroutine found: "&infix:.." | ||
xinming | hmm, maybe the yada operator. | 12:36 | |
scook0 | xinming: sub f {} is just a normal sub that will do nothing | ||
whereas sub f {...} will fail when you try to call it | |||
xinming | scook0: It's kind of "viusal" thing to user. :-) | 12:37 | |
scook0 | ?eval sub f {}; f | ||
evalbotzy | undef | ||
scook0 | ?eval sub f {...}; f | ||
evalbotzy | *** ... - not yet implemented at <eval> line 1, column 8-11 | ||
iblech | [PIL2JS] coro works now :) | 12:38 | |
scook0 | iblech++ | ||
xinming | ?eval sub f { }; sub f { }; | 12:39 | |
evalbotzy | undef | ||
xinming | ?eval my $a; my $a; | ||
evalbotzy | undef | ||
scook0 | xinming: that shouldn't be allowed | ||
xinming | these 2 examples should all generate a error. | ||
scook0: I know. ;-) | |||
scook0 | that's how you know pugs is incomplete | 12:40 | |
it doesn't have all of Perl 6's errors :) | |||
xinming | scook0: hmm, well, In fact, from these, We might write a more strict test to test perl 6 parser. | ||
nothingmuch | iblech++; # good ideas | ||
sorry it took me so long | |||
iblech | scook0, nothingmuch: Thanks :) | 12:41 | |
nothingmuch: Sure, np | |||
scook0 | iblech: wrt. `use jsan:` | ||
do you think it makes more sense to say: | |||
`use jsan:Foo::Bar` | |||
or | |||
`use jsan:Foo.Bar` | |||
iblech | Foo.Bar | 12:42 | |
Because that's the official name of the modules | |||
scook0 | I guess | ||
It just makes things more difficult :) | |||
(only a little though) | 12:43 | ||
iblech | ah, yes | ||
scook0 | though it also makes sense to have the module-name-format dictated by the `lang:` prefix | 12:44 | |
I'll leave it as it is for now | |||
it's hard to tell which parts of the pugs/perl5/jsan paths to merge together | 12:46 | ||
and which to keep separate | |||
iblech | right... | ||
scook0 | (ooh, just realised that my code does some odd things) | 12:48 | |
nothingmuch | i disagree | 12:55 | |
after you 'use jsan:Foo.Bar' | |||
what do you get? | |||
Foo.Bar.new? | |||
or Foo::Bar.new? | 12:56 | ||
scook0 | nothingmuch: that was the other reason I thought of | ||
iblech | Hm | ||
nothingmuch | we can't support 'Foo.Bar.new' because some day a language which hassyntax errors for namespace separators will come along | ||
IMHO we need to map the foreign namespace into the local one | |||
iblech | Currently, exported namespaces aren't autoboxed, so neither will work | ||
nothingmuch | prefixed by the domain | ||
unless unambigouous | 12:57 | ||
so Foo::Bar is OK | |||
and jsan:Foo::Bar is also ok, if there is more than one Foo::Bar involved in the process | |||
scook0 | btw, can you say `use ::Foo`? | ||
(I imagine you can) | |||
nothingmuch | scook0: for a relative name? | ||
iblech | And therefore, currently, you've to write $*JS.Foo.Bar.new | ||
scook0: That should work, I think, and mean the same as you'd have dropped the ::s | 12:58 | ||
scook0 | nothingmuch: I'm not really fussed why | ||
my only issue is `use pugs:::Foo` | |||
maybe we say that you get leading :: only if you /don't/ use a namespace prefix | 12:59 | ||
in any case, `use jsan:.Foo` is clearly bogus | 13:00 | ||
which is what I'm about to fix | |||
svnbot6 | r6393 | scook0++ | * Disallow leading delimiters in ruleDelimitedIdentifier | 13:05 | |
scook0 | eek, it's late -- bye folks | 13:06 | |
svnbot6 | r6394 | iblech++ | PIL2JS: Coroutines work :) | 13:10 | |
r6394 | iblech++ | Unfortunately, Pugs and I have different opinions on how coroutines should | |||
r6394 | iblech++ | work ;) I think a return() should reset the entrypoint, i.e. | |||
r6394 | iblech++ | my $foo = coro { yield 42; return 23; die }; | |||
r6394 | iblech++ | say $foo(), $foo(), $foo(), $foo(); # 42 23 42 23 | |||
r6394 | iblech++ | Pugs' return does not reset the entrypoint. And another related problem: | |||
r6394 | iblech++ | my $foo = coro { yield 42 }; # is really (in PIL2JS) | |||
r6394 | iblech++ | my $foo = coro { return(yield 42) }; | |||
r6394 | iblech++ | say $foo(), $foo(), $foo(), $foo(); # 42 undef 42 undef | |||
autrijus | iblech: your semantics is correct. however, fall-off yield should not be put into return() | 13:20 | |
just as | |||
sub { return 3 } | |||
is not | |||
sub { return (return 3) } | |||
iblech | Ah, ok | 13:21 | |
autrijus | but I do agree explicit return should reset entry. does Coro.pm do that same? | ||
iblech | dunno | 13:22 | |
I look through the old p6l posts WRT coroutines currently | 13:23 | ||
autrijus | let me test | ||
in p5's Coro it prints | 13:24 | ||
42 42 42 42 | |||
iblech | So it does not reset the entrypoint | ||
autrijus | because return() is considered rewind there | ||
pugs currently is | 13:25 | ||
42 23 23 23 | |||
I don't know... maybe p6l? | |||
I havn't really been used yield() so I can't quite speak there | 13:26 | ||
maybe ask some python or ruby folks :) | |||
iblech starts irb | 13:27 | ||
pdcawley | Ruby yield isn't relaly the same as a coro yield. It doesn't return anything, it passes an argument to the implicit block and gets the return value. | ||
autrijus | yes, I understand that much. | ||
pdcawley: btw, do you hear the pil2js passes all continuation.t tests? | 13:28 | ||
pdcawley | I did now. Whee! | ||
iblech | pdcawley: Right, just noticed... | ||
autrijus | t/unspecced/cont.t that is | ||
which means it can probably work with sudo ku soon | 13:29 | ||
pdcawley | Whee! I shall have a play. | ||
autrijus | iblech said.uniq is not yet implemented, so it doesn't quite work yet | 13:30 | |
but junctions do iirc, so if that's the only blocking thing, we're close | |||
pdcawley | After I've finished watching _Dr No_ | ||
Easy enough to rewrite without uniq I think. | 13:31 | ||
And as it stands is *desperately* inefficient. | 13:32 | ||
svnbot6 | r6395 | iblech++ | * t/unspecced/coro.t: return() should reset the entrypoint. | 14:15 | |
r6395 | iblech++ | * PIL2JS: PIL::PStmt, PIL::PVar, PIL::PStmts: | |||
r6395 | iblech++ | sub foo { return 3 } is no longer sub foo { return(return 3) }. | |||
r6395 | iblech++ | Similarily, coro foo { yield 3 } is no longer coro foo { return(yield 3) }. | |||
xinming | .doit(1,2,3) :{ $^a <=> $^b } | 14:17 | |
what does this do exactly please | |||
iblech | It calls doit with the argument 1,2,3 and the slurpy block { $^a <=> $^b } | 14:19 | |
You can declare such a method with: | |||
method doit($a,$b,$c, *&slurpy_block) {...} | |||
method doit(*@normal_args, *&slurpy_block) {...} will work, too, I think | |||
QtPlatypus | What does *&block mean? | 14:21 | |
I know what *@array means. | |||
xinming | QtPlatypus: It might be something link, grep {}, @ary... | 14:22 | |
iblech: So, Why this grammar exists is only because of we can write it in another way,right? | 14:23 | ||
grep @ary : { ... }; | |||
iblech | QtPlatypus: It allows you to specify a adverbial block, (map:{...}, grep:{...}, etc.) | ||
QtPlatypus | Arh | 14:24 | |
iblech | xinming: I'm not sure I understood you correctly, but yes, it's because of TIMTOWTDI | ||
xinming: That's disallowed, I think. There may not be whitespace between :{ | |||
xinming | iblech: Oops. I forgot it. | 14:25 | |
iblech: can the :{ } syntax be written into ->{ } ? | 14:27 | ||
iblech | xinming: You mean something like @array.map:-> $a {...}? | ||
That's disallowed | |||
But | |||
xinming | hmm, without : | 14:28 | |
.doit(1,2,3) ->{ $^a <=> $^b } | |||
iblech | you can use placeholder argument if you want to name the params: @array.map:{ $^a + $^b } | ||
Ah, that's disallowed, too | |||
But .doit(1,2,3, -> $a, $b {$a <=> $b}) should work | |||
xinming | so, .doit( *@ary ) `@ary = ( 1, 2, 3, 10, 11 )` will pharsed like .doit( 1,2,3, -> 10, 11 { ... } ); right/ | 14:30 | |
iblech | IIUC, no, * doesn't convert the argument types, so it would mean .doit(1,2,3,10,11). | 14:32 | |
You'd have to use | |||
@ary = (1,2,3, -> ... {...}); .doit(*@ary) | |||
xinming wonders if in emacs, that syntax highlighting for perl will pharsed by human instead of computer... | 14:34 | ||
QtPlatypus | xinming: What do you mean? | 14:35 | |
iblech | xinming: $EDITOR could use Pugs to parse Perl | 14:37 | |
Meaning that it would also work with user-defined operators, macros, and grammar redefinitions | |||
IIRC theorbtw1 was thinking of a Perl 6 syntax colorizer which used Pugs to parse the Perl | 14:38 | ||
xinming | iblech: yes, I mean that. | 14:42 | |
If you use pugs to do that, the "process" might all be slown down. | |||
iblech | Right, $EDITOR would have to optimize things a lot | 14:43 | |
xinming | iblech: At least, I don't want elisp to call "pugs-parser" to handle the syntax highlighting. :-) | ||
iblech | So it only gives Pugs small regions to reparse | ||
xinming | pugs might be the "father" of perl 6. :-) | 14:44 | |
iblech | Well, it's inevitable if you want user-defined ops, macros, and grammar redefinitions to be colored correctly | ||
xinming | iblech: do you use Emacs? | 14:47 | |
iblech | xinming: No, vim | 14:51 | |
xinming | iblech: I prefer Emacs to Vim... But For editing the config file, I prefer vim. | 14:54 | |
oops | |||
$omeone prefer $var_1 to $var_2, In this grammar, is $var_1 better than $var_2 to someone please? | 14:55 | ||
sub tmp (*$a, *%hask, *@ary ) { ... } | 15:01 | ||
?eval sub tmp (*$a, *%hask, *@ary ) { ... } | |||
evalbotzy | undef | ||
xinming | ?eval sub tmp ( $a, *%hash, *@ary ) { $a.say; }; tmp( 101, a => 100 ); | 15:05 | |
evalbotzy | 100 bool::true | ||
xinming | ?eval sub tmp ( $a, *%hash, *@ary ) { $a.say; }; tmp( 101, { a => 100} ); | 15:06 | |
evalbotzy | 101 bool::true | ||
xinming | ?eval sub tmp ( ?$a, *%hash, *@ary ) { $a.say; }; tmp({ a => 100} ); | ||
evalbotzy | a100 bool::true | ||
xinming | ?eval sub tmp ( ?$a, *%hash, *@ary ) { $a.say; }; tmp({ a => 100} ).perl; | ||
evalbotzy | a100 'bool::true' | ||
xinming | ?eval sub tmp ( ?$a, *%hash, *@ary ) { $a.say; }; tmp({ a => " 100"} ).perl; | 15:07 | |
evalbotzy | a 100 'bool::true' | ||
xinming | { a => 100 }.say | ||
?eval { a => 100 }.say | |||
evalbotzy | a 100 bool::true | ||
xinming | ?eval sub tmp (*%hash, *@ary ) { return undef }; tmp({ a => 100} ); | 15:11 | |
evalbotzy | undef | ||
xinming | ?eval sub tmp (?$a, *%hash, *@ary ) { if $a { $a.say }; else return undef }; tmp({ a => 100} ); | 15:12 | |
evalbotzy | a100 Error: No compatible subroutine found: "&else" | ||
xinming | ?eval sub tmp (?$a, *%hash, *@ary ) { if $a { $a.say } else return undef }; tmp({ a => 100} ); | 15:13 | |
evalbotzy | Error: unexpected "i" expecting ";", statements or "}" reserved word | ||
xinming | ?eval sub tmp (?$a, *%hash, *@ary ) { if $a { $a.say } else{ return undef }}; tmp({ a => 100} ); | ||
evalbotzy | a100 bool::true | ||
xinming | ?eval sub tmp (+$a, *%hash, *@ary ) { if $a { $a.say } else{ return undef }}; tmp({ a => 100} ); | ||
evalbotzy | a100 bool::true | ||
xinming | hmm, | 15:14 | |
how can we distinguish named parameter and slurp hash parameter? | |||
iblech | autrijus: my $num = 3; my $a = \$num; $num := 4; say $$a; # 4, right? | 15:58 | |
autrijus | iblech: verily | 15:59 | |
?eval my $num = 3; my $a = \$num; $num := 4; $$a | 16:00 | ||
evalbotzy | \3 | ||
autrijus | oh wow. | ||
that is broken 'course :) | |||
iblech | (Writing tests for =:= and eqv currently) | 16:01 | |
autrijus | excellent. | 16:02 | |
iblech | .id operates on the container or the cell? | 16:09 | |
autrijus | neither. | ||
on scalar it operates on the value; on array/hash it operates on the array/hash object. | 16:10 | ||
iblech | ok | ||
autrijus | =:= is orthogonal to id | ||
svnbot6 | r6396 | iblech++ | * Pugs.Parser: Parse the new eqv operator. | 16:23 | |
r6396 | iblech++ | * t/operators/identity.t: Fixes and improvements -- =:= operates on containers. | |||
r6396 | iblech++ | * t/operators/eqv.t: 38 tests for the eqv operator. | |||
r6396 | iblech++ | * PIL2JS: Prelude::JS: | |||
r6396 | iblech++ | * Minor fixes to &infix:<=:=> -- PIL2JS passes 35/39 of identity.t. | |||
r6396 | iblech++ | * Implemented &infix:<eqv> -- PIL2JS passes 37/38 of eqv.t. | |||
rmr | hello everyone ! :-) | 16:24 | |
so what's going on here? | |||
svnbot6 | r6397 | iblech++ | New t/var/refs_point_to_containers.t: References should point to containers, | 16:35 | |
r6397 | iblech++ | not cells or even values (passes 12/12 on PIL2JS). | |||
xinming | hmm, maybe You all didn't see what I confused about, | 16:52 | |
how can we distinguish named parameter and slurp hash parameter? | |||
?eval sub tmp (+$a, *%hash, *@ary ) { if $a { $a.say } else{ return undef }}; tmp({ a => 100}); | |||
evalbotzy | a100 bool::true | ||
fglock_ | how can I declare a method for 1..10:by(2) | 16:57 | |
I tried multi infix:<..> ( Int|Num $a, Int|Num $b, Int|Num ?$by = 1 ) ... | |||
iblech | xinming: named paramaters and pairs are currently discussed on p6l, thread "Demagicalizing pairs" started by Luke | 16:58 | |
fglock_: I'd think so, but I doubt that that has been implemented yet. But better ask putter, he fixed :adverbial modifies recently | 16:59 | ||
bbl & | |||
autrijus discovers Symbol::Opaque | 17:20 | ||
xinming | many people will refer the IIRC Thing, what this is really. | 17:21 | |
autrijus | luqui is quite insane. | ||
xinming: "if I recalled correctly" | |||
xinming: en.wikipedia.org/wiki/IIRC | |||
xinming | autrijus: thanks | 17:22 | |
putter | How do we do goto LABEL in p6? | 17:31 | |
integral hopes it's faster than perl5 | 17:33 | ||
iblech | putter: By using continuations? :) | 17:34 | |
putter: dunno. It might as well stay "goto LABEL" | |||
autrijus | yeah, that's probably that. | 17:35 | |
and surely it'd be invoking continuations? | 17:36 | ||
autrijus.org/tmp/Devel-TypeCheck-0....hed.tar.gz | |||
alias typecheck 'perl -MO=TypeCheck,-main' | |||
bargle++ # nice work | |||
putter | ah well. I'll add an abstraction layer then. The JS spec uses "goto step 4" constructs. Given the size of the spec, the rate at which I was progressing with hand rewrites... it would take *days*. So it's time for some global text massage. | 17:38 | |
Devel::TypeCheck looked interesting. I only briefly skimmed the paper, but was left wondering why only three programs(?) were used for Experimental results. Oh, duh. Paper deadline of course. ;-) | 17:40 | ||
autrijus | yes :) | 17:41 | |
due in a week. | |||
xinming | hmm, Perl now reached a place which is the hell for "English", Just now, I watched my qwert keyboard. and try to find if there is any punctuation which isn't been used in perl... | 17:46 | |
Maybe not for English, Even In Chinese. I think It will get there also... | 17:47 | ||
Khisanth | already has! | ||
xinming | what does ` do in perl 6? | 17:48 | |
Maybe we can consider this one. | |||
autrijus | larry wants it to mean unit. | 17:49 | |
fglock_ | what is the next milestone for Pugs? | ||
autrijus | fglock_: 6.28.0, full OO support. | ||
fglock_ | it means having the Perl6 version of the MetaModel? or in Haskell? | 17:50 | |
autrijus | yes, or something like that. | ||
putter | I don't suppose anyone has gotten around to writing a Filter::Simple like thing for pugs yet? | ||
autrijus | putter: iblech checked in macro support a while ago. | ||
filter-simple style macros. | |||
putter | yeah, but macros require arguments to parse. you cant say "and take the rest of the line". | 17:51 | |
fglock_ | is there a todo list? | 17:53 | |
putter tries to avoid having thousands of little one-line blocks because he cant grab lines of code. | |||
fglock_ | or something I can do to help | 17:54 | |
there is not much I can do in the 'Lazy' front at the moment | 17:55 | ||
putter | or me. I'm only off play silly JS frontend games because I dont see a way to affect the critical path. | ||
autrijus | uh, the critical path is probably make "make p5smoke" work. | 17:59 | |
in the same fashion as "make jssmoke". | |||
maybe some metaprogramming to fill in PrimP5 | |||
in a saner fashion | |||
that is perhaps the #1 important thing atm. | 18:00 | ||
xinming | sub tmp (+$a, *%hash, *@ary ) { if $a { $a.say } else{ return undef }}; tmp( a => 1, q:h{ a => 100} ); | 18:01 | |
autrijus | i.e. perl5/PIL-Run/lib/PIL/Run/PrimP5.pm | ||
also, a shared inferface with jspugs.pl etc, or at least something similar, would also help a lot | |||
xinming | hmm, anyone here would tell me if this might be ok... hmm, IMHO, I think It is ok for me... | ||
autrijus | since I intend to hook in -BPerl5 and -BJS off them. | ||
xinming: q:h means that "%x" is interpolated | 18:02 | ||
xinming: it does not mean that you can write a=>100 and have it mean a hash | |||
to do that, use | |||
hash(a => 100) | |||
er sorry | 18:03 | ||
{ a => 100 } would do | |||
xinming | autrijus: I just wish to figure this problem. :-) because, if the you specified the named argument, You might not be able to have a hash key as the argument name, | 18:04 | |
fglock_ | is there a way to define the primitives using the metamodel? (maybe by inserting methods in Int,Num...?) | ||
autrijus | xinming: if you said { a => 100 } that'd work surely? | ||
putter | one could clone jsbe. but sane requires objects. could be main difference between p5be and jsbe - good use of objects. doesnt seem much point otherwise. but pil2 doesnt do objects yet. full stop.(?) common interface can be done though. | ||
xinming | ?eval sub tmp (+$a, *%hash, *@ary ) { if $a { $a.say } else{ return undef }}; tmp( { a => 100} ); | 18:05 | |
evalbotzy | a100 bool::true | ||
xinming | ?eval sub tmp (+$a, *%hash, *@ary ) { if $a { $a.say } else{ return undef }}; tmp( ); | ||
evalbotzy | undef | ||
xinming | autrijus: *%hash should slurp all "Pairs" . | ||
autrijus | xinming: yes and you are looking at a bug :) | ||
xinming | But with the same syntax, the named argument can't be pharsed, | 18:06 | |
autrijus | no the bug is simpler thant hat. | ||
?eval sub tmp (+$a) { $a }; tmp(3); | 18:07 | ||
evalbotzy | \3 | ||
autrijus | ;) | ||
named participate in positional bindings. that's wrong. | |||
xinming | ?eval sub tmp (+$a, *%hash, *@ary ) { if $a { $a.say } else{ return undef }}; tmp(3, 'a' => 3 ); | ||
evalbotzy | 3 bool::true | ||
xinming | ?eval sub tmp (+$a, *%hash, *@ary ) { if $a { $a.say } else{ return undef }}; tmp(3, 'a' => 5 ); | ||
evalbotzy | 5 bool::true | ||
xinming | You see what I means? :-) | ||
autrijus | I see, but +$a means it can't take positionals | 18:08 | |
so that's currently a bug that it could. | |||
xinming | autrijus: hmm, But there will be confliction, with named parameters and the "slurp hash keys" | ||
maybe slurped hash. :-) | 18:09 | ||
putter | autrijus: did you mean common interface with runjs.pl? jspugs is the repl. crude-repl.pl already looks a lot like it (though jspugs doesnt actually eval expressions yet). could be made more similar, and to the pugs repl. | 18:10 | |
a runp5.pl would give you -B. | 18:11 | ||
autrijus | putter: yes, that. | 18:14 | |
putter | ok. in progress. | ||
xinming | ?eval sub tmp ( $a, $b ) { "$a $b".say }; tmp( a => 3, b => 5 ); | ||
evalbotzy | 3 5 bool::true | ||
xinming | autrijus: so, this works, a => 3 is a pair. | ||
putter | autrijus: still need something fglock_ can do to help. | 18:15 | |
autrijus | putter: also, the extent of OO in PIL1 -- i.e. classless OO -- would be useful to support that in runp5. | ||
xinming | autrijus: What about the "slurped hash"? How to pass the a pair to that hash? | ||
autrijus | xinming: *%h takes whatever +$x not bound; similar to how *@a takes whatever ?$x not bound | ||
xinming: any named things not explicitly bound to other args will go there. | 18:16 | ||
dudley | autrijus: Do you know if you can compile a Scala program to a .jar that will run standalone on a jvm? | 18:17 | |
autrijus | putter: mm, maybe make mandel.p6 work on p5 :) | ||
dudley: yes, you can. | |||
xinming | autrijus: Yes, So, If we have a key which name is the same as the "var" name, Then, It might pass wrong... | ||
autrijus | xinming: that is so. | ||
xinming | autrijus: hmm, So, I think We should make some point to avoid this. | ||
dudley | I've got a punielicious PIL2 repl in Scala, but if it can't run without a Scala runtime, I may go the Nice route... | ||
putter | ooooo. | 18:18 | |
autrijus | oh wow. | ||
xinming | just like, the ( a => 'value' ) are bound to variable. and some_func( a => 'value' ) to explicitly pass it to the hash... | 18:19 | |
autrijus | xinming: (h => { a => value }) | ||
will pass to %h. I think. | |||
xinming | autrijus: ok, fall back to my example above. | 18:20 | |
?eval sub tmp (+$a, *%hash, *@ary ) { if $a { $a.say } else{ return undef }}; tmp( a => 3, a => { a => 3 } ); | |||
evalbotzy | 3 bool::true | ||
xinming | ?eval sub tmp (+$a, *%hash, *@ary ) { if $a { $a.say } else{ return undef }}; tmp( a => 3, a => { a => 5 } ); | ||
evalbotzy | 3 bool::true | ||
autrijus | ?eval sub tmp (+$a, *%hash, *@ary ) { %hash }; tmp(hash => { a => 3 }) | ||
xinming | :-( | ||
evalbotzy | {('a' => 3)} | ||
autrijus | :-) | ||
xinming | autrijus: your right. | ||
:'( | |||
putter | autrijus: if you really want PIL1 p5be, I can transliterate PIL2JS. But there doesnt seem to be much point. I believe one would take a very different approach if one had PIL2 objects. It would be a throwaway. | 18:21 | |
autrijus | putter: from my primitive runcore work, that is not so -- PIL2 is essentially typed and normalized PIL1 | ||
xinming | ?eval sub tmp (+$a, *%hash, *@ary ) { if $a { $a.say } else{ return undef }}; tmp( a => 100 ); | 18:23 | |
evalbotzy | 100 bool::true | ||
autrijus | putter: but it's not much transliteration as building the abstractions in p5 that unifies metamodel, intrinsics and ffi | ||
iblech | putter: At least in PIL2JS, the code to support methods is ~~15 lines | ||
xinming | ?eval sub tmp (+$a, *%hash, *@ary ) { if $a { $a.say } else{ return undef }}; tmp( {a => 100} ); | 18:24 | |
evalbotzy | a100 bool::true | ||
autrijus | putter: especially FFI, which is orthogonal to the IL | ||
xinming | autrijus: is this example should return undef? | ||
autrijus | and I think p5 FFI is one of, if not the, most important thing for pugs 6.28.0 | ||
?eval sub tmp (+$a, *%hash, *@ary ) { if $a { $a.say } else{ return undef }}; tmp({b => 123}) | 18:25 | ||
evalbotzy | b123 bool::true | ||
autrijus | xinming: yes, undef. | ||
xinming: both should be bound to @ary. | |||
xinming: so tests welcome | |||
xinming | autrijus: I've said I will write tests. ;-) | ||
autrijus | cool | ||
fglock_ | what is FFI? | ||
autrijus | fglock_: foreign function interface | 18:26 | |
use perl5:DBI; | |||
use jsan:Number.Roman; | |||
xinming | ?eval sub tmp (+$a, *%hash, *@ary ) { if %hash<a> { %hash<a>.say } else{ return undef }}; tmp( {a => 100} ); | ||
evalbotzy | undef | ||
autrijus | xinming: that is correct, since it should go to @ary | 18:27 | |
fglock_ | you mean to translate parameters and return values back and forth between P6 and native? | ||
xinming | autrijus: You said `{ a => 100 }` should go to array, so ` a => { a => 100 }` should go into %hash, right? | ||
autrijus | fglock_: yes... basically, how P6 should work with its host runtime | 18:28 | |
fglock_: that part is of course runtime specific | |||
xinming: no, it should go to $a | |||
xinming: b => {a => 100} goes to hash. | |||
fglock_: it's similar to iblech's existing work on use jsan:Module | |||
xinming | autrijus: then, b here is something like pseudo... It will do nothing... | 18:29 | |
autrijus | xinming: er no, b becomes the key in %hash | ||
%hash<b><a> would be 100 | |||
xinming | autrijus: How to generate a hash key named a? just like the result of %hash<a> would be 100? | 18:30 | |
autrijus | fglock_: more concretely, get t/unspecced/p5/*.t to pass on runp5 | ||
xinming: sorry, I can't parse your question | |||
xinming | ?eval sub tmp (+$a, *%hash, *@ary ) { if %hash<a> { %hash<a>.say } else{ return undef }}; tmp( a => {a => 100} ); | 18:31 | |
evalbotzy | undef | ||
xinming | ?eval sub tmp (+$a, *%hash, *@ary ) { if %hash<a> { %hash<a><a>.say } else{ return undef }}; tmp( a => {a => 100} ); | ||
evalbotzy | undef | ||
autrijus | ?eval sub tmp (*%h) { %h<a><b> }; tmp(a => { b => 3 }); | 18:32 | |
evalbotzy | \3 | ||
autrijus | that's what I mean. | ||
xinming | ?eval sub tmp (*%h) { %h<a> }; tmp(a => 3); | ||
evalbotzy | \3 | ||
xinming | This is what I mean, | ||
?eval sub tmp (+$a, *%h) { %h<a> }; tmp(a => 3); | |||
evalbotzy | \undef | ||
autrijus | yes, that is correct behaviour. | ||
?eval sub tmp (+$a, *%h) { %h<b> }; tmp(b => 3); | 18:33 | ||
evalbotzy | \3 | ||
autrijus | and this is also correct. | ||
xinming | how to pass the pair `a => 3` into %hash rather than the argument. | ||
autrijus | ?eval sub tmp (+$a, *%h) { %h<a> }; tmp(h => { a => 3 }); | ||
evalbotzy | \3 | ||
autrijus | like that. | ||
xinming | yes, | ||
?eval sub tmp (+$a, *%h) { %h<a> }; tmp(y => { a => 3 }); | |||
evalbotzy | \undef | ||
xinming | ?eval sub tmp (+$a, *%h) { %h.keys }; tmp(a => 10, h => { a => 3 }, b => 3, c => 4); | 18:35 | |
evalbotzy | ('a') | ||
svnbot6 | r6398 | iblech++ | Net::IRC: Updated the documentation of Net::IRC-OO and minor fixes to | 18:42 | |
r6398 | iblech++ | Net::IRC's documentation. | |||
xinming | ?eval sub tmp ($a, *%h, *%ary) { }; tmp( a => 1, h => { }, ary => [], x => 5, y => 6 ); | ||
evalbotzy | undef | ||
xinming | autrijus: so, Is this example mean that the pair ` x => 5, y => 6 ` are all ignored? | 18:43 | |
s/Is/does/ | |||
autrijus | xinming: I think so, and I further think it's correct | 18:44 | |
iblech | Hm, I'd say that's an error | ||
As all params should have a var which they can be bound to | 18:45 | ||
autrijus | iblech: and if there's (*%h, *%h2), it binds to h2? | ||
xinming | autrijus: In fact, That's why I wish to clarify... :-) | ||
iblech | That's my intuition, yep | ||
xinming | autrijus: I now caught up with you, But... :-) | ||
autrijus | okay, I think that's probably best. | ||
note that in methods you get *%_ for free | 18:46 | ||
so practically that error won't happen | |||
unless of course you do (_ => ...) | |||
iblech | Why is this, BTW? | ||
autrijus | xinming: so test that it shoudl raise an error | ||
rmr | hi everyone | ||
autrijus | iblech: subclasses can then redispatch to super/next without fear of incompatibility. | ||
greetings rmr | 18:47 | ||
iblech | autrijus: Ah, makes sense | ||
rmr | i'm a begineer of perl scripting language | ||
:-) | |||
xinming | rmr: hi | ||
autrijus | nice. hopefully one day you will be a master of perl programming language :) | ||
xinming | autrijus: Which example you think will raise an error? | 18:48 | |
rmr | autrijus: Thanks :-) | ||
xinming | mine? | ||
rmr: In fact, I am on the way... | |||
autrijus | xinming: ary=>[] should cause an error because %ary can't take [] | ||
xinming: furthermore, the unbound b=> and c=> should cause error, as are the unbound x=> and y=> | 18:49 | ||
rmr | ok master programmers!!! | ||
IGTG | |||
c ya... | 18:50 | ||
xinming | autrijus: Ok, thanks. Now, I recorded it. | ||
rmr | hi everyone! | 18:53 | |
clkao | 6/win28 | 18:54 | |
rmr | can anyone tell me which is the best book to get started in perl? | ||
autrijus | rmr: Learning Perl, 4th edition, also known as the Llama book. | ||
rmr | right now i'm using o'reilly learning perl 3ed | ||
autrijus | 3ed works too, but 4ed is cooler because it talks about Pugs | ||
;) | |||
rmr | Pugs?!:-/ | 18:55 | |
autrijus | rmr: pugscode.org | ||
rmr | thanks 4 the info! | 18:56 | |
:-) | |||
xinming | autrijus: who is the operator of #perlchina? | ||
autrijus | xinming: no idea... | 18:58 | |
xinming | autrijus: hmm, Ok, I will ask myself. :-) | ||
fglock_ | is there a description of PIL that I can read? | 18:59 | |
iblech | fglock_: Pugs.Compile :) And there was a thread about PIL on p6c some weeks ago | 19:01 | |
rmr | can u tell me about some commonly used programs in linux, written in perl? | ||
iblech | rmr: Parts of Debian's dpkg/apt-get are written in Perl 5, IIRC | 19:03 | |
rmr | thanks iblech | ||
kgftr|konobi | iblech: kungfuftr.com/code/dibs-0.01.tar.gz | 19:05 | |
if you're intrested | |||
autrijus | fglock_: also -CPerl5 output | ||
fglock_: and perl5/PIL2JS/lib/PIL/* | 19:06 | ||
iblech | fglock_: And -CPerl5 | perl -MYAML -we 'print Dump(<>)' | 19:07 | |
xinming | rmr: I think, You shouldn't ask which programs are written in perl, as most program needs perl, :-) | ||
iblech | kgftr|konobi: This is not "dibs -- Distributed Internet Backup System", is it? | 19:08 | |
rmr | xinming: can u give me some eg: ? | 19:09 | |
kgftr|konobi | nope... debian (improved/improvised) installer | ||
iblech | kgftr|konobi: ah | ||
xinming | rmr: I don't think we need much eg. as most Linux distribution "have" to install perl. even in freebsd. | ||
kgftr|konobi | came up with it ages ago to provide a better mechanism for debootstrap for one-touch installations | 19:10 | |
rmr | well, even the cygwin i'm currently using under windows has got perl... so i guess its an important part of every distro, right? | 19:11 | |
kgftr|konobi | xinming: freebsd 5.0 doesn't have perl | 19:12 | |
autrijus | ...in its minimal installation | ||
xinming | kgftr|konobi: hmm, Well, Sorry for my misleading. :-) | ||
autrijus | in practice, though, its default install contains perl. | ||
kgftr|konobi | autrijus: true enough | ||
rmr | ok | ||
autrijus | so it's more like "freebsd5's core doesn't depend on a particular version of perl5". | 19:13 | |
rmr | so all of u guys r using freebsd? i've never had the opportunity to use freebsd... | ||
autrijus | I'd imagine not. :) | ||
integral keeps misreading rmr as rms 8) | |||
autrijus | debian-based distros is perhaps more popular here iirc | 19:14 | |
kgftr|konobi | down with linux! as they say | ||
rmr | can i run all the GNU sw i'm using in linux in freebsd as well? | 19:16 | |
integral | that's what meta^Wautoconf is for | ||
rmr | i mean without any modifications to the source code? | 19:17 | |
autrijus | rmr: freebsd can run linux binaries. | ||
rmr | is that because both linux & freebsd r POSIX compliant? | ||
autrijus | rmr: also you can install a debian, rh9, suse9, or gentoo userland. | ||
xinming | rmr: But only 90%... | ||
autrijus | rmr: so unless it's a kernel driver or something, chances are it runs on freebsd. | 19:18 | |
rmr: no, it's because freebsd is linux compliant :) | |||
xinming | rmr: No, that's because BSD has a "emulator" for Linux binary. | ||
autrijus: hmm, so, why are you choosing bsd? | |||
autrijus: :-) | |||
rmr | ok. thanx guys..:-) | 19:19 | |
autrijus | xinming: clkao forced me to | ||
I had not choice | |||
(translation: freebsd community in .tw more active than linux community.) | |||
that was many years ago though. nowadays it's both got great community. | |||
xinming | what does clkao mean ? | ||
rmr | i'd like 2 try bsd... do they've a live cd? | 19:20 | |
autrijus | xinming: clkao is clkao at clkao.org, author of svk.elixus.org, the person introduced me to freebsd, all around crazy guy. | ||
xinming | rmr: I suggest you Linux rather than bsd if you have much new hardware. | ||
autrijus | rmr: yes, www.freesbie.org/ | ||
kgftr|konobi | freebsd emulates linux system calls, iirc | ||
xinming | rmr: I ever wish to try Freebsd, But I got a Sil 3114 sata card and something more which doesn't well supported in Freebsd, | 19:21 | |
rmr | what about hacking the device drivers 4 say, linux and using it? | 19:22 | |
autrijus | sadly that's the one thing that does not carry over :-/ | 19:23 | |
kgftr|konobi | better than it was though | ||
autrijus | yup. thanks to eg unified codebase for wifi with linux | 19:24 | |
rmr | ok. i've an old PIII system with 64 MB RAM & a 40GB IDE HDD. can i do a minimal install in this system | 19:25 | |
autrijus | you can do a full install. | ||
but I need to sleep. cioa! | |||
*wave* | 19:26 | ||
autrijus & | |||
rmr | ok ciao | ||
autrijus: Thanks 4 the info... | |||
iblech | Night :) | 19:27 | |
rmr | IGTG now. Good Night Everybody...:) | 19:28 | |
xinming | hmm, what does mmd mean? | 19:31 | |
and also ciao... | 19:32 | ||
dudley | Multi Method Dispatch | 19:35 | |
and ciao is goodbye | |||
in italian | |||
dudley slinks back off to Real Life for a while... | 19:37 | ||
nothingmuch wonders why no one has mentioned the is_gay function... perlmonks.org/?node_id=485453 | 19:39 | ||
Juerd | It has an underscore in its name and thus does not at all look like a Perl builtin | 19:40 | |
nothingmuch | that's because it's part of PDF::Sexuality | 19:41 | |
jql | does this mean there's a use strict qw(hetero)? | 19:44 | |
theorbtw1 looks up the node in question, and says "OY!" loudly. | 19:53 | ||
xinming | by the way, anyone here can tell me why in Synopsis, it will have a big jump. which skip S14 and reached S29? | ||
putter | fglock_: ping? | ||
iblech | xinming: Only because some topics are more important than others | 19:54 | |
xinming: Think of builtin subs vs. threads or so | |||
xinming | iblech: So, there are still many syntax of the perl language there? T_T | 19:55 | |
iblech: or They just the default functions built-in with perl 6 | 19:56 | ||
kgftr|konobi | theorbtw1: NOT LONG NOW SUCKA! | ||
iblech | xinming: Sorry, couldn't parse these two sentences, but yes, you can, of course, override all "builtins" | 19:57 | |
xinming: There could even be a "no builtins;" | |||
xinming | iblech: I mean, If there are still many grammars for perl 6 language there. | 19:58 | |
putter | Can anyone think of a reason p6-on-p5 could not have a blended type system? eg, p5 str isa P5::Str does String. p6 classes can inherit from p5 cls via AUTOMETH. p5 classes can inherit from p6 cls normally, as long a p6 classes @ISA a UNIVERSAL_Blocker class which throws isa() etc back at the metamodel's AUTOLOAD. use overload helps use p6 objects in p5 code. thoughts? | ||
xinming | iblech xinming: There could even be a "no builtins;", hmm, So what does perl 6 do exactly? Just a kind of mind... maybe the spirit of perl 6? :-) | ||
iblech | putter: ooh inheriting from native classes | 19:59 | |
xinming: I've probably misunderstood you, but yes, there can be as many grammars as wanted/needed | 20:00 | ||
wolverian | Juerd, hello. haven't seen you much lately. (on IRC, that is.) | 20:03 | |
Juerd | Hello | ||
I've been away for a month, and have been inactive for at least a month before that | |||
I've been on IRC now and then, but it's highly irregular | |||
wolverian | ah. I hope it's nothing serious? | ||
Juerd | And because my hands, wrists and arms have still not yet recovered, it'll stay like this for a while, I fear. | 20:04 | |
It's serious alright | |||
stevan | putter: slight digression, but where is AUTOMETH and co. documented? which Syn? | ||
wolverian | Juerd, damn. I'm sorry. I didn't cause it but hate the world for it. | ||
(really.) | 20:05 | ||
Juerd | I hate the world for it even though I did in part cause it | ||
It would perhaps be easier to live with if it weren't partly my own fault | |||
wolverian | it's probably easier to hate the world then. | 20:06 | |
I don't consider it a fault, though. | |||
Juerd | Stubbornness is a big mistake | ||
I didn't admit it at the time, but I have to ask myself why the hell my largest number of PM posts were done at times I let other things for what they were because of the same very pain. | 20:07 | ||
I didn't make that mistake this time. | |||
putter | stevan! hi. was just thinking of you. checking... | 20:08 | |
A12 S1[023] | 20:09 | ||
wolverian | Juerd, at least you've learned. and I'm happy that you're not totally disabled. | ||
Juerd | If I were totally disabled, I'd get help from others | ||
Now I am on my own | |||
stevan | putter: thanks :) | ||
Juerd | Even my parents no longer believe I have to avoid some activities anymore | ||
putter | np :) | ||
wolverian | Juerd, that sucks. :/ | 20:10 | |
Juerd | I can still move everything, and I can still carry large boxes | ||
It's hard for the outside world to realise that this all causes great discomfort | |||
putter | iblech: on reflection (no pun intended), p6 classes would almost certainly have to do delegation, but with AUTOMETH it could look to clients like inheritance. | ||
xinming | @objectĀ».*meth(@args) # calls all methods (0 or more) on each | 20:13 | |
what does each mean here? | |||
in parrel dispatch | 20:14 | ||
putter | Juerd: yeah, that's a tough one. It helps to get it named, eg "I have CTS, so I can't do that". | ||
xinming | parallel | ||
Juerd | putter: Yep. But I don't have CTS --nobody knows what exactly I do have-- and I *can* do it. | 20:15 | |
I can just ignore the pain and do things. It'll get worse, but it doesn't disable me. | |||
Hm, I said I didn't make the same mistake this time. That isn't even true. | |||
juerd.nl/vt.txt # I shouldn't have typed all this in, even though I believe in the cause. | 20:16 | ||
putter | sure, but there is a large class of things (lifting vis back or abdom.), typing vis wrists, etc, where yes you can do it, you might even do it without pain, but you know the concequences in pain and incapacity for thus pushing your envelope, and so wisely decline the task. | 20:17 | |
Juerd | Yes | 20:18 | |
I know you people understand it. I just wish the general public understood what it is about. | |||
putter | the real hard case is when there isnt even near term feedback, eg truckdrivers and spinal/join wear from lifting, where its "slow job vs abstraction of being crippled for life a decade out". | 20:19 | |
Juerd | It's so depressing to continually have to answer questions to people who don't understand the answer, and will never do so. | ||
putter | at least the universe promptly reminds you you are making a mistake. even if its thus far difficult to explain to others. ;) | 20:20 | |
wolverian | xinming, it calls @object[0].meth, @object[1].meth, and each .meth that it finds in the inheritance trees of all the @object[n]s | 20:21 | |
Juerd | By the way - I am looking for people who CAN type (without discomfort) to help me transcribing some videos | 20:22 | |
But I reckon that asking this in #perl6 is unsmart. Ignore what I said and get coding :) | |||
putter | General advice for this kind of thing - try additional doctors. Often one will eventually say, "oh, of course. I dont know what those other folks were thinking. its obviously foo". They you can say "its foo" and people will be happy. Sometimes even when the cause is still unknown, there are names for bags of symptoms, which doest help you cure wise, but does provide a name. | ||
xinming | wolverian: Ok,thanks. | ||
wolverian: I didn't see the @ T_T | 20:23 | ||
Juerd | putter: I've seen too many already, imo | ||
putter: I can say "it's RSI", which at least in .nl is known by everyone. | 20:24 | ||
putter | rms (not rmr;) has had folks providing typing assistance full time. "Ctrl-A Meta-W thank you for your"... | ||
Juerd | putter: But because of some very weird media attention, people think that 1/3 of all office workers have RSI, and that it is mostly a psychological and whiney disorder. | ||
putter | ah. so "i have rsi. i have to / have been told to avoid x y z" | ||
ooooh. curious. | 20:25 | ||
Juerd | There was a move to rename the spectrum of RSI to CANS, but of course publicizing this decision undid the effect it should have had. | ||
putter | well, could always add a modifier. "severe rsi". "tramatic rsi". "impact rsi" | 20:26 | |
Juerd | oh, severe rsi is the official term for what I have | ||
And that is what I use. | |||
It helps not. :( | 20:27 | ||
putter | :) another hypothesis bites the dust. | ||
err, s/:)/:(/ | |||
hmm, well, could use it a chance to do public education. the process of which also helps pursuade. | 20:29 | ||
Juerd | I'm too tired of all this nonsense that surrounds it, that I can't even explain anymore in a friendly tone what is wrong. | 20:31 | |
It gets to you after a few years | |||
luqui | ?- topic(X). | ||
Juerd | luqui: RSI and people not recognising its impact and importance | ||
luqui | ahh | ||
Juerd | The annoying and awkward situation in which you have a named disorder, but you still have to do everything just because people don't believe the things they ask from you will hurt so much. | 20:32 | |
fglock_ | putter: is there an overview of how PIL-RUN works? | 20:33 | |
putter | fglock_: no. let's see... | ||
fglock_ is lost in the void between MetaModel and PIL | 20:34 | ||
xinming | multi sub unimpl (MyFoo $x) { upchuck(); } | 20:35 | |
&infix:<+> ::= &unimpl; | |||
hmm, infix needs two arguments, so, the example only gives one, where is the other one please? | |||
fglock_ | xinming: that should be an error | 20:36 | |
putter | crude-repl is the top, MainX loads, EvalX processes PIL to p5, ApiX provides an abstraction on the runtime, PrimP5 has primitives. Type/ contains some object types not yet migrated to Per6-Value etal. That's about it. | ||
luqui | xinming, where did you see that? | 20:37 | |
putter | fglock_: ah, ApiX is most of the interface between mm and pil-run. EvalX handles all PIL processing. | ||
nothingmuch | hola luqui | ||
luqui | hi nothingmuch | ||
fglock_ | putter: I guess it will need Type abstraction? How does it handle multisubs? | ||
xinming | luqui: S13 | ||
fglock_: S13 show this example. | 20:38 | ||
putter | actually, I was going to talk with you and stevan to see if we cound discard ApiX and have a blended p6-p5 type system. | ||
fglock_: the mm isnt yet being used for subs. Type/Sub.pm is. | 20:39 | ||
xinming | reading Synopsis is really kind of fun. | 20:40 | |
putter | that was a next step before something in the mm changed, and crude-repl stopped working. | ||
luqui | xinming: fixed | ||
thanks | |||
fglock_ | I've been planning to work on the type system - I hoped that being able to undertand PIL would help the implementation | 20:41 | |
putter | I dont suppose anyone has seen any perl5 magic which makes ->foo method access work on nonreference things? | ||
luqui has been wanting that for a while | |||
fglock_ | do you mean on unboxed types? | ||
luqui | you could overload all constants :-) | ||
putter, why? | 20:42 | ||
xinming | luqui: What do you mean by "fixed"? do you mean the document is fixed, or just a wrong completion ? :-) | ||
luqui | xinming, document has been fixed in svn.perl.org/perl6/doc | 20:43 | |
putter | perl -we '$x = 3; $x->foo' currently an error, someone out there may well have a hack to make it work... | ||
luqui | It would require some C code or a source filter | ||
putter | re why, just trying to understand the design space, | ||
luqui | or overload::constants | ||
(which doesn't exist, I now remember) | 20:44 | ||
(it's just part of overload) | |||
putter | autrijus's emphasis on FFI has me thinking about the p5backend from the bottom up. "if p6 integration is to appear seamless from the p5 side, then ...". | ||
xinming | luqui: I ever thought I was reading the newest doc. But now I know... | 20:45 | |
fglock_ | putter: if you were using Value.pm, it would be $x=Int->new( '$.unboxed'=>3 ); $x->foo; | ||
luqui | xinming, well, you were, until I fixed it five minutes ago | ||
that reminds me.. I have to write my value type manifesto | 20:46 | ||
putter | right. but one could make p5 ints look like say P5::Int (does Integer) on p6 side. I was just looking for a way to close the circle. avoid p5 code having to say make_sure_its_an_object($x)->foo | 20:47 | |
fglock_ | you mean delay the autoboxing - but that's the optimizer's job (?) | 20:48 | |
luqui | I think he's talking about user-generated code | ||
(that is, hand written) | 20:49 | ||
xinming | luqui: So, I wish to clarify an example... | ||
sub tmp (+$a, *%hash, *@ary ) { if $a { $a.say } else{ return undef }}; tmp( { a => 100} ); should return undef; | 20:50 | ||
which ($a %hash @ary ) will get `{ a => 100 }` | |||
luqui | @ary | ||
xinming | luqui: Ok, then, how about `tmp( a => 100 )` ? | 20:51 | |
luqui | +$foo and *%foo are both for named arguments | ||
$a would get that | |||
and tmp( b => 100 ); # %hash<b> == 100 | |||
putter | yes. the ideal FFI is one that doesnt exist. user p5 code says $x = Int->new(3) or just $x = 3 and can use p6 bar($x). and with $x = a_p6_bar(), overloading gets us $x + 1, but $x->foo is still a problem for native p5 non-reference types. | ||
xinming | luqui: Ok, the problem now comes out, | ||
fglock_ | how about _call_method( $x, 'foo' ) | 20:52 | |
xinming | tmp( a => 100, 3, 4, 5, 6, ); | ||
luqui: If I need to pass a pair which is ( a => 200 ), how can I do that? | |||
pass it to % | |||
luqui | what do you mean? | ||
you want $a to be 100, but you want %hash<a> to be 200? | 20:53 | ||
putter | right. I was just wondering whether in the large bag of little used esoteric perl5 hacks, someone had worked out something to permit 3->foo. | ||
xinming | luqui: yes. | ||
luqui | can't | ||
*% is for overflow named arguments | |||
fglock_ | that's the same thing when you do UNIVERSAL::isa() | ||
xinming | luqui: So, % will never get a key named 'a' in this example, right? | ||
luqui | fglock_, except that _call_method could be smart about it | ||
xinming, I believe so | 20:54 | ||
fglock_ | sure | ||
xinming | luqui: In fact, autrijus gave me an example tmp( a => 100, hash => { a => 200 } ); | ||
putter | isa($x,'C') you mean? | ||
xinming | luqui: But from This example, The other problem comes out, which is, other pairs which "should" be in hash will all be ignored. | ||
luqui | oh my | 20:55 | |
yeah, that's an interesting case | |||
fglock_ | sub call_method{ unless(ref($_[0])){ upgrade_to_object(\$_[0]) } $_[0]->$_[1] } or something like that | ||
xinming | luqui: So, I think You might need to write more details on this. :-) | 20:56 | |
putter | right. or the more general but less efficient p6ify($x) which gives you a full p6 proxy object. | ||
(if necessary) | |||
luqui | xinming, using hash => { } might be construed as evil, according to some | 20:57 | |
xinming | luqui: some people who is busy won't care about this, except me... as I am "twindle my thumbs" :-) | ||
luqui thinks he will p6l this issue | 20:58 | ||
xinming | luqui: by the way, In the above example, I didn't mean *%, I mean *%hash, hope you can understand. :-) | ||
luqui | yeah | ||
xinming | %_ will slurp all the other pairs for methods, But not for sub... odd... | 20:59 | |
luqui | xinming, the only difference is that in methods %_ is automatically declared | 21:00 | |
putter | ha! you _can_ create p5 infix operators. just define a receiver class with say + overloaded. so Filter::Simple say --> (that's - - > ) to say + mumble, where mumble's overload + returns the right thing. hmm, have to check precedence... hopefully something higher than + | ||
err, those "say"'s are "perhaps", not say(). ;) | 21:01 | ||
xinming | luqui: I knew. :-) | 21:02 | |
luqui | putter, that's an interesting idea | ||
the tightest infix you can get is ** | 21:03 | ||
but it's right associative | |||
putter | 3-->ref eq 'P5::Int' ;) | ||
luqui | the next one up is * | ||
putter | ooo, good. | ||
luqui | putter, you will break Damian's code if you do that :-) | 21:04 | |
putter | which code? | ||
luqui | he uses this idiom: | 21:05 | |
while ($count --> 0) {...} | |||
oh, there's another issue | 21:06 | ||
putter | ? | ||
luqui | 1-->ref eq 'P5::Int' # would be equivalent to 1**ref($_) eq 'P5::Int' | 21:07 | |
that is, -> is special in that it quotes its right side | |||
but that's not a huge issue | |||
just turn 3-->ref into 3**_method('ref') | 21:08 | ||
source filters can do such things :-) | |||
hmmmmmm, I wonder if you could use that technique to use -> | 21:09 | ||
convert $x->y into $x**_method('y') | |||
and then make _method smart | |||
fglock_ | how about p6(1)->foo instead of 1-->foo (no source filter needed) | 21:10 | |
luqui | fglock_, because that's a lot harder with a source filter | ||
oh | |||
without a source filter | |||
that's awkward though | |||
putter | oh drats. I see. you cant overload anything higher than, so has to deal not just with the object, but with any method call. blech. oh well. | ||
luqui | you want to minimize pain on the user's part | ||
putter | than -> | 21:11 | |
fglock_: yes, definitely. also call(3,'foo'). I'm just looking for a third, less efficient but perhaps less invasive, idiom. | 21:12 | ||
luqui | Hmm, is PPI smart enough to be able to transform 1->foo | ||
generally | |||
fglock_ | you are using the source filter as a mini-perl6? | ||
in this case, why not use 3.foo ? | 21:13 | ||
luqui | because that's a much more common operator in perl 5 | ||
xinming | luqui: Why does perl still use pod, why not change it to xml by the way? | ||
luqui | xinming, because xml sucks | 21:14 | |
I should clarify | |||
humans hate writing xml | |||
and you can't read it easily | |||
but its good for generated markup | |||
putter | fglock_: in a very limited sense. the idea being -> would work as expected on p6 objects. but if p6 objects arent forced to do outgoing border checks, a p6 sub could return a p5 native int. and it would be nice not to have to saturate your p5 code with "an make sure it's not a native int before I call a method" code. | ||
luqui | but pod is written and read by humans | ||
putter | luqui: PPI? | ||
wolverian | luqui, I assume PPI is good enough, as it (AFAIK) parses 99% of CPAN correctly. | 21:15 | |
luqui | wolverian, it *tokenizes* 99% of CPAN correctly | ||
xinming | luqui: well, In fact, For perl, There isn't much markup, So, with autocomplete feature. I didn't find xml is hard to written really. :-) | ||
luqui | I was wondering if it was smart enough such that you could put a precedence hack around it | ||
wolverian | luqui, ah, right. | ||
putter | hmm... an alternative would be P5::Int does _not_ does Integer, but does coerce, so everything which hits p6 ceases to be native. but then one has to deal with proxy objects and such. which it would be nice to avoid. | 21:16 | |
luqui | putter, but is not as nice to avoid as source filters are | 21:17 | |
xinming, well, you could write your documentation in xml | |||
because we're already supporting both pod and kwid | |||
so an =xml plugin shouldn't be so hard | |||
putter | luqui: --> would be an optional import. trades filterness for being able to "think objects" even in p5. | 21:18 | |
luqui | fair enough | 21:19 | |
however, as long as you're adding syntax | |||
we could do as fglock_ says and treat /\.\w+/ as a method call | |||
instead of the heaviweight /-->\w+/ | |||
putter | hmmmmmmmmm | 21:20 | |
luqui | oh shit | ||
putter | lol :) | 21:21 | |
loudly | |||
luqui | how would you transform this: 3.foo(24) | ||
putter | "what HE said!" | ||
3**mumble->foo(24) | |||
luqui | which means 3**(mumble->foo(24)) | ||
however... | 21:22 | ||
as long as you have control over mumble | |||
you could make that work | |||
putter | mumble still has to play "capture the chain of ->" game. | ||
fglock_ | 3**unboxed**->foo(24) :) | 21:23 | |
self-documenting | |||
putter | **-> syntax error? | ||
luqui | s:2nd/\*\*// | 21:24 | |
xinming | luqui: Ok, by the way, hmm, will be perl 6 default assume the codes are perl 6 in the future? I know now, It is assume the codes are perl 5 codes. | ||
putter | oh, so using "unboxed" as the name of mumble? i still havent thought to hard about what mumble needs to be. | 21:25 | |
luqui | xinming, you mean when you run perl script.pl | ||
it is assumed to be perl 5? | |||
putter | users will never see it anyway. | ||
luqui | putter, I think he was suggesting that you make the users write that | ||
putter | eeep. | ||
fglock_ | unboxed{3}->foo(24) -- using a tied hash | 21:26 | |
luqui | fglock_, how is that better than p6(3)->foo(24) | ||
xinming, well, the question is, when do we switch? | |||
because as soon as we do, we break things | |||
xinming | luqui: hmm. :-) | ||
luqui | so it will probably stay perl 5 forever, until we give you the option not to build perl 5 at all | 21:27 | |
and then it's the administrator's choice | |||
the other way around it is to use a different extension for perl 6 scripts | |||
xinming | luqui: why not ask people to change all the perl extension into .p5 or .pl5 ? :-) | ||
luqui | how about the other way | ||
xinming | luqui: and the default .pl will always stand for the newest version of perl. | 21:28 | |
luqui | ask people to change from .pl to .p6 when it's perl 6 | ||
putter | $x**ip6->foo() does give you infixness wo filters, which p6($x)->foo doesnt. so I guess it could make sense to expose mumble so you can do that. | ||
luqui | xinming, because then you're still breaking everything | ||
it doesn't matter what you ask people to do | |||
they won't read your request | |||
fglock_ | luqui: it allows more explicit declarations, such as unboxed{3:int}->foo(24) | ||
luqui | fglock_, that's a syntax error | ||
p6(3, 'int')->foo(24) | |||
xinming | luqui: hmm, Do something rude... :-) | 21:29 | |
putter | $x**as6->foo()**as6->bar() vs p6(p6($x)->foo())->bar() vs $x.foo().bar() | ||
xinming | luqui: just do something like M$. :-) | ||
luqui | ? | ||
oh | |||
putter | ok, can anyone think of any showstoppers for the blended type scheme? | 21:30 | |
xinming | luqui: Ok, so, how about extension .pl6? will it be used for perl ? | ||
luqui | you mean "HI THERE, I SAW YOU HAVE A FILE THAT HAS A .PL EXTENSION. YOU PROBABLY MEANT PERL 5, BUT WE WANT YOU TO MEAN PERL 6. SO CHANGE IT, OR ELSE I'LL CRASH" | ||
putter | everyone believe we can create a HIDEUNIVERSAL class which bounces UNIVERSAL methods back to the p6 object's mm AUTOLOAD? | ||
luqui | just rebind UNIVERSAL? | 21:31 | |
xinming | luqui: Well, No... You should rather say, "Perl 5 is outdated... We need a wonderful technoledgy, which will make your life easier... your program wrong faster... and safer... " | ||
luqui | *{'UNIVERSAL::'} = \%HIDEUNIVERSAL::' | ||
xinming | s/wrong/run/ | ||
luqui | xinming, though the original wasn't too far off :-) | 21:32 | |
putter | p5 calling $p6o->isa() on a p6 object should get p6's version of is, rather than UNIVERSAL's. I think. | ||
luqui | so why don't you just define "sub isa" for the perl 6 Object class | ||
putter | $p5o->isa() on non-p6 objects should get the usual UNIVERSAL isa. | 21:33 | |
fglock_ | putter: I think it already works like this in the MetaModel | ||
luqui | putter, right. isa() is nothing special, you can override it just like any method | ||
xinming | luqui: because perl is a really different language, It will keep changing... and in the future... I believe perl 7 will be even harder to "pharse", So, why not make these scheme default? .p6 or pl6, | ||
putter | oh, duh. by simply defining an isa method. | ||
xinming | luqui: And also, It's really ugly to write use v6; as the first statement. | ||
luqui | xinming, agreed | 21:34 | |
putter | so that just leaves the puntable issue of folks adding methods to UNIVERSAL and p6 having to avoid them. something for version 2. | ||
luqui | I believe if you give perl a file that ends with .pl6 or .p6, it should do the right thing | ||
xinming | luqui: or even more, you can have symbolic link, which links to /usr/bin/perl and the link names are /usr/bin/perl5 /usr/bin/perl6 | ||
luqui | and we can just bind .pl (and .plx, and .pm) to mean perl 5 by default | 21:35 | |
xinming, yeah, that was planned already | |||
xinming | luqui: will the perl 6 have a different extension for "module"? | ||
putter | Ok, so which version of the metamodel should we be using. stevan? mm2.0? doesnt matter? | ||
luqui | no, but perl 6 modules start with "module", not "package" | ||
so we can tell | |||
xinming | I rather prefer going with the newest perl. | 21:36 | |
luqui | again, that breaks stuff. we don't want to break stuff | ||
one of the reasons perl has been so successful is because it never breaks backwards compatibility | |||
putter | If -Bperl5 is to be integrated with pugs, we should probably move a metamodel, along with its tests, out of pugs/perl5/ and into the main distribution. | ||
luqui | we're gutting the language, so we have to have safety features to assume backwards compatibility | ||
putter, maybe so | 21:37 | ||
fglock_ | luqui: does isa() test for subtypes? like $list->isa(Lazy) | ||
xinming | luqui: hmm, I think, by the time goes by, we can make .p5 .pl5 as perl 5, and px plx for the specified version. and .pl for the newest version of perl. | ||
luqui: backwards compatibility will confuse many "newbie" | 21:38 | ||
They might not be able to do so much comparision with perl. That's what I think, might be wrong anyway. | 21:39 | ||
luqui: just do a suggestion. ;-) and most people will change by the time goes by. :-) | |||
luqui | fglock_, in perl 6, no | ||
xinming, you know how perl tutorials say "always write #!/usr/bin/perl at the top of every script" | 21:40 | ||
xinming | this is a bit like w3c recommendation. | ||
luqui | I don't see how perl six is any different: "always write #!/usr/bin/perl6 at the top of every script" | ||
fglock_, in fact, it would really be nice to abolish isa() in perl 6 | |||
or at least hide it in is_subclass_of or inherits_from | |||
xinming | luqui: hmm, So, Some people will use #!/usr/bin/perl6 at the top line, and use perl 5 syntax. That's what I can image. :-) | 21:41 | |
luqui | because most of the time, what people are asking is whether it does() | ||
fglock_ | or move it to .meta? | ||
luqui | xinming, they have more to learn :-) | ||
putter | iblech, etal: reality check: with this kind of FFI-free scheme, one could still cps transform p6 code, passing the continuation in a local() var. is anything (aside from p5-compiled-from-p6 code size) lost? | ||
luqui | fglock_, yeah, perhaps | ||
fglock_ | how to test for subtypes? .does(Lazy) ? | 21:42 | |
luqui | fglock_, yeah | ||
though I think you're misusing "subtype" | |||
fglock_ | I've read that Lazy is a subtype ? | 21:43 | |
luqui | fglock_, of what, with what constraint? | ||
xinming | luqui: hmm, So, If a script extension name is .p5 or .pl5, will this be pharsed as perl 5? | 21:44 | |
luqui | xinming, sure | ||
xinming, just like everything else that isn't .p6 or .pl6 | |||
if it ends with .p5 and starts with "v6" or "use v6", then it's perl 6 | |||
perhaps with a warning on that case | |||
putter mutters "pity there isnt a UNIVERSAL_UNBLESSED"... ints and strings could be validly copied into p6 objects, and arrays and hashes could have methods out of U_UB. | 21:46 | ||
xinming | luqui: Ok, then, I'd suggest to write a simple line with, "we suggest use .px .plx (x = perl version ) name extension instead of .pl(Note: It's not necessary but recommend)." | ||
luqui | xinming, agreed | 21:47 | |
.p5 is clearer than .pl | |||
xinming | luqui: then, you can watch how long will this come to reality. :-) | ||
and also, for .pl the autodetection way is needed, but It will assume it's the newest perl version. | 21:48 | ||
luqui | uh, no. .pl assumes perl 5 | 21:49 | |
because that's when .pl was in use | |||
xinming | luqui: hmm, what's extension for perl 4? | ||
cgi? :-) | |||
luqui | perl 5 is backwards compatible with perl 4, so it doesn't matter | ||
putter | looks like having arrays use methods in ARRAY has been talked about for a decade, but never done. :( | ||
luqui | haha | ||
xinming | or no extension, but use `cat filename | perl` | ||
luqui: perl is amazing, But I think, the extension scheme flexibilty is really needed. as perl isn't like any other language in the world. | 21:50 | ||
luqui: That's just my Humble Opinion. | 21:51 | ||
wolverian | extensions are a hack anyway. | ||
leo__ | what I'm doing wrong: lt@feather:~$ pugs -e'use Set;say "hallo"' | ||
(the plain say "hello" works fine) | 21:52 | ||
luqui | hmm | 21:53 | |
well, this ought to work, but doesn't: | |||
fglock_ | luqui: so Lazy and Eager are roles - I was trying to find out this for days :) | ||
nothingmuch | wow... /me just implemented the forth looping constructs in 10 lines of forth | ||
putter | ARRAY autoload could even give the same "unblessed reference" error. ah well. | ||
luqui | pugs -Mblib6/lib -euse Set' | ||
er, s/-e/-e' | |||
nothingmuch | well, 2/3rds of them | ||
putter is craving ruby just about now... none of this idiocy. | |||
luqui | nothingmuch, cool | ||
xinming | luqui: So, In fact, we can say, How many people there are still using perl 4? In fact, most people will use perl 5, hmm, except for older working scripts. | ||
luqui | putter, what idiocy? | 21:54 | |
nothingmuch | i love the way forth is like that over and over again | ||
i should give it more than an hour a month =( | |||
luqui | oh, the ARRAY stuff and whatnot | ||
fglock_ programmed forth for years | |||
before perl | |||
nothingmuch | fglock_: feather.perl6.org/~nothingmuch/harrorth | 21:55 | |
uh, s/org/nl | |||
specifically feather.perl6.nl/~nothingmuch/harro.../Interp.pm | |||
look for ': BEGIN' | |||
putter | if native p5 arrays behaved as if they were blessed as ARRAY, its not clear anything would be lost (the arguments against I've seen so far have all be flawed), and we wouldnt now have to be designing hoops and struggling to jump through them. the right idea was had by the mid 90's, and yet here we are. :( sigh. | ||
nothingmuch | fglock_: i'm learning forth by implementing it with perl, so that I can implement it better in haskell and learn haskell that way | 21:56 | |
the only problem is that I haven't done enough of this over the past 2 months | 21:57 | ||
luqui | nothingmuch, do you grok monad transforms? | ||
nothingmuch | luqui: nope | ||
luqui | oh | ||
nothingmuch | i know how to use ReaderT | ||
luqui | well, that's a start | ||
nothingmuch | i understand what it's purpose is, and what it does conceptually | 21:58 | |
luqui | I'm writing Monad.pm (for both perl 5 and perl 6) | ||
nothingmuch | but I have no idea how the implementation actually works | ||
cutesy | |||
luqui | autrijus suggested that I have Monad::Transform | ||
leo__ | luqui: nope doesn't (-I neither) | 21:59 | |
luqui | leo__, I know. I just said that it *should* | ||
you could try installing pugs | |||
so it will look in the right place | |||
leo__ | oh, well compiling it | ||
luqui | aha! | 22:00 | |
leo__, I've got it | |||
export PERL6LIB=/home/whatever/pugs/blib6/lib | 22:01 | ||
putter | oh, drat. cant use dot ofcourse. not with &-free subs. sub bar{"bar"} "foo".bar() Back to -->. and wishing p5 had been properly patched. | ||
luqui | putter, I was suggesting that you treat /\.\w+/ as a method | 22:02 | |
and if they don't put space around the ., that's their fault | |||
putter | sigh. I suppose. I hadnt appreciated the incompatibility before. But I guess use Dot; would be ok. | 22:03 | |
nothingmuch | sleepy time | 22:04 | |
putter | use Dot; could also, instead of being p6-specific, fix the unblessed- and non- reference problem, treating them as ARRAY, etc, and then the p6 side of things could twiddle ARRAY. | ||
nothingmuch | all employee meeting at 8 am | ||
xinming | nothingmuch: good night. | ||
nothingmuch hates time zones | |||
putter | good nigh. | ||
luqui | aginite | ||
sleep wellish | |||
putter | surely someone has already done a use Dot before... ?? | ||
luqui | (or welsh, whichever you prefer) | 22:05 | |
xinming | luqui: how the way, How long did @Larry write the "Apocalypse" for perl 6? | ||
nothingmuch | if i sleep in welsh i won't understand anything | ||
xinming | how long had @larry* | ||
luqui | xinming, "the" apocalypse? | ||
xinming | luqui: yes, I mean, the language design should be slowly gathered. | 22:06 | |
luqui | there are eight of them | ||
xinming | luqui: only for perl 6? | ||
... | |||
luqui | let's see, Apocalypse 1 was written 2 Apr 2001 | 22:07 | |
And Apocalypse 12 was written 13 Apr 2004 | |||
so it seems about 3 years | |||
nothingmuch | written or updated? | ||
luqui | written | ||
nothingmuch | oh right, we didn't start till feb of *this* year | 22:08 | |
xinming | luqui: I mean start writing the Apocalypse. | ||
nothingmuch | anyway, mail done... *poof*! | ||
luqui | probably around March 2001 | ||
where'd nothingmuch go? | |||
I wish I could disappear | |||
xinming | no wonder perl 6 succeed in the future. :-) | ||
someone who learnt perl 5 for only 2 weeks, he said, Hi, You see, It's really convient to do something I like computer do. ;-) | 22:09 | ||
luqui: hmm, I believe perl 6 will be easier to program, But harder to grasp the internal. | 22:10 | ||
luqui | xinming, I hope the internals are easier to grasp, being written in perl 6 and all | ||
xinming, but I think the underlying concepts will be a lot harder than perl 5 | |||
but we're trying to make it so that you don't have to learn those | |||
putter | simon wrote an Acme::Dot, but it is "a class can provide ." rather a client can use it on everything. | 22:11 | |
xinming | luqui: hmm, I like to learn the internal rather than use it. :-) | ||
luqui: If I don't wish to know the internal, I think Windows is really good except the blue screen. | 22:12 | ||
luqui: But I don't know when I will know that. :'( | |||
luqui | putter, interesting, and it seems he did it without source filters | ||
putter | sure, just overload '""'... | 22:13 | |
(at least that would be my guess... checking...) | |||
oooo, there is a use overload '.' ! | 22:15 | ||
xinming | luqui: by the way, theoretically, will perl 6 ( not compiled to byte code ) run faster than or equeal with perl 5? | ||
gantrixx | OK, I have a question on a print statement. Here is the print statement | ||
print "3rd card is " ~ $deck.sequence[2].display() ~ " \n"; | |||
why does this result in the following output | |||
4c3rd card is 1 | |||
luqui | xinming, you can't really help but compile it to byte code | 22:16 | |
we're of course trying to make it run faster than perl 5 | |||
but if we can't, then we're giving you mechanisms (like the unboxed types) that you can use to write locally fast code | |||
which is really all you need most of the time | |||
gantrixx, woah, wtf | 22:17 | ||
xinming | luqui: just like perl 6 a rule engine, pharse rules. | ||
pdcawley_ | gantrixx: Probably because display does it's own printing and returns true. | ||
xinming | and compile the rule into byte code. :-) | ||
luqui | pdcawley, ahh yes, that makes sense | 22:18 | |
gantrixx | why would it display the results of the display method before the "3rd card is" string? | ||
luqui | because your statement is equvalent to: | ||
Khisanth | because display executes first | ||
pdcawley_ | Because, obviously, it's evaluated before the print . | ||
luqui | my $str = $deck.sequence[2].display; print "3rd card is $str\n" | ||
gantrixx | Oh, that makes sense | 22:19 | |
and where does the 1 come from? | |||
luqui | the return value of print | ||
gantrixx | display returns nothing | ||
pdcawley_ | Wrong. | ||
Khisanth | subs always return something :) | ||
pdcawley_ | It returns whatever the last executed statement returns. | ||
luqui | the return value of the print in display() | ||
gantrixx | ok, well I don't have a return in the method | ||
luqui | that doesn't mean it doesn't return anything :-) | 22:20 | |
sub foo() { "hello" } say foo; # hello | |||
pdcawley_ should stop doing this. I'm in a foul mood, which is never a good mood to be in when doing tech support. | |||
gantrixx | well it is annoying that it returns it to stdout | ||
Khisanth | it doesn't | ||
luqui | gantrixx, you should have display() return a string | ||
not print it | |||
Khisanth | you printed out the return value | ||
gantrixx | Oh OK, I know then, I should have it return the string | ||
putter | pdcawley_: do you have a feel for why calling methods on unblessed- and non- references continues to be prohibited? | ||
xinming | my @ary; my @ary2 = ( 1, 2, 3, 4, 5, ); @ary = @ary2; | 22:21 | |
pdcawley_ | It is? So I can't write 10.as_roman? | ||
putter | not in p5. | ||
pdcawley_ | Who cares? | ||
xinming | in this example, will the values pass to @ary is a copy? | ||
gantrixx | hmmm, maybe I can just say "return" and have it return nothing | 22:22 | |
luqui | xinming, if you change @ary, @ary2 will not be affected | ||
xinming | luqui: So It's a copy. :-) | ||
luqui | yeah | ||
(just being clear) | |||
QtPlatypus | But only to one leval. | 22:23 | |
pdcawley_ | Yeah, shallow copy. | ||
putter | if the p6-on-p5 backend emphasizes lightweight FFI, the lack causes pain and suffering yet again... | ||
xinming | pdcawley: Do you mean "Copy on write" ? :-) | ||
putter | for people using p5 that is. perhaps that's correctly a "who cares?". | ||
ah well. | 22:24 | ||
pdcawley_ | @ary := @ary2 works if you want to alias 'em. | ||
FFI? | |||
luqui | foreign function interface | ||
as in libffi, but not for C | |||
pdcawley_ | ISTR writing something that would pretty much ensure that all unblessed reference types would autobless into ARRAY/HASH/WHATEVERs, but I can't, for the life of me, remember how I did it. | 22:26 | |
I think evil was involved. | |||
with assitance from some of the hairier parts of overload.pm | 22:28 | ||
putter | a p5 implemtation?!? there have been patches floating around for years, but I dont recall seeing a pure p5 one... | ||
pdcawley_ | I may be going mad. Or it may simply be that I worked out something that I thought should work, but didn't do it. | 22:29 | |
putter | ah, yes. as long as you can source filter, you can use overload and a helper class to fake it. | ||
theorbtw1 | Doesn't autobox do that? | ||
dduncan | quite by accident, my last commit was a nice round number, by computer or comp history terms | ||
pdcawley_ | I don't think it used a source filter. | ||
putter | autobox? | ||
putter goes to search for autobox... | 22:30 | ||
leo__ | ?eval use Set; "ok".say | 22:31 | |
evalbotzy | pugs: *** No compatible subroutine found: "&use" at tmp-Prelude.pm line 38, column 30-59 | ||
theorbtw1 | search.cpan.org/~chocolate/autobox-1.03/ | ||
pdcawley_ | leo: That's not going to work on evalbot -- IO's generally frowned on. | ||
svnbot6 | r6399 | fglock++ | * perl5/ Value - added 'Lazy' and 'Eager' List roles | ||
r6400 | Darren_Duncan++ | updated /LICENSE/GPL-2 so that it reflects the current address of the Free Software Foundation, as seen at www.fsf.org/ ; its whitespace was also cleaned up | |||
putter | oooooo, autobox... search.cpan.org/~chocolate/autobox-...autobox.pm | 22:32 | |
luqui | theorbtw1++ | ||
22:32
theorbtw1 is now known as theorbtwo,
theorbtwo is now known as theorbtw1
|
|||
theorbtw1 | theorbtwo++ | 22:32 | |
pdcawley_ | Bah. It still resorts to XS. | ||
leo__ | pdcawley_: the evalbotzy can't use any modules? | ||
theorbtw1 | theorbtw1-- | ||
22:33
theorbtw1 is now known as theorbtwo
|
|||
pdcawley_ | leo: That does tend to follow. However, I'm not entirely sure of this. Ask whoever wrote it. | 22:33 | |
putter | theorbtw1++ theorbtw1++ theorbtw1++ Yay! | 22:34 | |
pdcawley_: yes, but its all PASS on CPAN testers... | |||
pdcawley_ | That's gloriously evil... a chap could rather like that... | 22:35 | |
putter | ok. so that takes care of that. "when writing p5 code, remember p6 code may return an unblessed- or non- reference value. and you dont have the p6 compiler hiding this from you. so if you want to safely use -> everywhere, you need to use autobox." | 22:39 | |
hows that? | 22:40 | ||
svnbot6 | r6401 | iblech++ | PIL2JS: | ||
r6401 | iblech++ | * PIL::Subs: Slurpy hashes, thanks to xinming++ for reminding me that | |||
r6401 | iblech++ | *%slurpy_hashes exist :) | |||
r6401 | iblech++ | It uses the semantics of | |||
r6401 | iblech++ | www.nntp.perl.org/group/perl.perl6....age/22860, i.e. | |||
r6401 | iblech++ | sub foo (*%hash) {...}, foo(hash => {...}); # works | |||
r6401 | iblech++ | sub foo (*%hash) {...}, foo(hash => {...}, foo => bar); # dies | |||
r6401 | iblech++ | * PIL::Types, PIL::Params: Restored junction autothreading (was broken | |||
r6401 | iblech++ | in certain cases). | |||
theorbtwo | Putter: Why would people expect the perl5 bit of perl5/6 code to act like perl6 code instead of perl5 code? | 22:41 | |
Now, if perl5 code can pass an unblessed reference to perl6, and you can't call methods on it in perl6, that'd be a problem. | 22:44 | ||
pdcawley_ | Because being able to do $arbitrary_thing->isa(...) is just gleefully useful, whatever language you think you're in. | ||
Used to seriously piss me off, having check the blessedness of a reference before doing that. | 22:45 | ||
theorbtwo | Eh, UNIVERSAL::isa($thing, 'class'). | ||
The thing that always annoys me is that it's UNIVERSAL::isa, and not UNIVERSAL::ISA. | |||
pdcawley_ | Which is *so* bloody clunky in mostly OO code. | ||
And sucks satans balls if you need to override isa somewhere. | 22:46 | ||
theorbtwo | I don't use isa much; I generally prefer to just die on errors. | ||
You're 100% right about needing to override isa, though. | |||
pdcawley_ | I had to use it in Pixie, at least until I worked out how to force objects to inherit behaviour from classes associated with their base types. | 22:47 | |
Which is a whole other level of evil involving redefining bless and... | |||
theorbtwo | Wow. | ||
That's some pretty hardcore evil. | 22:48 | ||
pdcawley_ | Well, you just look at the type of the object you're blessing, and, if the class you're blessing it into doesn't inherit from the implementation type, you stick the implementation type on said class's @ISA. | ||
theorbtwo | ...and I've had occasion to want to JMP $scalar. | ||
pdcawley_ | Easy. | ||
The really cunning bit was when we added magic to allow you to store out of band information on an arbitrary scalar. | 22:49 | ||
theorbtwo | OK, really, to want to $functionpointer->(@arguments), where $functionpointer is a /C/ function pointer. | ||
pdcawley_ | Most importantly, any package needed to be able to do it to any scalar. | ||
theorbtwo | Isn't that what attributes are for? | ||
svnbot6 | r6402 | Darren_Duncan++ | /ext/Locale-KeyedText : converted all of my indenting from tab characters to space characters, at 4 spaces per indent level; updated version to 1.6.0 | 22:50 | |
r6403 | iblech++ | * PIL2JS: libjs/PIL2JS.js, pil2js.jspl: Fixed exit() not terminating the | |||
r6403 | iblech++ | program flow if it was used in a sub using PIL2JS.cps2normal. | |||
r6403 | iblech++ | * New t/builtins/io/exit-in-if.t: wrote a test for that. | |||
r6403 | iblech++ | * PIL2JS: PIL::PNil: Very minor cosmetic fix. | |||
pdcawley_ | Theorbtwo: At the time we wrote pixie, we didn't *have* attributes. Not that you could hang off *values* anyway. | ||
And you couldn't use hash keys, because it's not safe. And we wanted to be able to hang data off objects implemented using arbitrary references. | 22:51 | ||
xinming | It's just plain cool, that's why. Oh, and Perl 6 then magically | ||
runs inside every vaguely recent web browser. | |||
so, What does this exactly mean? | |||
pdcawley_ | Pixie does some evil, evil, evil stuff in order to look lovely to its users. | ||
xinming | It's from docs/note/plan | ||
pdcawley_ | Catch is, the locking is broken as designed. | ||
And a complete bastard to fix. | |||
dduncan | pdcawley_, a quick question ... | 22:56 | |
pdcawley_ | Fire away. | ||
dduncan | is pixie and SQL::Translator the same thing or different things? | ||
pdcawley_ | I don't know what SQL::Translator is. | ||
dduncan | just a minute ... | 22:57 | |
pdcawley_ | Definitely not the same thing. | ||
dduncan | oops, pardon me, confused 'pixie' with 'sqlfairy' | 22:58 | |
pdcawley_ | Pixie does object persistence in a single database table. There were plans afoot to allow for dedicated class tables with indexy things, but we never got that far. | ||
dduncan | bad memory, bad@ | ||
! | |||
putter | theorbtwo: (long pause) I'm not sure. The background is considering creating a very-low-overhead FFI version of a p5backend. Which suggests allowing native types, rather than mutating or proxying them at border crossings. Which lead to "what is the cost?". And on the p5 site, one cost was losing the ability to do -> on everything. Unfortunately, within the runtime implementation | ||
pdcawley_ | I hate writing schemas. We wanted a thing you could chuck pretty much any object at and it would Just Store It. | ||
theorbtwo | Well, that seems like a benifit, not a cost: In perl5, stuff acts like perl5. | ||
putter | autobox doesnt really help, because being XS, we will likely need to avoid it for portability. | ||
pdcawley_ | It didn't have queries, it didn't have all sorts of stuff, but it pretty much worked with everything, and the things it didn't work with you could write hooks for. | 22:59 | |
theorbtwo | Sounds lovely, pdc. | ||
putter | yeah. point taken. though it would be nice in the p5 code which implements the runtime, if we could forget that unboxed types are a posibility. | ||
pdcawley_ | But it really, really sucks at concurrency. | 23:00 | |
theorbtwo | Databases annoy me -- my perl code ends being warped to be nice to the database. I'd much rather have the database be warped to be nice to me. | ||
Hm, you could always box upon calling into the p6, but that'd be inefficent. | 23:01 | ||
pdcawley_ | Take a look at pixie. I should really take the time to write a design doc for a concurrency handling system that might actually *work*. | ||
putter | pdcawley_: have you seen www.rubygarden.org/index.cgi/Librar...orial.rdoc | ||
pdcawley_ | Not yet. | 23:02 | |
fglock_ | putter: does PIL makes the unboxed/boxed conversion explicitly, or is it left to the runtime to do? | ||
pdcawley_ | Ruby really wins over perl if you're trying to write an object persistence thing because there's only one way of implementing an object, and there's all sorts of notification features built in. | 23:03 | |
putter | it would have to be a runtime thing. so p5 code could use a module compiled by pugs and call methods without knowing/caring that they were p6-based. | ||
theorbtwo | Well, there's already the argument unpacking code that you generate, no? | ||
pdcawley_ | And having Object be extensible really doesn't hurt in the slightest :) | 23:04 | |
putter | pdcawley_: true. sometimes lots of ways to do something just means "I have to handle _how_ many cases?!" | ||
pdcawley_ | Indeed. | ||
putter | Hopefully PIL as kernel language will help mitigate that. | 23:05 | |
pdcawley_ | I just wrote a rather neat thing in Ruby for generating a composite from an XML tree. Most of the time, you're happy with a basic node type, but some things want to have custom behaviour. Initially I was writing an explicit thing for mapping from XML tags to classes, but they just looked like: 'TagName' => 'Node::TagName', which was tedious. But Ruby lets you notify a class when you subclass it, so I arranged things so that simply making | 23:07 | |
fglock_ | putter: sorry to insist on this, but how about: Int::add( 3, 4 ) - p5 code for saying 3.add(4) | ||
leo__ | pdcawley_: what is the $cookie from $pixie->insert | ||
pdcawley_ | leo__ it's the object id you use to get the object back. | 23:08 | |
Opaque, so it's usually a good idea to insert named 'root' objects. It's been a while, so I can't remember all the methods. | |||
leo__ | valid in that very program only? | ||
putter | fglock_, theorbtwo: I guess the argument goes, if you want to accept natives, then you either tolerate them internally or proxy them as they come in. the main downside being proxies are notably slow. but perhaps that's acceptable. | ||
pdcawley_ | leo: No, persistent. | ||
But generally based to use the 'name_object' (if memory serves) method for that sort of thing. | 23:09 | ||
leo__ | kind of a hash? | ||
value | |||
pdcawley_ | In a web app, you'd save your session data say, and stick the OID in your session cookie. | ||
leo__ | ah ok | ||
putter | fglock_: no sorry needed. i'm thinking fuzzily. it's almost like having a conversation in front of a whiteboard! (wistful sigh) | 23:10 | |
pdcawley_ | I think we just used UUIDs, guaranteed unique, opaque(ish) strings. | ||
putter | fglock_: err, where? I guess it doesnt matter. yes, that should work. Oh, you mean internally... and yes, that should work... | 23:12 | |
putter tries to figure out WHAT he has been thinking... | |||
leo__ | parrot's builtin '$S0 = freeze foo' should simplify these apps vastly | 23:13 | |
theorbtwo | Donno. Will be helpful, but not much more then Storable. | 23:14 | |
The problem is getting things into the database in a mildly sane manner. | |||
putter | Oh, that call is fine if you know you have an Int. But dispatching if there are natives is a pain. (blessed($o) ?? $o->add(4) :: is_scalar_and_number($o) ?? Number::add($o,4) :: ...) | ||
err, s/::/:/ s/??/?/ | 23:15 | ||
leo__ | theorbtwo: true | ||
fglock_ | but that would be a special case, and then you would use the slower dispatch( 'add', 3, 4 ) | 23:17 | |
theorbtwo | fglock: But who is the "you"? | ||
The compiler can't know, and you don't want to force the user to write code like that. | |||
gantrixx | wouldn't as a rule "best practices" practices sort of thing, be better to always reference your attributes, even if not inherited, as $self.attribute? | ||
leo__ | putter: parrot MMD handles that ;-) | 23:18 | |
putter | But regardless. The next steps are the same regardless. Get a metamodel out of pugs/perl5/ and its tests into t/ . Probably Int->new(3) rather than Int->(unboxed=>3) to reduce FFI cost. Then we can add overloads to the mm again reduce FFI cost. And while | ||
this is going on, attempt to write the PIL compiler/evaluator/whatever which uses these objects. | 23:19 | ||
Oh, and using the mm, write the assorted runtime library primitives. | |||
putter just which he didnt have a sneaking suspicion that the flexibility sacrificed by going minimal-FFI wasnt going to bite us later... ?) | 23:20 | ||
leo__: :) | |||
fglock_: all sounds plausible. let's code. :) | 23:21 | ||
leo__ | this means that all optimizations at he 'upper' level are contraproductive | ||
putter | steven: ping? | ||
fglock_: does the minimal-FFI thing of p5: my $i = Int->new(3); print $i+2; # 5 sound plausible? | 23:22 | ||
fglock_ | It might break in MM2, I think it will not export classes to p5 by default. But it can be fixed. | 23:24 | |
I'd make the optimizations later. | |||
putter | fglock_: ok. | 23:25 | |
fglock_ | about $i+2, yes, we can overload Int to do that | ||
but overloading objects is even slower than accessing object methods, I think | 23:26 | ||
putter | leo__: yes. but the current puzzling was over the perl backend, rather than the parrot backend... so were stuck with what perl can/cant do. | 23:27 | |
leo__ | ah ok - sorry for the interruption | ||
putter | fglock_: yes, it is. oh well. it hopefully wont harm the p6 side, and it will allow folks to easily use p6 in their p5 programs, so... | 23:28 | |
leo__: oh, no problem. just took me a while to think "hmm, maybe it _wasnt_ humor..." ;-) | 23:30 | ||
fglock_ | putter: actually people would use $i = Scalar->new(3) - that's a p6 scalar holding an unboxed value | 23:31 | |
putter | what's $i->ref ? | 23:33 | |
fglock_ | that's the class $i belongs to | ||
like ref($i), but in p6 you get the Class object | |||
putter | so in perl5, print Scalar->new(3)->ref(); will say... 'Int'? | 23:34 | |
'int'? | 23:35 | ||
fglock_ | no, it says 'Scalar' when the content is untyped (but I'm not sure if this is correct) | ||
putter | can one still say Int->new(3) when one really wants an Int? | 23:36 | |
fglock_ | sure | ||
putter | k | ||
fglock_ | $i = Scalar->new( Int->new(3) ) - a Scalar holding an Int | 23:37 | |
putter | Scalar->new(Int->new(3))->ref() # 'Int' yes? | ||
fglock_ | yes | ||
putter | k | ||
sounds like a plan | 23:38 | ||
I wonder how we handle the p5 and p6 namespaces. Here it feels like they want to be unified, but that causes collisions. | 23:40 | ||
Maybe P6:: on the p5 side and P5:: on the p6 side? | |||
fglock_ | I should be using Perl6::Value::Int, but that's a lot to type | ||
putter | (to get to the other one) so class P5::Foo {} declares a p5 package Foo. | 23:41 | |
Oh, yeah. Can p5 use Frotz qw(Int Str); ? | 23:42 | ||
use Perl6::Easily qw(Int Str); | 23:43 | ||
theorbtwo | If you're going to do that, make it Int(3) instead of Int->new(3). | ||
fglock_ | Perl6::Value::Int could export $Int so that you call $Int->new(3) | ||
theorbtwo | (Though I suppose there's some int/Int confusion for some people.) | ||
Or it could just export &Int. | 23:44 | ||
Function call overhead is a lot lower then method call overhead. | |||
fglock_ | theorbtwo: looks like a good idea | ||
theorbtwo | I'd still much rather the argument unpacker did it itself, though. | 23:45 | |
fglock_ | theorbtwo: I think the idea is to not need an unpacker | 23:46 | |
theorbtwo | Um, how can you not need an unpacker? | 23:47 | |
What else lets you call sub foo(Int $a, Int $b) as foo({b=>12, a=>3}) ? | 23:48 | ||
theorbtwo shrugs... it's bedtime. | 23:50 | ||
fglock_ | (just thinking aloud) the actual foo is a p6 Sub object. when you call p5 foo() you are calling a wrapper | ||
putter: do you think this make sense? | 23:52 | ||
leo__ thinks that with current p6 design most of HLL interop doesn't work out of the box | 23:56 | ||
fglock_ dinner time | 23:58 |