Re: Should a closure-in-a-string get the placeholder parameters from its surroundings?

2008-11-21 Thread TSa
HaloO, Carl Mäsak wrote: I expected this to DWIM today: $ perl6 -e 'my $cl = { $^name upcased becomes {$^name.uc} }; say $cl(larry)' ...but it doesn't in Rakudo r32938: too few arguments passed (0) - 1 params expected ...and for understandable (if not good) reasons: the closure inside the

S16: chown, chmod

2008-11-21 Thread dpuu
Reading S16, I was struck by the lack of abstraction over the underlying Unix API for chown and chmod. Nothing wrong with having the existing functions lying about in a module that people can use Unix for; but I do feel that the variants in the global namespace should be more user-friendly.

Re: S16: chown, chmod

2008-11-21 Thread Larry Wall
On Fri, Nov 21, 2008 at 08:44:51AM -0800, dpuu wrote: : Reading S16, I was struck by the lack of abstraction over the : underlying Unix API for chown and chmod. Nothing wrong with having the : existing functions lying about in a module that people can use Unix : for; but I do feel that the

Re: S16: chown, chmod

2008-11-21 Thread dpuu
On Nov 21, 9:16 am, [EMAIL PROTECTED] (Larry Wall) wrote: Please feel free to whack on the spec OK, working on it. Question: is it appropriate to P6 lookfeel to have methods on functions? The definition of Cchown includes the statement that it's not available on most system unless you're

Re: S16: chown, chmod

2008-11-21 Thread Larry Wall
On Fri, Nov 21, 2008 at 09:57:30AM -0800, dpuu wrote: : On Nov 21, 9:16 am, [EMAIL PROTECTED] (Larry Wall) wrote: : Please feel free to whack on the spec : : OK, working on it. : : Question: is it appropriate to P6 lookfeel to have methods on : functions? : : The definition of Cchown includes

Re: S16: chown, chmod

2008-11-21 Thread Moritz Lenz
dpuu wrote: Question: is it appropriate to P6 lookfeel to have methods on functions? I don't think that's such a good idea in this case. If a file is chown'able is not a property of the chown function, but of the file. The definition of Cchown includes the statement that it's not available

Re: S16: chown, chmod

2008-11-21 Thread Larry Wall
On Fri, Nov 21, 2008 at 07:30:08PM +0100, Moritz Lenz wrote: : For chmod() I could imagine an interface like this: : : $file.chmod(:8540); : $file.chmod( :set, :user = :r :x, :group = :r) :# both same as 'chmod 540 $file' : : $file.chmod( :modifiy, :other = :!x) :# same as

Re: S16: chown, chmod

2008-11-21 Thread Moritz Lenz
Larry Wall wrote: On Fri, Nov 21, 2008 at 07:30:08PM +0100, Moritz Lenz wrote: : For chmod() I could imagine an interface like this: : : $file.chmod(:8540); : $file.chmod( :set, :user = :r :x, :group = :r) :# both same as 'chmod 540 $file' : : $file.chmod( :modifiy, :other =

multi return values

2008-11-21 Thread Andy Colson
(Sorry if this dbl-posts, sent it from the wrong account the first time) Hi all, what's wrong with this code: use v6; sub multireturn($x, $y) { my $a = $x * 2; my $b = $y * 2; return($a, $b); } my($a, $b) = multireturn(2, 3); using: This is Rakudo Perl 6, revision

Re: multi return values

2008-11-21 Thread Moritz Lenz
Andy Colson wrote: (Sorry if this dbl-posts, sent it from the wrong account the first time) Hi all, what's wrong with this code: use v6; sub multireturn($x, $y) { my $a = $x * 2; my $b = $y * 2; return($a, $b); } my($a, $b) = multireturn(2, 3); There's (nearly)

Re: multi return values

2008-11-21 Thread Andy Colson
Moritz Lenz wrote: Andy Colson wrote: (Sorry if this dbl-posts, sent it from the wrong account the first time) Hi all, what's wrong with this code: use v6; sub multireturn($x, $y) { my $a = $x * 2; my $b = $y * 2; return($a, $b); } my($a, $b) = multireturn(2, 3);

