Re: Test::Harness::Straps - changes?

2005-07-30 Thread Yuval Kogman
On Fri, Jul 29, 2005 at 22:27:29 +0100, Adrian Howard wrote: Earlier today chromatic kindly gave me a gentle tap with the cluestick which let me figure out how to give T::H::S STDERR STDOUT, which means my mates test results are now toddling off to a SQLite database quite happily. By

sub foo ($x) returns ref($x)

2005-07-30 Thread Autrijus Tang
Suppose we have a function that takes an argument and returns something with the same type as that argument. One previous suggestion is this: sub identity ((::a) $x) returns ::a { return(...) } This is fine if both invariants in the the meaning of 'returns' thread are observed, since the

Re: Test::Builder::STDOUT ?

2005-07-30 Thread Adrian Howard
On 30 Jul 2005, at 00:00, Michael G Schwern wrote: [snip] Perhaps you misunderstand. I did I mean to put that BEGIN { *STDERR = *STDOUT } in the test script. foo.t never prints to STDERR. Doh. I would have to put in in a module so I could shim it in with HARNESS_PERL_SWITCHES but

Re: Does it cost anything to use a big pmc everywhere?

2005-07-30 Thread Leopold Toetsch
On Jul 29, 2005, at 18:58, Amir Karger wrote: So I think to avoid these problems I need to declare image at the top of every Z-code sub. My question is, is there any cost associated with always declaring this array holding 50-500K ints, other than having one P register always full? No not at

Re: Test::Harness::Straps - changes?

2005-07-30 Thread Adrian Howard
On 30 Jul 2005, at 01:05, Andy Lester wrote: On Fri, Jul 29, 2005 at 03:57:07PM -0700, Michael G Schwern ([EMAIL PROTECTED]) wrote: This is, IMHO, the wrong place to do it. The test should not be responsible for decorating results, Test::Harness should be. It means you can decorate ANY

say's return value

2005-07-30 Thread Gaal Yahas
What do print and say return? fail would be great on errors. On success, they return 1 now, which doesn't look very useful. How about returning the printed string? Unless called in void context, of course. (This introduces a potential semipredicate problem when looking at the return value of a

$arrayref.ref?

2005-07-30 Thread Ingo Blechschmidt
Hi, http://use.perl.org/~autrijus/journal/25337: deref is now 0-level; $x = 3; $y = \$x; $y++. # now an exception my $arrayref = [1,2,3]; say $arrayref.ref;# Ref or Array? say $arrayref.isa(Ref); # true or false? say $arrayref.isa(Array); # false or true?

Binding scalars to aggregates

2005-07-30 Thread Ingo Blechschmidt
Hi, my @array = a b c; my $arrayref := @array; push $arrayref, c; say [EMAIL PROTECTED]; # a b c d, no problem $arrayref = [d e f]; say [EMAIL PROTECTED]; # d e f, still no problem $arrayref = 42;# !!! 42 is not a Ref of

Binding hashes to arrays?

2005-07-30 Thread Ingo Blechschmidt
Hi, is binding hashes to arrays (or arrays to hashes) legal? If not, please ignore the following questions :) my @array = a b c d; my %hash := @array; say %hasha; # b push @array, e f; say %hashe; # f? %hashX = Y; say [EMAIL PROTECTED]; #

Re: $arrayref.ref?

2005-07-30 Thread Larry Wall
On Sat, Jul 30, 2005 at 02:14:52PM +0200, Ingo Blechschmidt wrote: : Hi, : : http://use.perl.org/~autrijus/journal/25337: : deref is now 0-level; $x = 3; $y = \$x; $y++. # now an exception : : my $arrayref = [1,2,3]; : : say $arrayref.ref;# Ref or Array? Array. : say

Re: Binding scalars to aggregates

2005-07-30 Thread Larry Wall
On Sat, Jul 30, 2005 at 02:33:15PM +0200, Ingo Blechschmidt wrote: : Hi, : : my @array = a b c; : my $arrayref := @array; : : push $arrayref, c; : say [EMAIL PROTECTED]; # a b c d, no problem : : $arrayref = [d e f]; : say [EMAIL PROTECTED];

Re: Binding scalars to aggregates

2005-07-30 Thread Larry Wall
Except that you've rebound the container. Hmm, maybe the original binding is an error. Larry

Re: Binding hashes to arrays?

2005-07-30 Thread Larry Wall
On Sat, Jul 30, 2005 at 02:59:02PM +0200, Ingo Blechschmidt wrote: : Hi, : : is binding hashes to arrays (or arrays to hashes) legal? If not, please : ignore the following questions :) : : my @array = a b c d; : my %hash := @array; : : say %hasha; # b : push @array, e

