Re: Flunking tests and failing code

2005-12-05 Thread Brent 'Dax' Royal-Gordon
Luke Palmer <[EMAIL PROTECTED]> wrote: > I wonder if there is a macroey thing that we can do here. That is, > could we make: > > ok(1); > is(1, 1); > like("foo", /foo/); > > Into: > > ok(1); > ok(1 == 1); > ok("foo" ~~ /foo/); > > And lexically analyze the argument to ok()

Re: the $! too global

2005-12-05 Thread Luke Palmer
On 12/5/05, Darren Duncan <[EMAIL PROTECTED]> wrote: > Under the current system, a subroutine argument is an alias for the > container passed to it; The most immediate offender here is the referential passing semantics. Here is a code case: sub foo ($x, &code) { &code(); say

Re: the $! too global

2005-12-05 Thread TSa
HaloO, Luke Palmer wrote: The most immediate offender here is the referential passing semantics. IIRC, the default is to be a read-only ref. Not even local modifications are permitted if the 'is copy' property is missing. Here is a code case: sub foo ($x, &code) { &code();

Re: the $! too global

2005-12-05 Thread Juerd
TSa skribis 2005-12-05 12:32 (+0100): > IIRC, the default is to be a read-only ref. Not even local modifications s/ref/alias/, which you can see as an implicit or automatic reference, but which we usually don't call that. Juerd -- http://convolution.nl/maak_juerd_blij.html http://convolution.nl

Re: the $! too global

2005-12-05 Thread TSa
HaloO, Darren Duncan wrote: The problem is that $! is being treated too much like a global variable and not enough like a lexical variable. Consider the following example: Wasn't the idea to have $! only bound in CATCH blocks? sub foo () { try { die MyMessage.new( 'key' => 'dan

Re: the $! too global

2005-12-05 Thread Nicholas Clark
On Mon, Dec 05, 2005 at 12:32:03PM +0100, TSa wrote: > HaloO, > > Luke Palmer wrote: > >The most immediate offender here is the referential passing semantics. > > IIRC, the default is to be a read-only ref. Not even local modifications > are permitted if the 'is copy' property is missing. > > >

Re: the $! too global

2005-12-05 Thread TSa
HaloO, Nicholas Clark wrote: No, I think not, because the closure on the last line closes over a read/write variable. It happens that read only reference to the same variable is passed into the subroutine, but that's fine, because the subroutine never writes to *its* reference. So, you argue t

Re: scalar/array contexts in perl5 vs. perl6

2005-12-05 Thread Jonathan Scott Duff
On Sun, Dec 04, 2005 at 01:10:44PM -0500, Mike Li wrote: > what is a good translation of the following C into perl6? [snip] > > in perl5, i would've written something like: > > > my $x = 0; my @y = 1..9; @y[$x++]++; print "$x\n"; print "@y\n" > > > but in perl6, the '@' sigil always means list

Re: the $! too global

2005-12-05 Thread Larry Wall
My gut-level feeling on this is that $! is going to end up being an "env" variable like $_. (If you don't know what "env" is then you've not read the conjectural parts of S2 lately.) Then the problem reduces to what you do with an unhandled $! at the end of a lexical scope, which is probably just

Re: Flunking tests and failing code

2005-12-05 Thread Nathan Gray
On Mon, Dec 05, 2005 at 07:54:25AM +, Luke Palmer wrote: > I wonder if there is a macroey thing that we can do here. That is, > could we make: > > ok(1); > is(1, 1); > like("foo", /foo/); > > Into: > > ok(1); > ok(1 == 1); > ok("foo" ~~ /foo/); > > And lexically ana

Re: Flunking tests and failing code

2005-12-05 Thread Ruud H.G. van Tol
Nathan Gray: > Luke Palmer: >> I wonder if there is a macroey thing that we can do here. That is, >> could we make: >> >> ok(1); >> is(1, 1); >> like("foo", /foo/); >> >> Into: >> >> ok(1); >> ok(1 == 1); >> ok("foo" ~~ /foo/); >> >> And lexically analyze the argument

Re: Flunking tests and failing code

2005-12-05 Thread chromatic
On Mon, 2005-12-05 at 07:54 +, Luke Palmer wrote: > I wonder if there is a macroey thing that we can do here. That is, > could we make: > > ok(1); > is(1, 1); > like("foo", /foo/); > > Into: > > ok(1); > ok(1 == 1); > ok("foo" ~~ /foo/); Can you do it without givin