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.

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 i

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 yes,

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 te

&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 o

$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 = ; my $arrayref := @array; push $arrayref, "c"; say [EMAIL PROTECTED]; # a b c d, no problem $arrayref = []; say [EMAIL PROTECTED]; # d e f, still no problem $arrayref = 42;# !!! 42 is not a Ref of Array Sho

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 = ; my %hash := @array; say %hash; # b push @array, ; say %hash; # f? %hash = "Y"; say [EMAIL PROTECTED]; # ??? # (o

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 = ; : my $arrayref := @array; : : push $arrayref, "c"; : say [EMAIL PROTECTED]; # a b c d, no problem : : $arrayref = []; : say [EMAIL PROTECTED]; # d e

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 = ; : my %hash := @array; : : say %hash; # b : push @array, ; : say

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 = ; > : my $arrayref := @array; [...] > : $arrayref = 42;# !!! 42 is not a Ref of Array > : > : Should the last line be treated as > : $arrayref = (42,); > : wh

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 = ; foo @array; The binding used by the parameter binding code does not use the standard := operator then, right?

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,

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.)

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 = ; : foo @array; : : The

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 fail

module init hooks and pragmas

2005-07-30 Thread Gaal Yahas
What gets called for me when someone "use"s my module? What gets called when someone "no"s it? L 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 L, we can make "use

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:

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 of

Re: Definition of containers.

2005-07-30 Thread Autrijus Tang
On Sun, Jul 31, 2005 at 02:00:13PM +1200, Sam Vilain wrote: > Tieing a hash would be the same as sub-classing it Sub-classing a container is exactly what tying is all about. That, and not losing the original non-tied storage inbetween ties. > Or is this merely a mechanism for the above? You can

Re: Messing with the type heirarchy

2005-07-30 Thread Luke Palmer
On 7/27/05, Larry Wall <[EMAIL PROTECTED]> wrote: > On Wed, Jul 27, 2005 at 11:00:20AM +, Luke Palmer wrote: >> Everything that is a Num is a Complex right? > > Not according to Liskov. Num is behaving more like a constrained > subtype of Complex as soon as you admit that "isa" is about both

Where's the no-op?

2005-07-30 Thread rocko
I think I might have gotten my x86-64 code generator up in the most minimal sense possible. I managed to build parrot in such a way that it used my own JIT implementation. I implemented Parrot_noop along with Parrot_jit_normal_op. My plan was to test some noop's first before opening up to all be