[perl #42795] [PATCH] NULL function pointer should be a pointer

2007-04-30 Thread Steve Peters
# New Ticket Created by  Steve Peters 
# Please include the string:  [perl #42795]
# in the subject line of all future correspondence about this issue. 
# URL: http://rt.perl.org/rt3/Ticket/Display.html?id=42795 


Index: lib/Parrot/Ops2c/Utils.pm
==
--- lib/Parrot/Ops2c/Utils.pm   (revision 18354)
+++ lib/Parrot/Ops2c/Utils.pm   (working copy)
@@ -680,7 +680,7 @@
 print $fh @{ $self-{op_func_table} };

 print $fh END_C;
-  (op_func$self-{suffix}_t)0  /* NULL function pointer */
+  (op_func$self-{suffix}_t *)0  /* NULL function pointer */
 };


Parrot Bug Summary

2007-04-30 Thread Parrot Bug Summary
Parrot Bug Summary

http://rt.perl.org/rt3/NoAuth/parrot/Overview.html
Generated at Mon Apr 30 13:00:02 2007 GMT
---

  * Numbers
  * New Issues
  * Overview of Open Issues
  * Ticket Status By Version
  * Requestors with most open tickets

---

Numbers

Ticket Counts: 127 new + 436 open = 563
Created this week: 23
Closed this week: 48

---

New Issues

New issues that have not been responded to yet

1 - 2 weeks old
42624 Parrot compiles now but still fails tests.
42617 t/pmc/threads_7.pir hangs indefinitely
42609 [BUG] make html vs. DEVELOPING
2 - 3 weeks old
42536 build error on Linux 2.6.9-023stab041.3-smp
42508 [CAGE] cleanup pmc null tests
42427 [CAGE] cleanup perlcritic errors
42412 Configure.pl things =no is true
42411 [PARTIALPATCH] Building a 32bit parrot on freebsd under amd64 fails.
42393 [TODO] regex - FIXME items in languages/regex/lib/Regex/Grammar.y
3 - 4 weeks old
42385 [TODO] imcc - remove global variable: cur_namespace
42384 [TODO] imcc - check that all the .file text is malloced / freed
42383 [TODO] imcc - if frame-s.file was allocated free it
42382 [TODO] imcc - delete quotes and emit pbc
42381 [TODO] search library path for parrot bytecode when loading
42379 [TODO] adjust register layout in debug_print()
42378 [TODO] explicit exit from debug_break() op is not ok
42377 [TODO] clone interpreter to play into the debugger
42376 [TODO] handle all ready states in add_io_event opcode
42375 [TODO] make pmcinfo op official
42374 [TODO] free results from string_to_cstring() without ugly warnings
42373 [TODO] handle non-integer file descriptors
42372 [TODO] same opcode names should differ (subclass op)
42369 [TODO] optimize pointer loading in saveall()
42360 [TODO]: Unit tests for Parrot::Revision
42356 [TODO] verify $1 didn't change in pic_callr__() op
42355 [TODO] use ARG_MAX in pic_callr__() op
42354 [TODO] preserve type system in pic_inline_sub__() op
42353 [TODO] perform a dynamic lookup if needed in pic_infix__() op
42352 [TODO] fix or remove strange TODO item in hash() op
42350 [TODO] fix kludge in find_type op
42349 [TODO] dotnet - fix various ops for 64 bit architectures
42330 [BUG]: New warning during 'make': MAX redefined
42312 src/pmc/os.pmc: bad use of stat(2) and lstat(2)
42287 [PDD] MMD needs to be in a PDD
42286 [CAGE]: Parrot::Pmc2c::PCCMETHOD constants should be autogenerated
4 - 5 weeks old
42267 [CAGE] Work out how to encourage good editor-independent formatting
  habits
42254 [BUG] Broken I/O on missing file
42230 Parrot::Test Eats Segfaults
5 - 6 weeks old
42040 tools/dev/mk_manifest_and_skip.pl doesn't pick up files that are marked
  svn deleted but not yet committed