Re: Binding scalars to aggregates

2005-07-30 Thread Ingo Blechschmidt
Hi, Larry Wall wrote: On Sat, Jul 30, 2005 at 02:33:15PM +0200, Ingo Blechschmidt wrote: : my @array = a b c; : my $arrayref := @array; [...] : $arrayref = 42;# !!! 42 is not a Ref of Array : : Should the last line be treated as : $arrayref = (42,); :

Re: Binding scalars to aggregates

2005-07-30 Thread Ingo Blechschmidt
Hi, Larry Wall wrote: Except that you've rebound the container. Hmm, maybe the original binding is an error. what about: sub foo (Array $arrayref) {...} my @array = a b c d; foo @array; The binding used by the parameter binding code does not use the standard := operator then,

Re: $arrayref.ref?

2005-07-30 Thread Aankhen
On 7/30/05, Larry Wall [EMAIL PROTECTED] wrote: On Sat, Jul 30, 2005 at 02:14:52PM +0200, Ingo Blechschmidt wrote: : say $arrayref.isa(Ref); # true or false? False, though tied($arrayref).isa(Ref) is probably true. In that case, how do you check if something is a ref? `if

Re: say's return value

2005-07-30 Thread chromatic
On Sat, 2005-07-30 at 14:56 +0300, Gaal Yahas wrote: (This introduces a potential semipredicate problem when looking at the return value of a printed 0 or while not using fatal, but the code can use a defined guard.) I don't know if returning the printed string is the right approach, but

Re: say's return value

2005-07-30 Thread Larry Wall
On Sat, Jul 30, 2005 at 09:25:12AM -0700, chromatic wrote: : On Sat, 2005-07-30 at 14:56 +0300, Gaal Yahas wrote: : : (This introduces a potential semipredicate problem when looking at the : return value of a printed 0 or while not using fatal, but the : code can use a defined guard.) : : I

Re: Binding scalars to aggregates

2005-07-30 Thread Larry Wall
On Sat, Jul 30, 2005 at 05:17:29PM +0200, Ingo Blechschmidt wrote: : Hi, : : Larry Wall wrote: : Except that you've rebound the container. Hmm, maybe the original : binding is an error. : : what about: : : sub foo (Array $arrayref) {...} : : my @array = a b c d; : foo @array; :

Re: Test::Harness::Straps - changes?

2005-07-30 Thread chromatic
On Sat, 2005-07-30 at 11:50 +0100, Adrian Howard wrote: I took chromatic to mean that he'd like the test harness to do the decorating... Yep -- that way you don't have to munge whatever formatting Test::Harness::Straps does, you just decorate on a method that does the formatting for you.

Re: say's return value

2005-07-30 Thread Gaal Yahas
On Sat, Jul 30, 2005 at 09:36:13AM -0700, Larry Wall wrote: I don't see any reason to return the string at all. It's almost never wanted, and you can always use .= or monkey but. So: fail on failure bool::true on success? Pugs currently returns bool::true. Is there a way to tag a sub as

module init hooks and pragmas

2005-07-30 Thread Gaal Yahas
What gets called for me when someone uses my module? What gets called when someone nos it? LS11/Importation stipulates a standard syntax for import lists, and that's probably a good thing, but then how do you pass other compile-time requests to code that's being used? Perhaps in light of

Re: Binding scalars to aggregates

2005-07-30 Thread Autrijus Tang
On Sat, Jul 30, 2005 at 09:40:11AM -0700, Larry Wall wrote: Right, so I guess what really happens is ref autogeneration in that case, and there's no difference between $x = @array; $x := @array; Hey, who said anything about consistency? :-) Hm, not exactly. This form: $x =

Definition of containers.

2005-07-30 Thread Autrijus Tang
I have just checked in the container type part of the new PIL runcore: http://svn.openfoundry.org/pugs/src/PIL.hs In the Pugs directory, you can run a sample test with: *PIL tests == %ENV =:= %ENV; True == %ENV =:= %foo; False == untie(%ENV); my %foo := %ENV; ()

Re: Definition of containers.

2005-07-30 Thread Sam Vilain
Autrijus Tang wrote: Containers come in two flavours: Non-tieable and Tieable. Both are typed, mutable references. There is no way in runtime to change the flavour. data Container s a = NCon (STRef s (NBox a)) | TCon (STRef s (TBox a)) A Non-tieable container is comprised