Re: [perl #60044] [BUG?] rethrow just throwing?

2008-10-24 Thread Will Coleda



--
Will "Coke" Coleda

On Oct 23, 2008, at 23:05, "Allison Randal via RT" <[EMAIL PROTECTED] 
> wrote:



Will Coleda (via RT) wrote:


I would expect both of these programs to output the same thing, but  
it

looks like rethrow is generating the same output that throw would
here.

What is the difference supposed to be between these two ops?


The two ops are intentionally almost entirely the same. The only
difference is that 'throw' creates a new iterator of exception  
handlers,

while 'rethrow' pulls the next exception handler off the iterator. So,
'rethrow' cannot be called on an exception that hasn't been thrown
before. And if 'throw' is called on an exception that's already been
thrown before, it will return to the first exception handler again,
instead of the next exception handler in the chain of handlers.


$ cat foo.pir
sub foo :main
 bar()
end

sub bar
 baz()
end

sub baz
 die "eek"
end

$ ../../parrot foo.pir
eek
current instr.: 'baz' pc 24 (foo.pir:10)
called from Sub 'bar' pc 19 (foo.pir:6)
called from Sub 'foo' pc 7 (foo.pir:2)
$ cat bar.pir
sub foo :main
 push_eh eh
   bar()
 pop_eh
 end

eh:
 .get_results($P0)
 rethrow $P0
end

sub bar
 baz()
end

sub baz
 die "eek"
end
$ ../../parrot bar.pir
eek
current instr.: 'foo' pc 16 (bar.pir:9)


I don't understand the problem. Is it that you expect 'rethrow' to  
keep

the stack trace of the original 'die'?

Allison



Yes.






Re: Assigning and passing $/

2008-10-24 Thread Carl Mäsak
Chris (>):
>  I can't assign $/ to a variable or
> pass it to a method.  Is this a bug, or am I just confused?

I think it's a bug. I sent your message along to [EMAIL PROTECTED]

// Carl


Re: Parrot on mobile platforms?

2008-10-24 Thread Mark J. Reed
On Fri, Oct 24, 2008 at 12:00 AM, Allison Randal <[EMAIL PROTECTED]> wrote:
>> That being said, I can't imagine Apple would be terribly keen to
>> endorse anything which requires jail breaking the phone.  Don't we
>> have contacts in Apple?  Getting official approval for trying this
>> out might be a nice thing.  In fact, I already know an iPhone
>> developer who would be a great fit for a challenge like this (if he's
>> interested).
>
> Yes, but the mobile group is completely separate from the open source group.
> Still, it's worth asking.

Depending on how they interpret the SDK policy: ("an application may
not itself install or launch other executable code by any means,
including without limitation through the use of a plug-in
architecture…"), any VM-based app might be verboten on the iPhone.

-- 
Mark J. Reed <[EMAIL PROTECTED]>


Re: [perl #60016] [PATCH] Make basic Perl 6 tests pass

2008-10-24 Thread Patrick R. Michaud
On Thu, Oct 23, 2008 at 08:14:19PM -0700, Allison Randal via RT wrote:
> > a = a ** b  #  pow a, a, b
> > 
> > Before the MMD merge, this opcode meant "raise a to the power
> > of b and store the result back in a".  However, after the mmd
> > branch merge this opcode now means "create a new PMC containing
> > the value of a raised to the b power and set register a to point
> > to that new PMC, leaving the value of its original PMC alone".
> > So, the pow opcode is no longer able to act as an inplace modifier.
> 
> The other math opcodes have two argument versions that call the 'i_' 
> inplace vtable function. I can add these for 'pow' if needed.

I'm not sure that every opcode needs an inplace form.  And in Rakudo's
case it's not likely to matter much, as the (Perl 6) inplace operators 
are unlikely to be able to use Parrot's inplace opcodes anyway.

Thanks,

Pm


Re: [perl #60044] [BUG?] rethrow just throwing?

2008-10-24 Thread Patrick R. Michaud
On Thu, Oct 23, 2008 at 08:04:41PM -0700, Allison Randal wrote:
>
> I don't understand the problem. Is it that you expect 'rethrow' to keep  
> the stack trace of the original 'die'?

...this is what I would expect.  If I catch and then rethrow an
exception, I'd expect the stack trace to continue to show the
location of the original throw, not the location of the
rethrow.

Pm


Re: [perl #60044] [BUG?] rethrow just throwing?

2008-10-24 Thread Mark J. Reed
On Fri, Oct 24, 2008 at 11:21 AM, Patrick R. Michaud <[EMAIL PROTECTED]> wrote:
> On Thu, Oct 23, 2008 at 08:04:41PM -0700, Allison Randal wrote:
>>
>> I don't understand the problem. Is it that you expect 'rethrow' to keep
>> the stack trace of the original 'die'?
>
> ...this is what I would expect.  If I catch and then rethrow an
> exception, I'd expect the stack trace to continue to show the
> location of the original throw, not the location of the
> rethrow.

I agree.  Otherwise, what's the point of 'rethrow'?

-- 
Mark J. Reed <[EMAIL PROTECTED]>


Re: Parrot on mobile platforms?

2008-10-24 Thread ajr
> --- On Thu, 23/10/08, Gabor Szabo <[EMAIL PROTECTED]> wrote:
>
>> Don't you think it would be important to start working
>> in this direction?

What about OpenMoko? Doesn't that run a fairly standard Linux?



--

Email and shopping with the feelgood factor!
55% of income to good causes. http://www.ippimail.com



[perl #60092] $/ cannot be assigned to other vars or passed as a parameter

2008-10-24 Thread Carl Mäsak
# New Ticket Created by  "Carl Mäsak" 
# Please include the string:  [perl #60092]
# in the subject line of all future correspondence about this issue. 
# http://rt.perl.org/rt3/Ticket/Display.html?id=60092 >


Chris Dolan writes the following to p6u:

I'm learning about Match objects today.  I can't assign $/ to a
variable or pass it to a method.  Is this a bug, or am I just
confused?  I get the following results.  In both cases, $/ gets
stringified instead of remaining as a Match instance.

% ./perl6 -e 'if ("f" ~~ m/f/) { my Match $m = $/; }'
Type check failed
[...]

or

% ./perl6 -e 'sub foo(Match $m) { say $m; }; if ("f" ~~ m/f/) { foo($/); }'
Parameter type check failed
[...]

% ./perl6 -v
This is Rakudo Perl 6, revision 32120 built on parrot 0.8.0-devel
for darwin-thread-multi-2level.


[perl #60098] [BUG] "load_bytecode" couldn't find file 'P6object.pbc'

2008-10-24 Thread via RT
# New Ticket Created by  Canol Gökel 
# Please include the string:  [perl #60098]
# in the subject line of all future correspondence about this issue. 
# http://rt.perl.org/rt3/Ticket/Display.html?id=60098 >


After doing the Windows installation via setup-parrot-0.8.0.exe I cannot run 
the perl 6 compiler. When I do for example:

> perl6 example.pl

It gives this error:

"load_bytecode" couldn't find file 'P6object.pbc'
current instr.: 'onload' pc 0 (src/gen_builtins.pir:28)
called from Sub 'parrot;Perl6;Compiler;main' pc -1 ((unknown file):-1)

 Canol Gokel



  

Re: [perl #60092] $/ cannot be assigned to other vars or passed as a parameter

2008-10-24 Thread Moritz Lenz
Carl MXXsak (via RT) wrote:
> # New Ticket Created by  "Carl Mäsak" 
> # Please include the string:  [perl #60092]
> # in the subject line of all future correspondence about this issue. 
> # http://rt.perl.org/rt3/Ticket/Display.html?id=60092 >
> 
> 
> Chris Dolan writes the following to p6u:
> 
> I'm learning about Match objects today.  I can't assign $/ to a
> variable or pass it to a method.

This sounds a lot like
[perl #57094] [BUG] infix:= converts a PGE::Match to a Str, not a Match

>  Is this a bug, or am I just
> confused?  I get the following results.  In both cases, $/ gets
> stringified instead of remaining as a Match instance.
> 
> % ./perl6 -e 'if ("f" ~~ m/f/) { my Match $m = $/; }'
> Type check failed
> [...]
> 
> or
> 
> % ./perl6 -e 'sub foo(Match $m) { say $m; }; if ("f" ~~ m/f/) { foo($/); }'
> Parameter type check failed
> [...]
> 
> % ./perl6 -v
> This is Rakudo Perl 6, revision 32120 built on parrot 0.8.0-devel
> for darwin-thread-multi-2level.


-- 
Moritz Lenz
http://perlgeek.de/ |  http://perl-6.de/ | http://sudokugarden.de/


Re: [perl #60098] [BUG] "load_bytecode" couldn't find file 'P6object.pbc'

2008-10-24 Thread jerry gay
On Fri, Oct 24, 2008 at 8:49 AM, via RT Canol Gökel
<[EMAIL PROTECTED]> wrote:
> # New Ticket Created by  Canol Gökel
> # Please include the string:  [perl #60098]
> # in the subject line of all future correspondence about this issue.
> # http://rt.perl.org/rt3/Ticket/Display.html?id=60098 >
>
>
> After doing the Windows installation via setup-parrot-0.8.0.exe I cannot run 
> the perl 6 compiler. When I do for example:
>
>> perl6 example.pl
>
> It gives this error:
>
> "load_bytecode" couldn't find file 'P6object.pbc'
> current instr.: 'onload' pc 0 (src/gen_builtins.pir:28)
> called from Sub 'parrot;Perl6;Compiler;main' pc -1 ((unknown file):-1)
>
this seems to be a bug, perhaps in the code that generates the perl6
executable. in the meantime, you can remove perl6.exe (in the bin/
dir) and create perl6.cmd (same dir) with the following contents:

  @echo off
  rem adjust the path below to suit your environment
  set PARROT_ROOTDIR=c:\parrot-0.8.0
  %PARROT_ROOTDIR%\bin\parrot.exe %PARROT_ROOTDIR%\languages\perl6\perl6.pbc %*

~jerry


Re: [perl #58392] Recursion and for loops interact badly in Rakudo

2008-10-24 Thread Илья
Hi there!
First of all, please, excuse my bad English. Again :)

This bug still there, in spate of two stable realize of the Parrot.
It`s block our progress on the HTML::Template porting in November
project and correct realization of is_deeply in our Test.pm :(
Unfortunately I am not pir or C or anything but Perl programmer(not
the professional one). I can wright test for that if need.

If any one have time and can help with that, please annihilate that pesky bug.

Thank you!

Ilya

2008/9/12 [EMAIL PROTECTED] via RT <[EMAIL PROTECTED]>:
> Hi,
>
> Here is a pure PIR example that doesn't depend on Rakudo at all.
>
> .sub main :main
>$P0 = new 'Integer'
>$P0 = 2
>'f'($P0)
> .end
>
> .sub 'f'
>.param pmc l
>.lex "$l", l
>$P0 = find_lex "$l"
>if $P0 <= 0 goto ret
>
>print "entering "
>$P1 = find_lex "$l"
>say $P1
>
>$I0 = 1
>  for:
>if $I0 > 3 goto for_end
>'_block1'()
>inc $I0
>goto for
>  for_end:
>  ret:
> .end
>
> .sub '_block1' :outer('f')
>$P2 = find_lex "$l"
>$P3 = new 'Integer'
>$P3 = $P2 - 1
>'f'($P3)
>print "looping in "
>$P4 = find_lex "$l"
>say $P4
> .end
>
> Gives the same erroneous output as the Rakudo program.
>
> Jonathan
>


Parrot 0.8.0, "Pareto Principle" released

2008-10-24 Thread jerry gay
On behalf of the Parrot team, I'm proud to announce Parrot 0.8.0
"Pareto Principle." Parrot (http://parrotcode.org/) is a virtual
machine aimed at running all dynamic languages.

Parrot 0.8.0 is available via CPAN, or follow the download
instructions at http://parrotcode.org/source.html.  For those who
would like to develop on Parrot, or help develop Parrot itself, we
recommend using Subversion on the source code repository to get the
latest and best Parrot code.

Parrot 0.8.0 News:
- Implementation
  + float precision expanded to 15 significant digits from 6
  + large integers autopromoted in PIR so as not to lose precision
  + improved precision of complex square root
  + exception handlers can register types of exceptions they catch
- Languages
  + Cardinal (Ruby)
- implemented gather, take, and yield builtins
- Range, Time, Math, GC, Kernel classes
- many more tests
- added a new committer
  + Markdown : new lightweight markup language
- start implementation with PCT/NQP
  + partcl (Tcl 8.5.4)
- Moved to its own repository: http://code.google.com/p/partcl/
  + Rakudo (Perl 6)
- split() works with regexes
- implemented Str.comb
- ord() and chr() builtins
- improved parsing of literal numbers
- support for hyphens and dashes in identifiers
- next() on for-loops
- fixed floating point constant precision
- improved namespace handling, closer to STD.pm model
- support for exporting symbols
- Compilers
  + P6object
- now generates classes in nested namespaces instead of :: names
- supports class creation in caller's HLL namespace
  + PCT / PGE
- now using true nested namespaces instead of :: names
- cleaned up HLLCompiler interactive prompts and readline mode
- updated to use typed exception handler registration
- added initial support for loop control exceptions
  + PIRC
- fixed Heredoc preprocessor
- cleaned up Macro preprocessor
- many code clean-ups, warning fixes and consting
- updated Makefile for easier compilation
  + IMCC
- Added .tailcall syntax to replace .return in tailcall context
- Examples
  + pirric (BASIC)
- an old style line numbered Basic interpreter able to use parrot objects
- example connecting to mysql via nci
- example using classes to write and run an embedded Basic program
- Documentation
  + Book
- Added chapters for PCT, PMCs, and Opcodes/Runcores
- Expanded and improved formatting in various chapters
- Renumbered chapters


Many thanks to all our contributors for making this possible, and our
sponsors for supporting this project.  Our next scheduled release is
18 Nov 2008.

Enjoy!
~jerry


Re: [perl #60044] [BUG?] rethrow just throwing?

2008-10-24 Thread Allison Randal

Will Coleda wrote:

Allison Randal wrote:


...you expect 'rethrow' to keep the stack trace of the original 'die'?


Yes.


The way to do this is to add stack trace information to the Exception's 
'stacktrace' attribute when the exception is first thrown, and print 
that out for an unhandled exception, instead of printing out the literal 
current path of execution. (This is why I added the 'stacktrace' attribute.)


But, the implementation isn't currently using this feature. Largely, we 
just haven't decided what information to store in 'stacktrace'. I'd say 
a data structure is more useful than a string, because it can be 
manipulated by various HLLs to the format of their stacktrace dumps. So, 
what information do the HLL developers want from the original stack trace?


(I suppose technically we should stop calling this a "stack trace" since 
it's not a stack. But "return continuation chain trace" is just too 
verbose.)


Allison


Re: [perl #58392] Recursion and for loops interact badly in Rakudo

2008-10-24 Thread Moritz Lenz
Илья wrote:
> Hi there!
> First of all, please, excuse my bad English. Again :)
> 
> This bug still there, in spate of two stable realize of the Parrot.
> It`s block our progress on the HTML::Template porting in November
> project and correct realization of is_deeply in our Test.pm :(
> Unfortunately I am not pir or C or anything but Perl programmer(not
> the professional one). I can wright test for that if need.
> 
> If any one have time and can help with that, please annihilate that pesky bug.

To the best of my knowledge Patrick is working on this one on a branch
called `lex'.

Cheers,
Moritz

-- 
Moritz Lenz
http://perlgeek.de/ |  http://perl-6.de/ | http://sudokugarden.de/


Re: [perl #60044] [BUG?] rethrow just throwing?

2008-10-24 Thread Will Coleda
On Fri, Oct 24, 2008 at 3:18 PM, Allison Randal <[EMAIL PROTECTED]> wrote:
> Will Coleda wrote:
>>
>> Allison Randal wrote:
>>>
>>> ...you expect 'rethrow' to keep the stack trace of the original 'die'?
>>
>> Yes.
>
> The way to do this is to add stack trace information to the Exception's
> 'stacktrace' attribute when the exception is first thrown, and print that
> out for an unhandled exception, instead of printing out the literal current
> path of execution. (This is why I added the 'stacktrace' attribute.)
>
> But, the implementation isn't currently using this feature. Largely, we just
> haven't decided what information to store in 'stacktrace'. I'd say a data
> structure is more useful than a string, because it can be manipulated by
> various HLLs to the format of their stacktrace dumps. So, what information
> do the HLL developers want from the original stack trace?
>
> (I suppose technically we should stop calling this a "stack trace" since
> it's not a stack. But "return continuation chain trace" is just too
> verbose.)
>
> Allison
>

I'm not sure tcl has an actual spec on this (since there's just the
one implementation), but I need to be able keep track of HLL
file/line/proc/ and in some cases raw source. here's a sample I was
able to generate with tclsh8.5;

eek
while executing
"error eek"
(procedure "foo::bar" line 2)
invoked from within
"foo::bar"
(file "baz.tcl" line 1)
invoked from within
"source baz.tcl"
(file "bar.tcl" line 2)

tcl also has some global variables that get dragged into the error
handling ($::errorCode, and $::errorInfo); in fact, it's quite
possible that I could roll my own mechanism just by using $::errorInfo
and ignoring the stacktrace entirely.

I'm still interested in the parrot stacktrace for when a -parrot-
error occurs, though; debugging things when the original parrot trace
is clobbered is quite difficult, especially since -t doesn't always
work. (by which I mean fail in the same way as not using it.)

-- 
Will "Coke" Coleda


Re: Parrot 0.8.0, "Pareto Principle" released

2008-10-24 Thread Elyse M. Grasso
On Friday 24 October 2008, jerry gay wrote:
> On behalf of the Parrot team, I'm proud to announce Parrot 0.8.0
> "Pareto Principle." Parrot (http://parrotcode.org/) is a virtual
> machine aimed at running all dynamic languages.
> 
After an svn update and rebuild of parrot and rakudo, I ran 'make spectest' in 
parrot/languages/perl6. Everything passed that wasn't skipped, but the tests 
threw a lot of warnings: mostly a lot of "Use of uninitialized value", but I 
also saw one "Undefined value shifted from empty range".

Is this expected behavior? Or is there something wrong with my setup? (Kubuntu 
8.04)


-- 
Elyse Grasso

http://www.data-raptors.comComputers and Technology
http://www.astraltrading.com   Divination and Science Fiction
http://www.data-raptors.com/global-cgi-bin/cgiwrap/emgrasso/blosxom.cgi WebLog


Re: Parrot 0.8.0, "Pareto Principle" released

2008-10-24 Thread jerry gay
The undefined warnings are known, and due mainly to the tests not
being as carefully written as they should be. I believe there is a
ticket in the rt queue, but i'm not able to search it from my phone.
If nobody beats me to it, i'll point it out when i arrive at my destination.
~jerry


On 10/24/08, Elyse M. Grasso <[EMAIL PROTECTED]> wrote:
> On Friday 24 October 2008, jerry gay wrote:
>> On behalf of the Parrot team, I'm proud to announce Parrot 0.8.0
>> "Pareto Principle." Parrot (http://parrotcode.org/) is a virtual
>> machine aimed at running all dynamic languages.
>>
> After an svn update and rebuild of parrot and rakudo, I ran 'make spectest'
> in
> parrot/languages/perl6. Everything passed that wasn't skipped, but the tests
> threw a lot of warnings: mostly a lot of "Use of uninitialized value", but I
> also saw one "Undefined value shifted from empty range".
>
> Is this expected behavior? Or is there something wrong with my setup?
> (Kubuntu
> 8.04)
>
>
> --
> Elyse Grasso
>
> http://www.data-raptors.comComputers and Technology
> http://www.astraltrading.com   Divination and Science Fiction
> http://www.data-raptors.com/global-cgi-bin/cgiwrap/emgrasso/blosxom.cgi
> WebLog
>

-- 
Sent from Gmail for mobile | mobile.google.com


Re: Parrot 0.8.0, "Pareto Principle" released

2008-10-24 Thread Elyse M. Grasso
OK, Thanks.

On Friday 24 October 2008, jerry gay wrote:
> The undefined warnings are known, and due mainly to the tests not
> being as carefully written as they should be. I believe there is a
> ticket in the rt queue, but i'm not able to search it from my phone.
> If nobody beats me to it, i'll point it out when i arrive at my destination.
> ~jerry
> 
> 
> On 10/24/08, Elyse M. Grasso <[EMAIL PROTECTED]> wrote:
> > On Friday 24 October 2008, jerry gay wrote:
> >> On behalf of the Parrot team, I'm proud to announce Parrot 0.8.0
> >> "Pareto Principle." Parrot (http://parrotcode.org/) is a virtual
> >> machine aimed at running all dynamic languages.
> >>
> > After an svn update and rebuild of parrot and rakudo, I ran 'make 
spectest'
> > in
> > parrot/languages/perl6. Everything passed that wasn't skipped, but the 
tests
> > threw a lot of warnings: mostly a lot of "Use of uninitialized value", but 
I
> > also saw one "Undefined value shifted from empty range".
> >
> > Is this expected behavior? Or is there something wrong with my setup?
> > (Kubuntu
> > 8.04)
> >
> >
> > --
> > Elyse Grasso
> >
> > http://www.data-raptors.comComputers and Technology
> > http://www.astraltrading.com   Divination and Science Fiction
> > http://www.data-raptors.com/global-cgi-bin/cgiwrap/emgrasso/blosxom.cgi
> > WebLog
> >
> 
> -- 
> Sent from Gmail for mobile | mobile.google.com
> 


-- 
Elyse Grasso

http://www.data-raptors.comComputers and Technology
http://www.astraltrading.com   Divination and Science Fiction
http://www.data-raptors.com/global-cgi-bin/cgiwrap/emgrasso/blosxom.cgi WebLog


Argument scoping error or bug?

2008-10-24 Thread Chris Dolan
I stumbled across this issue while descending into a recursive Match  
structure.  Consider the following reentrant subroutine:


sub f($n) {
   for 0..$n -> $i {
   say "$i of 0..$n";
   if ($i == 4) {
  f(0);
   }
   }
};
f(6);


The value of the argument, $n, gets overwritten on reentry.

0 of 0..6
1 of 0..6
2 of 0..6
3 of 0..6
4 of 0..6
0 of 0..0
5 of 0..0
6 of 0..0

The last two lines of output should say "0..6" not "0..0".

Am I supposed to making the sub argument lexical?
   sub f(my $n) { ... }
But Rakudo doesn't like that syntax.

Chris