42001 [TODO] Rename preturn to PCCRETURN
6 - 7 weeks old
41897 [BUG]: Parrot::Pmc2c::STMRef gets 'subroutine prederef redefined' warning
41893 [BUG] 0.4.9 leaks various .c files into install image, creates PREFIX/
  config, PREFIX/compiler
41888 Perl 6 FAQ text
41875 [PATCH] update io-fsize if lseek exceeds the file boundaries
41874 [PATCH] extended io_mmap implementation
41862 [CAGE] Make a reasonable set of rules for lint
41858 [CAGE] Make a reasonable set of rules for splint
41857 [CAGE] Make a make valgrind target
41833 [TODO] test conv_i2 opcode
41827 ICU endian issues causing test failures.
41826 vtable method 'find_method' not working in PIR
41825 morph vtable method not working in PIR
41802 [BUG] GC errors with PGE (may have failing tests!)
7 - 8 weeks old
41783 [BUG?] main isn't in src/parrot.c
41772 [PATCH] languages/pynie: built-in functions
41765 [TODO] examples embedded in pod should all be parseable
41762 [PATCH] Languages/Pynie functions!
8 - 9 weeks old
41684 [PATCH] Updates for lua
41675 [TODO] Add 'languages/perl6' to unified languages testing
41666 Test PIR and PASM by generating PBC and running it
41634 [TODO] warn and abort make if pbc compatibility has changed
9 - 10 weeks old
41603 [TODO] compilers/imcc/imcc.l different const qualifier
10 - 11 weeks old
41500 [TODO] config - lib directory needs to be set appropriately for 32/64 bit
  archs
41499 [TODO] config - 32/64 bit architecture setting gcc specific
41497 [TODO] config - profiling options are specific to gcc in config/init/
  defaults.pm
41496 [TODO] config - profiling options should have their own step in config/
  init/defaults.pm
11 - 12 weeks old
12 - 13 weeks old
41374 test MMD with non-perl PMCs
41373 Need test for Clone of HLL info
13 - 14 weeks old
14 - 15 weeks old
41310 [CAGE] autogenerated PMC stubs kill compile
41286 [PDD] revisit properties
41280 [PDD] adding methods to subs as objects
15 - 16 weeks old
41265 [TODO] PGE: refactor pod_comment rule into PGE/Util.pbc
41264 [PDD] should properties get serialized?
41263 [PDD] should/can high-level classes be constructed at 