Re: S16: chown, chmod

2008-11-21 Thread dpuu
before I attempt to change the POD, would this wording be appropriate? =item chown our multi chown (Int $uid, Int $gid, Str|IO [EMAIL PROTECTED]) our multi chown (Str $user, Str $group, Str|IO [EMAIL PROTECTED]) Changes the owner (and/or group) of a list of files. The new ownership can

Re: multi return values

2008-11-21 Thread Moritz Lenz
Andy Colson wrote: Moritz Lenz wrote: Andy Colson wrote: (Sorry if this dbl-posts, sent it from the wrong account the first time) Hi all, what's wrong with this code: use v6; sub multireturn($x, $y) { my $a = $x * 2; my $b = $y * 2; return($a, $b); } my($a, $b) =

Re: Should a closure-in-a-string get the placeholder parameters from its surroundings?

2008-11-21 Thread Carl Mäsak
TSa (): I just want to make sure that I got the problem right. Would my $cl = { $^name upcased becomes {$^OUTER::name.uc} }; say $cl(larry) work? The idea is that the embedded closure refers to the strings $^name. And now the dwimmyness shall make that implicit, right? I guess that

Re: multi return values

2008-11-21 Thread Ryan Richter
On Fri, Nov 21, 2008 at 08:16:21PM +0100, Moritz Lenz wrote: Andy Colson wrote: (The thing that's still wrong with your code is that you need a whitespace after the 'my', otherwise my(...) should be parsed as a function call). Also this, I think: return($a, $b); -ryan

Re: Should a closure-in-a-string get the placeholder parameters from its surroundings?

2008-11-21 Thread Larry Wall
On Fri, Nov 21, 2008 at 09:42:41AM +0100, TSa wrote: HaloO, Carl Mäsak wrote: I expected this to DWIM today: $ perl6 -e 'my $cl = { $^name upcased becomes {$^name.uc} }; say $cl(larry)' ...but it doesn't in Rakudo r32938: too few arguments passed (0) - 1 params expected ...and for

Re: multi return values

2008-11-21 Thread Carl Mäsak
Ryan (), Moritz (), Andy (): (The thing that's still wrong with your code is that you need a whitespace after the 'my', otherwise my(...) should be parsed as a function call). Also this, I think: return($a, $b); ...except that that _is_ a function call. // Carl

Re: S16: chown, chmod

2008-11-21 Thread Larry Wall
On Fri, Nov 21, 2008 at 11:46:48AM -0800, dpuu wrote: : before I attempt to change the POD, would this wording be appropriate? It's a good first whack, though we might want to think about making it a little less P5ish/Unixish in changing a list of files, and rely instead of one of P6's

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

2008-11-21 Thread larry
Author: larry Date: Fri Nov 21 15:40:52 2008 New Revision: 14608 Modified: doc/trunk/design/syn/S06.pod Log: typo Modified: doc/trunk/design/syn/S06.pod == --- doc/trunk/design/syn/S06.pod(original) +++

multi return values

2008-11-21 Thread Andy Colson
Hi all, what's wrong with this code: use v6; sub multireturn($x, $y) { my $a = $x * 2; my $b = $y * 2; return($a, $b); } my($a, $b) = multireturn(2, 3); using: This is Rakudo Perl 6, revision 32970 built on parrot 0.8.1-devel for i486-linux-thread-multi. I get:

Re: S16: chown, chmod

2008-11-21 Thread Dave Whipp
The restriction of chown to the superuser is a property of the OS, not the files. The example from the pod is: use POSIX qw(sysconf _PC_CHOWN_RESTRICTED); my $can_chown_giveaway = not sysconf(_PC_CHOWN_RESTRICTED); Thinking about it, perhaps that means that it's a method on $*OS. The use of

Re: S16: chown, chmod

2008-11-21 Thread Dave Whipp
Larry Wall wrote: On Fri, Nov 21, 2008 at 11:46:48AM -0800, dpuu wrote: : before I attempt to change the POD, would this wording be appropriate? It's a good first whack, though we might want to think about making it a little less P5ish/Unixish in changing a list of files, and rely instead of