slurp, quine and context sensitivity

2006-04-08 Thread Dan Kogai
Folks, This is a poetic quine (or quine-maker) in perl5. open myself, $0 and print myself; The same thing in perl6 would be: my $self = open $*PROGRAM_NAME; for =$self { say } or my $self = open $*PROGRAM_NAME; say for =$self; or my $self = slurp $*PROGRAM_NAME; print $self; or

Re: slurp, quine and context sensitivity

2006-04-08 Thread Damian Conway
Dan Kogai wrote: With that understood, I would welcome if we have a version of slurp() which unconditionally returns a scalar. That'd be: ~slurp $file; :-) Damian

Re: [svn:perl6-synopsis] r8609 - doc/trunk/design/syn

2006-04-08 Thread Ruud H.G. van Tol
Larry Wall schreef: before anyone else points it out to me hihi I think the long-dot rule is built into the parser rather than falling out of the longest-token rule. I think so too, but why then cling to the dot? s:p5/[\][#][^\]*[#][\]// (does not match \#\ ) The backslash is

Re: Another dotty idea

2006-04-08 Thread Damian Conway
Larry wrote: I really prefer the form where .#() looks like a no-op method call, and can provide the visual dot for a postfix extender. It also is somewhat less likely to happen by accident the #., I think. And I think the front-end shape of .# is more recognizable as different from #, while

Re: slurp, quine and context sensitivity

2006-04-08 Thread Dan Kogai
On Apr 08, 2006, at 18:45 , Damian Conway wrote: Dan Kogai wrote: With that understood, I would welcome if we have a version of slurp () which unconditionally returns a scalar. That'd be: ~slurp $file; :-) Very clever. But still not good enough when it comes to autoboxing.

Re: slurp, quine and context sensitivity

2006-04-08 Thread Dan Kogai
On Apr 08, 2006, at 19:34 , Dan Kogai wrote: does not. The problem of ~stringify, ?boolify, and +numify is that they are infix operators so it goes the opposite direction. s/infix/prefix/ Sorry. Dan the Perl6 Golfer on the Bunker

Re: slurp, quine and context sensitivity

2006-04-08 Thread Damian Conway
Dan Kogai wrote: ~slurp $file; Very clever. But still not good enough when it comes to autoboxing. { ~slurp }($*PROGRAM_NAME).print and even (~slurp $*PROGRAM_NAME).print works as expected but since ~slurp $file is really ~(slurp $file), $*PROGRAM_NAME.~slurp.print does not.

How do you use a built-in class as a base class?

2006-04-08 Thread Dan Kogai
Folks, With Perl6, we have singleton methods as $me.meta.add_method(me = sub{ ... }); But is there a way to, say, add methods within lexical scope? Take URI on Perl 5. URI behaves both as an object my $uri = URI-new(http://dev.perl.org/perl6/;); print $uri-path; # /perl6/ But it also

Re: Another dotty idea

2006-04-08 Thread Darren Duncan
At 08:38 -0400 8/4/06, John Siracusa wrote: On 4/8/06 6:29 AM, Damian Conway wrote: I'm not enamoured of the .# I must confess. Nor of the #. either. Thank goodness...I was beginning to think it was only me! For the record, I agree with both of you, and that your proposed alternatives are