pugscode.org/ | nopaste: sial.org/pbot/perl6 | ?eval [~] <m oo se> | We do Haskell, too | > reverse . show $ foldl1 (*) [1..4] | irclog: irc.pugscode.org/
Set by diakopter on 11 July 2007.
pugs_svnbot r17197 | lwall++ | [STD] Catch various mistaken uses of p5 special variables. 05:01
r17197 | lwall++ | [cheat] comment out perlhints that pugs can't parse yet
diff: dev.pugscode.org/changeset/17197
lambdabot Title: Changeset 17197 - Pugs - Trac
pugs_svnbot r17198 | moritz++ | [irclog] changed footer.tmpl to be more generic, since other 06:47
r17198 | moritz++ | users don't put their own name in :(
diff: dev.pugscode.org/changeset/17198
lambdabot Title: Changeset 17198 - Pugs - Trac
moritz_ diakopter: I seem to recall that you had a workaround for evalbot with current pugs (with b0rked MMD)... 06:52
diakopter: could you please commit that? I'd like to run it on another host 06:53
Aankhen`` @type (.) 06:58
lambdabot forall b c a. (b -> c) -> (a -> b) -> a -> c
bloonix cool, my first p6 module is ready for use :) 09:57
daxim pix or it didn't happen 10:05
moritz_ bloonix: you should check it into the pugs repository in ext/ 10:08
bloonix moritz_: at first I do some debugging and I have to write a test file 10:11
aber dann gerne :) 10:12
pasteling "bloonix" at 87.78.219.97 pasted "sub example_4 { say "--- Run e" (14 lines, 269B) at sial.org/pbot/26657 10:23
bloonix what is wrong here?
Gothmog_ bloonix: Probably %hash<foo bar> works like @array, eating up everything; I don't know if that's the intended functionality or not. 10:34
bloonix unfortunately I cant find examples in the synopsis :/ 10:35
?eval $x=1;$y=undef; $x+$y 10:39
pugsbot_r17185 Error: ␤Unexpected "="␤expecting "::"␤Variable "$x" requires predeclaration or explicit package name
bloonix ?eval my $x=1;my $y=undef; $x+$y
pugsbot_r17185 1
bloonix should that return an error?
moritz_ I think it should generated a warning, like in p5 10:41
Gothmog_ Grepping for assignment in the synopsis, I couldn't find anything except that list assignment works like in P5. I would expect that (%hash<foo bar>) is similar to (%hash<foo>, %hash<bar>), (like in P5, iirc) but that's just me... 10:42
moritz_ I just know that pugs doesn't implement slice context yet 10:43
bloonix hmmm I could do it (%h<foo>, %h<bar>, $baz) but a slice is nicer :)
shorter
bloonix ?eval my %h; my %c = %h<foo>; 10:52
pugsbot_r17185 {}
bloonix ?eval my %h; my %c = %h<foo>; %c
pugsbot_r17185 {}
bloonix ?eval my %h; my %c = %h<foo>; say %c;
pugsbot_r17185 OUTPUT[␤] Bool::True
bloonix ?eval my %h; my %c := %h<foo>; say %c; 10:53
pugsbot_r17185 OUTPUT[␤] Bool::True
bloonix %c := %h is identical with $c = \%h ? 10:54
bloonix how can I concat strings? 11:38
p5: $x = 'foo' . 'bar' . 'baz'
?eval 'foo' ~ 'bar' ~ 'baz' 11:42
pugsbot_r17185 "foobarbaz"
bloonix fine
demq its too bad that header style string joining isnt ok. 11:45
'foo' 'bar' 'baz' 11:46
convenient for code generation
moritz_ @seen diakopter 11:53
lambdabot diakopter is in #perl6. I don't know when diakopter last spoke.
bloonix yesterday moritz_ 11:54
his last word was "afk" :)
bloonix 21:46 < diakopter> 11:54
moritz_ my lastlog says his last word was "matchee" ;) 11:55
moritz.faui2k3.org/irclog/search.pl...ter&q=
lambdabot Title: IRC logs - Search, tinyurl.com/yuqzcf
bloonix okay "afk" was that what I read at last
bloonix how can I execute system commands? 14:44
p5: open my $h, "$cmd|"
how can I do that? 14:45
*arg* 14:56
Pipe::open
moritz_ where is svnbot? 15:26
bloonix++ # commiting his first p6 module 15:27
avar /U/W 2 15:37
TimToady demq: your code emitter can just emit ~'foo' ~'bar' ~'baz' and it'll do the right thing 15:42
assuming some higher precedence operator doesn't strip your final arg, of course... 15:43
in which case you might want parens
but I'd say in general a code emitter should have a better sense of the structure of what it's doing than to use tricks like that 15:46
I've always been kind of insane about making code emitters produce code that resembles what a human would do 15:47
moritz_ I only do that for HTML "code" ;) 15:48
TimToady whois pugs_svnbot 15:51
hmm 15:52
moritz_ could it be that changes through the web interface aren't recorded by the svnbot? 15:54
rindolf Hi shachaf 15:59
shachaf rindolf: Hello.
rindolf shachaf: what's up? 16:00
shachaf rindolf: I got disconnected from the IRC server sometime yesterday. This is a pretty rare event. :-)
rindolf shachaf: I see. 16:01
moritz_ if I declare a sub/method 'is rw', how can I acces the rvalue? 16:02
demq timtoady: ive found it useful a number of times, but your point about ~'foo'~'bar' is useful. 16:18
s/is useful/resolves the issue i was thinking of/ 16:19
DarkWolf84 there is nobody at the parrot channel 16:53
Tene DarkWolf84: irc.perl.org/#parrot 17:15
that one?
DarkWolf84 no 17:16
that in tis server
this*
DarkWolf84 Are they changed the server? 17:16
Tene That's always been the official parrot channel, as far as I know. 17:18
DarkWolf84 my mistake then 17:19
TimToady moritz_: um, use it in an rvalue context? 18:29
moritz_ TimToady: I mean if I have a sub foo is rw, and then call foo() = $bar; how do I get the value of $bar inside foo(){...} ? 20:04
TimToady you don't exactly; in fact, there's no guarantee that $bar even exists yet at the time foo is called. foo must return an object that has a STORE method of some sort. 20:16
TimToady see S06:249 20:18
we don't follow the getters/setters model because it confuses the identity function of foo() with the operations it supplies 20:19
you'll note our autogenerated methods don't do getters/setters either, unlike Ruby 20:20
TimToady even within a class, if you say $.foo = 42 you can't be sure whether you're setting $!foo directly or calling an lvalue method 20:23
with getters and setters you always have to keep track of whether you're setting a variable or calling a method, and that is a leaky abstraction. 20:24
dduncan I prefer names like fetch|store over get|set myself 20:31
that's one thing Perl 5 got right, contrasted with some other languages 20:32
dduncan (thinking of tie interface) 20:33
diakopter eh - what's wrong with pugsbot 20:45
gtg 20:47
dduncan I have an opinion question concerning numeric literals in Perl 6 ...
in synopsis 2, I see examples like :2<...> or :16<...> etc to specify radix 2 and radix 16 20:48
I'm wondering if there is any room for specifying the radix using a number that is of the same radix as what we want to specify, for consistency ... 20:49
this could be done in a literal using a radix specifier that is the highest value that a single column of a number in that radix could be 20:50
Eidolos :10<10> == 2|3|4|5|6|7|... :)
dduncan so for example, to specify base-2, we say :1<...>, base-10 we have :9<...>, base-16 we have :F<...>, base 35 we have :Z<...> or some such 20:50
that way, the whole thing is in the same base, but it is unambiguous 20:51
rather than the specifier always being base 10
the trade-off is that this only works up to base 36 or so 20:52
assuming just the use of 1..9,A-Z
examples in synopsis 2 would then be :9<42> for 0d42, :F<DEAD_BEEF> for 0xDEADBEEF, 20:54
:1<1.1> for 0b1.1, :7<177777> for 0o177777 20:55
I think doing it that way has a certain level of elegance not present in using base-10 for the radix specifier all the time
what do you think? 20:56
or I'll ask p6l
Eidolos if we do that we may be able to simplify the syntax a little, since there's no need to separate the base from the number 20:57
but in all I think it's a little weird
dduncan sure
in fact we could just say, eg, :F:DEAD_BEEF instead 20:58
or :FDEAD_BEEF
dduncan though keeping the <> retains consistency with other parts of the language 20:59
dduncan TimToady, any thoughts on this ... note that my main suggestion is to use single 1..9A..Z values to specify radix; the other parts of the syntax are orthogonal to my suggestion 21:00
s/values/characters/
as an alteration, if :A-Z might lead to confusion (for some reason) with eg a pair constructor, ... 21:03
perhaps something akin to 0b 0d etc could be used ... 21:04
eg, 0rN
so then, you could say eg 0r11.1 or 0r7177777 or 0rFDEADBEEF ... perhaps with some spacer character added between the N and the payload 21:06
the main point here being that users can then indeed specify numbers with a wide range of radixes using only characters that are actually in the same radix 21:07
regardless, I've decided to adopt such an approach in my Concrete Muldis D language, at least for now ... there eg it would be spelled Int:F:DEADBEEF or Int:9:42 or Int:7:177777 ... or Int:1:10110110 ... so this chat was partly to see if Perl 6 itself might benefit from something similar 21:09
for context, all literals are of format Type:Literal, such as Bool:true or Blob:F:A7017E or Text:'Hello World' 21:11
dduncan seen bloonix 22:33
buubot dduncan: Seen at Sat Aug 4 07:57:03 2007: <bloonix>
dduncan @tell dduncan this is a test
lambdabot You can tell yourself!
dduncan @tell bloonix please include some commit message for your pugs updates so its easier for people to know what you did from looking at the commit log 22:34
lambdabot Consider it noted.
dduncan @tell bloonix I mean, for future commits, give each one a message 22:35
lambdabot Consider it noted.
dduncan in synopsis 5, is <?ws> supposed to match both \s* and \s+ depending what is next to the <?ws> ... if not, I may be seeing a typo 23:04
I'm thinking this example: m/ <?ws> next <?ws> cmd <?ws> = <?ws> <condition>/ 23:05
which it says is effectively m/ \s* next \s+ cmd \s* = \s* <condition>/
TimToady dduncan: yes, <?ws> can match either of those. 23:40
dduncan okay 23:41
TimToady and I think the proposed radix notation kinda sucks visually
dduncan keep in mind that the only important part was the 1-9A-Z part
the other things can be made to whatever looks good
TimToady we certainly can't use :f
dduncan unless you think '1' for base-2 is what looks bad
TimToady I think having something that looks like part of the number that isn't is precisely what sucks 23:42
dduncan so how might you spell eg :F<DEAD_BEEF> without using a '16' or the '0x' ? 23:43
TimToady I don't have any problem with the 16
dduncan admittedly, I considered it a more minor issue, a "wouldn't it be nice if" thing 23:44
TimToady well, sorry, but I think it *wouldn't* be nice...
dduncan but if you prefer base 10 for the radix specifiers all the time, then so be it
TimToady from a psychological point of view
also, why specify base 16 as f, which is off by one?
dduncan I use the F because that is the highest character you can have in a column 23:45
TimToady yes I know, but it still means 15
dduncan its loosely analagous to zero-based array indexes
TimToady where else in the world do we try to make metadata look like the data it describes? 23:46
dduncan descriptions of english text are written in english 23:47
but I don't mean to belabour the issue
I let this matter drop
anyway, right now I'm trying to figure out how to write my first Perl 6 grammar 23:48
by studying synopsis 5 and Std.pm
TimToady have the appropriate amount of fun :)
dduncan some details confuse me, and may or may not be typos ... for example: rule greet { [Hi|Hey|Yo] $<to>:=(\S+?) , $$} ... do square brackets indicate a list of literal tokens here rather than a character class? 23:49
avar list 23:50
dduncan more importantly, right now I'm trying to figure out where to define tokens vs rules vs regexes
TimToady yes, I'd suggest reading S05 before trying to understand STD
dduncan I am focusing on S05
TimToady square brackets are only for grouping now 23:51
you use <[...]> for character classes, or better, named classes
dduncan eg, in some respects, tokens|rules|regexes seem interchangeable sometimes as to which one uses to define something
TimToady you just use which is more convenient
start with a token, and if you find yourself scattering <?ws> all over, then you probably wanted a rule 23:52
avar tokens and rules are just implicit sugar on regexes
TimToady if you want backtracking, you probably wanted a regex
dduncan okay
avar regex { foo : bar } => token { foo bar } 23:53
TimToady there are really only about two places where STD wants backtracking
avar this is also all in s5 I belive:)
dduncan fyi, its the Concrete Muldis D grammar I'm writing, and it is supposed to be extremely simple ... no backtracking, no escapes that the parser should know about
TimToady well, in that case there's no difference, since foo can't backtrack 23:54
dduncan essentially, I'm trying to recode search.cpan.org/dist/Language-Muldi...rammar.pod , with some simplifications, completions, into a Perl 6 grammar
lambdabot Title: Language::MuldisD::Grammar - The string representation format of Muldis D - sear ..., tinyurl.com/23j49y
dduncan it's currently a pseudo-ebnf
dduncan back to Perl 6, one thing I didn't seem to see yet in the synopsis is the means to specify Blob literals 23:58
avar token start { <literal> } token literal { <bool> | ... } regex bool { 'Bool::' : [ 'default' | 'false' | 'true' ] }
and so on
look at some of the grammars in parrot 23:59
TimToady literal words don't need to be quoted
dduncan thank you
one thing I already did was eg: token enum_bool { < false true > }