Re: [perl #41168] graceful no compiler error message?

2007-04-30 Thread Andrew Dougherty
On Sun, 29 Apr 2007, James Keenan via RT wrote:

 A participant in this weekend's hackathon in Toronto posed this question:
 
 Invoking the compiler on a simple source file, then checking that the
 generated code exists seems such an obvious test that there must be a
 fatal flaw in it. What am I missing?

Almost nothing.  (Perl5's Configure has the test file generate some known 
output and then checks for that output.)  See the lengthy discussion in 
the RT ticket #41168.  In brief, the idea is sound, but the test needs to 
be written with a great deal of defensive programming and error-checking.  
chromatic made an excellent start, but it ran into some perl-5.6 vs. 
perl-5.8 limitations.  I gather he's since been sidetracked by other 
issues.

It'd be an excellent task for a perl programmer to take on.

-- 
Andy Dougherty  [EMAIL PROTECTED]


Re: [perl #42230] Parrot::Test Eats Segfaults

2007-04-30 Thread chromatic
On Friday 30 March 2007 22:52, chromatic wrote:

 Parrot::Test reports tests that produce the right output but crash instead
 of exiting cleanly as successes.

 The attached patch (not for applying) demonstrates the problematic lines.

 Note that certain tests deliberately feed bad output to Parrot so that it
 will exit with a non-zero status.  Parrot::Test should support both goals
 simultaneously.

 One option is to add an extra option to the test, such as:

   exit = 'unclean'

I used this approach.  Here's a (fairly minimal) patch to Parrot::Test as well 
as a patch for all tests that legitimately expect exits.

If there are no objections, I'll apply this patch in three days.

-- c

=== lib/Parrot/Test.pm
==
--- lib/Parrot/Test.pm	(revision 3327)
+++ lib/Parrot/Test.pm	(local)
@@ -513,9 +513,14 @@
 local *{ $call_pkg . '::TODO' } = \$extra{todo}
 if defined $extra{todo};
 
+unless ($extra{expect_error})
+{
+$real_output .= \nExit code: $exit_code\n if $exit_code;
+}
+
 my $pass = $builder-$meth( $real_output, $expected, $desc );
 $builder-diag('$cmd' failed with exit code $exit_code)
-if $exit_code and not $pass;
+if $exit_code and not $pass and not $extra{expect_error};
 
 unless ( $ENV{POSTMORTEM} ) {
 unlink $out_f;
=== t/compilers/imcc/syn/const.t
==
--- t/compilers/imcc/syn/const.t	(revision 3327)
+++ t/compilers/imcc/syn/const.t	(local)
@@ -418,7 +418,7 @@
 The line above is empty.
 OUT
 
-pir_output_like( 'CODE', 'OUT', PIR heredoc: line numbers );
+pir_output_like( 'CODE', 'OUT', PIR heredoc: line numbers, expect_error = 1 );
 .sub main :main
 .local string s
 .local pmc nil
=== t/compilers/imcc/syn/errors.t
==
--- t/compilers/imcc/syn/errors.t	(revision 3327)
+++ t/compilers/imcc/syn/errors.t	(local)
@@ -46,7 +46,7 @@
 }
 $test_3_pir_code .= .end\n;
 
-pir_output_like( $test_3_pir_code, 'OUT', check parser recovery patience. );
+pir_output_like( $test_3_pir_code, 'OUT', check parser recovery patience., expect_error = 1);
 /Too many errors. Correct some first.\n$/
 OUT
 
=== t/op/debuginfo.t
==
--- t/op/debuginfo.t	(revision 3327)
+++ t/op/debuginfo.t	(local)
@@ -37,7 +37,7 @@
 \d/
 OUTPUT
 
-pir_output_like( 'CODE', 'OUTPUT', debug backtrace - Null PMC access );
+pir_output_like( 'CODE', 'OUTPUT', debug backtrace - Null PMC access, expect_error = 1 );
 .sub main
 print ok 1\n
 a()
@@ -78,7 +78,7 @@
 called from Sub 'main' pc (\d+|-1) \(.*?:(\d+|-1)\)$/
 OUTPUT
 
-pir_output_like( 'CODE', 'OUTPUT', debug backtrace - method not found );
+pir_output_like( 'CODE', 'OUTPUT', debug backtrace - method not found, expect_error = 1 );
 .namespace [Test1]
 .sub main
 print ok 1\n
@@ -101,7 +101,7 @@
 called from Sub 'parrot;Test1;main' pc (\d+|-1) \(.*?:(\d+|-1)\)$/
 OUTPUT
 
-pir_output_like( 'CODE', 'OUTPUT', debug backtrace - fetch of unknown lexical );
+pir_output_like( 'CODE', 'OUTPUT', debug backtrace - fetch of unknown lexical, expect_error = 1 );
 .namespace [Test2]
 .sub main
 print ok 1\n
@@ -137,7 +137,7 @@
 \.\.\. call repeated 1000 times/
 OUTPUT
 
-pir_output_like( 'CODE', 'OUTPUT', debug backtrace - recursion 2 );
+pir_output_like( 'CODE', 'OUTPUT', debug backtrace - recursion 2, expect_error = 1 );
 .sub main
 rec(91)
 .end
=== t/op/stacks.t
==
--- t/op/stacks.t	(revision 3327)
+++ t/op/stacks.t	(local)
@@ -294,7 +294,7 @@
 43
 OUTPUT
 
-pasm_output_is( CODE, 'OUTPUT', 'rotate up by more than stack size' );
+pasm_output_is( CODE, 'OUTPUT', 'rotate up by more than stack size', expect_error = 1 );
 set I0, 1
 save I0
 set I0, 2
@@ -305,7 +305,7 @@
 Stack too shallow!
 OUTPUT
 
-pasm_output_is( CODE, 'OUTPUT', 'rotate down by more than stack size' );
+pasm_output_is( CODE, 'OUTPUT', 'rotate down by more than stack size', expect_error = 1 );
 set I0, 1
 save I0
 set I0, 2
@@ -448,7 +448,7 @@
 done
 OUTPUT
 
-pasm_output_is( CODE, OUTPUT, entrytype, beyond stack depth );
+pasm_output_is( CODE, OUTPUT, entrytype, beyond stack depth, expect_error = 1 );
 save12
 print   ready\\n
 entrytype   I0, 1
=== t/op/string.t
==
--- t/op/string.t	(revision 3327)
+++ t/op/string.t	(local)
@@ -1274,7 +1274,7 @@
  done
 OUTPUT
 
-pasm_output_is( 'CODE', Cannot repeat with negative arg\n, 'repeat OOB' );
+pasm_output_is( 'CODE', Cannot repeat with negative arg\n, 'repeat OOB', expect_error = 1 );
 	repeat S0, japh, -1
 	end
 CODE


Re: S12: can(), signatures and casting

2007-04-30 Thread Larry Wall
On Sun, Apr 29, 2007 at 03:42:31AM -0700, Jonathan Lang wrote:
: Ovid wrote:
: My apologies if these have been answered.  I've been chatting with
: Jonathan Worthington about some of this and any misconceptions are
: mine, not his.
: 
: In reading through S12, I see that .can() returns an iterator for the
: methods matched.  What I'm curious about is this:
: 
:   if $obj.can('fribble') {
: my BadPoet $jibbet = $obj.fribble('repeatedly');
:   }
: 
: Just because $obj.can('fribble') does not mean that the available
: fribble(s) will accept a string argument or return BadPoet instances.
: In chatting with Jonathan about this, he speculated that I would have
: to manually walk the method objects in the iterator to find out if I
: really have a suitable method.  This seems like what we really have is
: $object.might($method).  Is there a simpler way of determining if
: there's an appropriate method for what I need?  It seems like what we
: really want is a method object where I can declare a signature and then
: do this:
: 
:   if $obj.can($object_with_signature){ ... }
: 
: I suppose.  Still, an easier solution might be to allow an optional
: second parameter for .can that takes a signature object:
: 
:  if $obj.can('fribble', :(string - BadPoet)) {
:my BadPoet $jibbet = $obj.fribble('repeatedly');
:  }
: 
: Or you could allow signatures to be attached to strings:
: 
:  # pseudo-code:
:  if $obj.can('fribble':(string - BadPoet)) {
:my BadPoet $jibbet = $obj.fribble('repeatedly');
:  }
: 
: In effect, the signature gets attached as a property of the string,
: and 'can()' checks for the signature property.
: 
: The only problem that I have with this idea is that I can't think of
: any uses for a signatory string outside of '.can()'.

The fundamental problem here is that we're forcing a method name to be
represented as a string.  We're basically missing the foo equivalent
for methods.  Maybe we need to allow the  indirection on method names
too:

if $obj.fribble:(Str -- BadPoet) {

In addition to allowing the :() signature addition already used by
foo syntax, this would also allow for assumed arguments:

callit := $obj.foo.assuming(1,2,3);
callit();

One could go as far as to claim that foo:(Foo: Bar -- Baz) should
be able to figure out that the presence of an invocant means you're
trying to ref a single dispatch to an object that will match type Foo.

Note that we already define foo:(Int, Str) to return a list of candidates
if there's more than one, so extending this from the multi dispatcher
to the single dispatcher just seem like a SMOS (small matter of syntax).

And then we basically just can the .can method since it'd be redundant.

: This raises my second question.  What if I have this?
: 
:   class MadHatter is BadPoet { ... }
: 
: If I get back a MadHatter instead of a BadPoet, but I really want the
: superclass and not a subclass, how can I enforce that?  Do I have to do
: something like this?  (pseudo-code)
: 
: What are you looking for that .is() doesn't provide?  The only thing I
: can think of is that you're trying to insist that $obj's
: implementation be BadPoet - not BadPoet or a class derived from it,
: but BadPoet.  This strikes me as getting into the same territory as
: finalized classes.
: 
:   subset ReallyABadPoet where { $^N.type eq BadPoet }
:   my ReallyABadPoet = $obj.fribble('repeatedly');
: 
: I'll assume that you meant to include a variable name on the second line:
: 
:  subset ReallyABadPoet where { $^N.type eq BadPoet }
:  my ReallyABadPoet $obj2 = $obj.fribble('repeatedly');
: 
: If so, I fail to see what you gain from this, as opposed to:
: 
:  my BadPoet $obj2 = $obj.fribble('repeatedly');
: 
: In this case, $obj2 won't accept the product of
: $obj.fribble('repeatedly') unless that product .does('BadPoet').
: 
: That seems to fail because the you'd have to invoke every method to
: guarantee that you're really getting back the exact type you want.
: 
: As I understand it, Perl 6's typing system does not do duck typing -
: that is, it uses .does() as its primary means of type-checking, not
: .can().  As such, you can check an object's type directly without
: having to examine its set of methods - just scan the set of roles that
: the object composes until you find the role that you're looking for.
: 
: Or am I misunderstanding you?

I see this as almost exactly equivalent to the race conditions you
run into trying to determine if you ought to be able to access a file
without actually trying to access it.  Eventually you just have to
call the silly thing and see if it fails, since (especially with active
code) candidates can decide to fail all on their own after you initiate
the call, and since you don't know how many times that happens compared
to the length of your candidate list, predicting whether there will
be a next candidate to try is something akin to the halting problem.

The  syntax is basically saying, do as much as you can with the
information 

Re: S12: can(), signatures and casting

2007-04-30 Thread Jonathan Lang

Larry Wall wrote:

The fundamental problem here is that we're forcing a method name to be
represented as a string.  We're basically missing the foo equivalent
for methods.  Maybe we need to allow the  indirection on method names
too:

if $obj.fribble:(Str -- BadPoet) {


Takes a little getting used to (it isn't immediately obvious that
you're testing for the existence of a method - at least, not until
you've spent some time thinking about it); but otherwise, I like.

--
Jonathan Dataweaver Lang


Re: S12: can(), signatures and casting

2007-04-30 Thread Jonathan Lang

Larry Wall wrote:

Maybe we need to allow the  indirection on method names too:

if $obj.fribble:(Str -- BadPoet) {


-snip-


Note that we already define foo:(Int, Str) to return a list of candidates
if there's more than one, so extending this from the multi dispatcher
to the single dispatcher just seem like a SMOS (small matter of syntax).


One corollary of this is that querying an object for its available
methods should probably give you a list of coderefs instead of method
names.

What threw me initially was that I wasn't used to thinking of a
coderef as a test for existence - in particular, I couldn't see how
the method's name could be specified using such a syntax.

Another question: what about

 $obj.?fribble:(Str -- BadPoet)
 $obj.*fribble:(Str -- BadPoet)
 $obj.+fribble:(Str -- BadPoet)

As I understand it, placing a ? or * between an object and a method
results in the method only being called if it exists (although I'm not
clear on what happens if it doesn't); placing a * or + between the
object and method calls every version of the method that applies.
Couldn't you just cap one of the former two with a '' to prevent the
resulting methods from actually running?

 $obj.?fribble:(Str -- BadPoet)
 $obj.*fribble:(Str -- BadPoet)
 $obj.+fribble:(Str -- BadPoet)

Or would you have to hyperize the '' in the latter cases?

 $obj.fribble:(Str -- BadPoet) # dies if fribble doesn't work as advertised;
 $obj.?fribble:(Str -- BadPoet) # returns undef instead.
 «$obj.*fribble:(Str -- BadPoet) # returns a list of all fribbles;
 «$obj.+fribble:(Str -- BadPoet) # as above, but fails on an empty list.

Regardless, I agree: can '.can()'.

--
Jonathan Dataweaver Lang