Re: Q: eval

2004-11-09 Thread Dan Sugalski
At 6:23 PM +0100 11/9/04, Leopold Toetsch wrote: Dan Sugalski [EMAIL PROTECTED] wrote: That goto's bogus and shouldn't work. I think it does right now, but I'm OK with making it not work -- it *shouldn't*, since in perl the eval's an anonymous sub, which means you've done a goto out of a sub

Q: eval

2004-11-08 Thread Leopold Toetsch
I'd like to cleanup eval.pmc and dynamic code compiling a bit. But before that I'd like to know: Which granularity do we allow for eval()ed code? Can that be an expression or statement too or is it always at least an (anonymous) subroutine? Does the compiled code see Parrot registers

[perl #31646] [TODO] Compile/eval/whatever system a bit of a muddle

2004-09-20 Thread via RT
, and the associated pmcs (eval, compiler, and so on). -- Dan --it's like this--- Dan Sugalski even samurai [EMAIL PROTECTED] have teddy bears and even

Re: Transferring control between code segments, eval, and suchlike things

2003-01-24 Thread Nicholas Clark
) For an interpreter that is allowing eval (or a namespace that isn't locked against eval) I think that you could only GC the old definition of redefined subroutines, and any anonymous subroutines that become unreferenced. Anything else is the potential lucky destination of a random future eval. Nicholas Clark

Re: Transferring control between code segments, eval, and suchlike things

2003-01-23 Thread Leopold Toetsch
it eval. But: When compile and eval are separate stages, the HL might be able to pull the compile stage out of e.g. loops. So I think keeping compiling and evaling separate makes sense. Thanks for putting this together, leo

Re: Transferring control between code segments, eval, and suchlike things

2003-01-23 Thread Leopold Toetsch
something, then it had darned well better build it and return it. How does this play with eval 'sub bar { change_foo(); } BEGIN { bar(); } (...stuff that depends on foo...)'; ? The semantics of BEGIN{} would seem to require that bar be installed into the symbol table immediately

Re: Transferring control between code segments, eval, and suchlike things

2003-01-23 Thread Jason Gloudon
On Wed, Jan 22, 2003 at 03:00:37PM -0500, Dan Sugalski wrote: Destinations. These are a pain, since if we can go anywhere then the JIT has to do all sorts of nasty and unpleasant things to compensate, and to make every op a valid destination. Yuck. Arbitrary jumps are not that difficult to

RE: Transferring control between code segments, eval, and suchlik e things

2003-01-23 Thread Fisher Mark
Design Edict #3: All destinations *must* be marked as such in the bytecode metadata segment. (I am officially nervous about this, as I can see a number of ways to subvert this for evil) [...] Design Edict #4: Dan is officially iffy on jumps, but can see them as useful for lower-level

Re: Transferring control between code segments, eval, and suchlike things

2003-01-23 Thread Juergen Boemmels
ADDRESS(something). These means that every sub/method/continuation must be marked by #3 Design Edict #6: The first op in a sub is always a valid jump/branch/control transfer destination This is the essentally #3 Now. Eval. The compile opcode going in is phenomenally cool (thanks, Leo!) but has

Re: [perl #20315] [PATCH] eval - inter code segment branches

2003-01-22 Thread Leopold Toetsch
Jason Gloudon wrote: On Tue, Jan 21, 2003 at 08:21:42PM +0100, Leopold Toetsch wrote: # #!/usr/bin/perl -w # my $i= 5; # LAB: #$i++; #eval(goto LAB if ($i==6)); Ok. Having inter_cs call DO_OP just seems more involved than it has to be. Yep. How about a single self-contained

Transferring control between code segments, eval, and suchlike things

2003-01-22 Thread Dan Sugalski
to be hashed out a bit to make them more JIT-friendly, but they're the primary transfer destination point Design Edict #6: The first op in a sub is always a valid jump/branch/control transfer destination Now. Eval. The compile opcode going in is phenomenally cool (thanks, Leo!) but has pointed out some

Re: Transferring control between code segments, eval, and suchlike things

2003-01-22 Thread Dan Sugalski
the JAPHers! Now. Eval. The compile opcode going in is phenomenally cool (thanks, Leo!) but has pointed out some holes in the semantics. I got handwavey and, well, it shows. No cookie for me. The compreg op should compile the passed code in the language that is indicated and should load that bytecode

Re: [perl #20315] [PATCH] eval - inter code segment branches

2003-01-21 Thread Jason Gloudon
On Tue, Jan 21, 2003 at 12:08:29AM +0100, Leopold Toetsch wrote: Here is a proposal for inter code segment jumps: The assembler (imcc) can recognize when a branch ins goes to a different code segment. For such a branch, imcc generates this opcode seqence: inter_cs if i, ic # or

Re: [perl #20315] [PATCH] eval - inter code segment branches

2003-01-21 Thread Leopold Toetsch
if i, ic # or whatever Why do we need branches to go to different code segments ? Because of this nasty piece of little code: t/syn/eval_3.imc: # #!/usr/bin/perl -w # my $i= 5; # LAB: #$i++; #eval(goto LAB if ($i==6)); #print $i\n; # # 7 # .sub _test I1 = 5 $S0

Re: [perl #20315] [PATCH] eval - inter code segment branches

2003-01-21 Thread Jason Gloudon
: # #!/usr/bin/perl -w # my $i= 5; # LAB: #$i++; #eval(goto LAB if ($i==6)); Ok. Having inter_cs call DO_OP just seems more involved than it has to be. How about a single self-contained inter-segment jump instruction. Since the compiler knows when a branch is non-local it can always break

Re: [perl #20315] [PATCH] eval - inter code segment branches

2003-01-20 Thread Leopold Toetsch
Leopold Toetsch wrote: I have it ready. It's based on the packfile patch #18056 by Juergen Boemmels. On top of this patch, it was quite easy to implement multiple code segments. And yet another f'up me. Here is a proposal for inter code segment jumps: The assembler (imcc) can recognize when

Re: [perl #20315] [PATCH] eval

2003-01-20 Thread Leopold Toetsch
Leopold Toetsch wrote: I have it ready. - code is ready for debug information, I'll first do it in imcc, which could generate file/line info on the fly. Next would then be to extend the PBC format. And this is working too in imcc, including gdb-stepping into evaled code segments. Does

[perl #20400] [PATCH] ook.pasm eval

2003-01-19 Thread via RT
# New Ticket Created by Leon Brocard # Please include the string: [perl #20400] # in the subject line of all future correspondence about this issue. # URL: http://rt.perl.org/rt2/Ticket/Display.html?id=20400 It's PASM1, not PASM. However, make test in languages/ook/ still segfaults for me

Re: [perl #20400] [PATCH] ook.pasm eval

2003-01-19 Thread Leopold Toetsch
Leon Brocard (via RT) wrote: # New Ticket Created by Leon Brocard # Please include the string: [perl #20400] # in the subject line of all future correspondence about this issue. # URL: http://rt.perl.org/rt2/Ticket/Display.html?id=20400 It's PASM1, not PASM. However, make test in

Re: [perl #20400] [PATCH] ook.pasm eval

2003-01-19 Thread Leon Brocard
Leopold Toetsch sent the following bits through the ether: No PASM1 is the one-line assembler PDB_compile in debug.c. If you want the whole thing, you have to run imcc instead of parrot and with the PASM compiler, just as the comment states. Oops, I was confused. ook's 'make test' runs with

Re: [perl #20400] [PATCH] ook.pasm eval

2003-01-19 Thread Leopold Toetsch
Leon Brocard wrote: Leopold Toetsch sent the following bits through the ether: Oops, I was confused. ook's 'make test' runs with parrot, so it doesn't work. Yep, I should have changed that in the first place too ;-) ... I've attached a patch to config/gen/makefiles/ook.in to make it work

Re: [perl #20400] [PATCH] ook.pasm eval

2003-01-19 Thread Dan Sugalski
At 6:06 PM + 1/19/03, Leon Brocard wrote: Leopold Toetsch sent the following bits through the ether: No PASM1 is the one-line assembler PDB_compile in debug.c. If you want the whole thing, you have to run imcc instead of parrot and with the PASM compiler, just as the comment states.

Re: [perl #20400] [PATCH] ook.pasm eval

2003-01-19 Thread Dan Sugalski
At 7:38 PM +0100 1/19/03, Leopold Toetsch wrote: IMHO in the near future, the main makefile of parrot should do something equivalent to: $ make $ cd languages/imcc $ make $ cd - $ mv parrot test_main $ cp languages/imcc/imcc parrot No--what we should do in the near future is: $ make $

Re: [perl #20400] [PATCH] ook.pasm eval

2003-01-19 Thread Leopold Toetsch
Dan Sugalski wrote: At 7:38 PM +0100 1/19/03, Leopold Toetsch wrote: IMHO in the near future, the main makefile of parrot should do something equivalent to: $ cp languages/imcc/imcc parrot No--what we should do in the near future is: $ make $ make test and be done with it. imcc

Re: [perl #20315] [PATCH] eval

2003-01-17 Thread Leopold Toetsch
Leopold Toetsch wrote: So it seems, that for multiple code segments, we'll have to take the PackFile_ConstTable out of the structure and include file/line/debug/whatever information. This would look like: packfile aka interpreter-code: - constants - code_segment[] - byte_code -

[CVS ci] eval #1

2003-01-16 Thread Leopold Toetsch
So I did it. Check in the first version of eval. First of all, I changed pdd06_pasm, the compile and compreg opcodes didn't fit really well into - well - my scheme of objects. A compiler is now a Parrot class, derived from NCI, living in interpreter-Parrot_compreg_hash. This also needed a change

Re: [CVS ci] eval #1

2003-01-16 Thread Leopold Toetsch
Leopold Toetsch wrote: So I did it. Check in the first version of eval. Test status: make test succeeds, as well as -P, running the eval progs with JIT or with -t (trace)/-b (bounds) option fails, probably related to messing with the byte code. Fixed. bug in -j was triggered by garbage

Re: [perl #20315] [PATCH] eval

2003-01-15 Thread Leopold Toetsch
Leopold Toetsch (via RT) wrote: # New Ticket Created by Leopold Toetsch # Please include the string: [perl #20315] # in the subject line of all future correspondence about this issue. # URL: http://rt.perl.org/rt2/Ticket/Display.html?id=20315 Attached is a first try towards eval. I have

Re: [perl #20315] [PATCH] eval

2003-01-15 Thread Jerome Quelin
Leopold Toetsch wrote: 1) The call function to the compiler/assembler is kept as a NCI. Better would be a subclass of NCI (Compiler.pmc or so), which provides invoke_keyed(key, next) Hmm, I don't know what a NCI is. Where (which files) can I find information about them? Jerome -- [EMAIL

Re: [perl #20315] [PATCH] eval

2003-01-15 Thread Dan Sugalski
towards eval. - interpreter has a new data member Parrot_compreg_hash - parrot registers the PASM1 type i.e. what PDB_eval can parse - the new Bcompile opcode (ab)uses nci to build a function for calling PDB_eval - nci is extended (jit/i386 only), to understand an 'I' param as interpreter

Re: [perl #20315] [PATCH] eval

2003-01-15 Thread Leopold Toetsch
In perl.perl6.internals, you wrote: Leopold Toetsch wrote: 1) The call function to the compiler/assembler is kept as a NCI. Better would be a subclass of NCI (Compiler.pmc or so), which provides invoke_keyed(key, next) Hmm, I don't know what a NCI is. Where (which files) can I find

Re: [perl #20315] [PATCH] eval

2003-01-15 Thread Leopold Toetsch
--let's try and work that out while I'm churning over objects. I did have a closer look at struct PackFile. I think we have some possiblities to actually eval()/invoke() the code, depending on the HL: - new interpreter, nothing shared (unlikely) - new interpreter, context shared - meaning also

[perl #20315] [PATCH] eval

2003-01-14 Thread via RT
# New Ticket Created by Leopold Toetsch # Please include the string: [perl #20315] # in the subject line of all future correspondence about this issue. # URL: http://rt.perl.org/rt2/Ticket/Display.html?id=20315 Attached is a first try towards eval. - interpreter has a new data member

eval {} or carp blah: $@

2002-05-02 Thread Jim Cromie
with p5, Ive often written eval {} or carp $ blah; it seems to work, and it reads nicer (to my eye) than eval {}; if ($) {} but I surmise that it works cuz the return-value from the block is non-zero, for successful eval, and 0 or undef when block dies, not cuz of magical treatment

Re: eval {} or carp blah: $@

2002-05-02 Thread Luke Palmer
On Thu, 2 May 2002, Jim Cromie wrote: with p5, Ive often written eval {} or carp $ blah; it seems to work, and it reads nicer (to my eye) than eval {}; if ($) {} but I surmise that it works cuz the return-value from the block is non-zero, for successful eval, and 0 or undef when

Re: eval {} or carp blah: $@

2002-05-02 Thread Dave Mitchell
On Thu, May 02, 2002 at 02:33:42PM -0600, Jim Cromie wrote: with p5, Ive often written eval {} or carp $ blah; You generally Don't Want To Do That. If the eval succeeds, but the last statement in the eval happens to come out as false, then it'll still carp: $a = 0; eval { 1

Re: eval {} or carp blah: $@

2002-05-02 Thread Peter Scott
At 02:33 PM 5/2/02 -0600, Jim Cromie wrote: eval {} or carp $ blah; it seems to work, and it reads nicer (to my eye) than eval {}; if ($) {} % perl -le 'eval { print No exceptions here; 0 } or warn $ blah' No exceptions here blah at -e line 1. -- Peter Scott Pacific Systems Design

Re: eval {} or carp blah: $@

2002-05-02 Thread Damian Conway
Jim Cromie wrote: with p5, Ive often written eval {} or carp $ blah; it seems to work, modulo any block that returns false :-( and it reads nicer (to my eye) than eval {}; if ($) {} but I surmise that it works cuz the return-value from the block is non-zero, for successful

Re: new syntax idea: eval ...o;

2001-08-07 Thread John Porter
David L. Nicol wrote: eval ${code}o; Another brilliant idea from David Nicol! However, I'm not keen on the syntax. I'd rather see a different keyword. I'm thinking eval1, but I'm not very creative. :-/ -- John Porter Science class should not end in tragedy.

Re: new syntax idea: eval ...o;

2001-08-07 Thread raptor
David L. Nicol wrote: eval ${code}o; Another brilliant idea from David Nicol! However, I'm not keen on the syntax. I'd rather see a different keyword. I'm thinking eval1, but I'm not very creative. :-/ ]- what about : qe//;# qe{}; OR qo//

Re: new syntax idea: eval ...o;

2001-08-07 Thread Bart Lateur
On Tue, 7 Aug 2001 09:27:43 -0400, John Porter wrote: David L. Nicol wrote: eval ${code}o; Another brilliant idea from David Nicol! Not really. What I would like is an option to just *compile* a piece of perl code, without executing it. This kinda works: $coderef = eval sub

Re: End-of-scope actions: do/eval duality.

2001-02-17 Thread Glenn Linderman
the syntax and semantics of exception handling, so RFC 119 is unaffected. Bart Lateur wrote: On Tue, 13 Feb 2001 11:35:16 -0800, Glenn Linderman wrote: In the perl 5 pocket reference 3rd edition page 63, it claims that $@ is set to the result of an eval or do. How does this impact exception hand

Re: End-of-scope actions: do/eval duality.

2001-02-16 Thread Bart Lateur
On Thu, 15 Feb 2001 10:04:51 -0300, Branden wrote: Why `do FILE' behaves like eval, if there's eval to do it? Isn't this a little too much not-orthogonal? Why don't we require `eval { do FILE }' to have the behaviour of not dying and setting $@ ? The reason for its existence is simple: history

Re: End-of-scope actions: do/eval duality.

2001-02-15 Thread Bart Lateur
On Tue, 13 Feb 2001 11:35:16 -0800, Glenn Linderman wrote: In the perl 5 pocket reference 3rd edition page 63, it claims that $@ is set to the result of an eval or do. How does this impact exception handling tests on $@ to determine if an exception was thrown, if $@ can be set by a do

Re: End-of-scope actions: do/eval duality.

2001-02-15 Thread Branden
[EMAIL PROTECTED] wrote: On Thu, Feb 15, 2001 at 10:04:51AM -0300, Branden wrote: Why `do FILE' behaves like eval, if there's eval to do it? Isn't this a little too much not-orthogonal? Why don't we require `eval { do FILE }' to have the behaviour of not dying and setting

Re: End-of-scope actions: do/eval duality.

2001-02-15 Thread abigail
On Thu, Feb 15, 2001 at 05:58:34PM -0300, Branden wrote: [EMAIL PROTECTED] wrote: On Thu, Feb 15, 2001 at 10:04:51AM -0300, Branden wrote: Why `do FILE' behaves like eval, if there's eval to do it? Isn't this a little too much not-orthogonal? Why don't we require `eval { do FILE

Re: End-of-scope actions: do/eval duality.

2001-02-15 Thread abigail
the do BLOCK form. do FILE behaves just like eval() (except it reads its data from a source file), while do BLOCK doesn't. Neither. Why `do FILE' behaves like eval, if there's eval to do it? Isn't this a little too much not-orthogonal? Why don't we require `eval { do FILE }' to have the

Re: End-of-scope actions: do/eval duality.

2001-02-15 Thread Simon Cozens
On Thu, Feb 15, 2001 at 05:58:34PM -0300, Branden wrote: I find a "let's require some extra hoops and red tape" not very-Perl like. Perl is there for the programmer; not the other way around. Please read ``Larry's talk in Atlanta about Perl 6'', the text is in

Re: End-of-scope actions: do/eval duality.

2001-02-14 Thread Tony Olekshy
Glenn Linderman wrote: Tony Olekshy wrote: Traditionally Perl has had both the "do" and the "eval" block forms, the latter which traps, the former which doesn't. In the perl 5 pocket reference 3rd edition page 63, it claims that $@ is set to the result of an e

End-of-scope actions: do/eval duality.

2001-02-12 Thread Tony Olekshy
John Porter wrote: There is no try, there is only do. :-) Nonsense. Traditionally Perl has had both the "do" and the "eval" block forms, the latter which traps, the former which doesn't. "try" is just a slightly souped-up "eval" that better handl

Re: RFC 339 (v1) caller-eval BLOCK

2000-10-02 Thread David L. Nicol
Greg Williams wrote: as I remember, the Cno scope; pragma, when used, would simply act as if the enclosing scope were not in place, enabling such things as: if ($ints) { no scope; use integer; } Hmm. Cno scope could be implemented in terms of the rfc 340 Cwith like so:

Re: RFC 339 (v1) caller-eval BLOCK

2000-10-02 Thread Greg Williams
At 18:43 -0500 2000/10/02, David L. Nicol wrote: Hmm. Cno scope could be implemented in terms of the rfc 340 Cwith like so: $scope_out_here = with; if ($ints) { with $scope_out_here {use integer} }; Ccaller is about subroutine calls. Interesting! I have a few questions

Re: RFC 351 (v1) Beyond the amnesic eval

2000-09-29 Thread Michael Fowler
On Fri, Sep 29, 2000 at 09:47:00PM -, Perl6 RFC Librarian wrote: Classic eval: eval {} eval "" Unscoped eval +eval {} +eval "" I like the general idea of this RFC, but the proposed syntax is less than desirable. What happens with the following? $res

Re: RFC 339 (v1) caller-eval BLOCK

2000-09-29 Thread Nathan Wiger
caller-eval EXPRESSION; That's mad, bad, scary and dangerous. Let's do it. Yes, this is cool. In fact, I'm writing Regexp::Func right now as a prototype for RFC 164 and discovering I could really use this - in fact, need it. A couple things: 1. Implement this eval as UNIVERSAL

RFC 339 (v1) caller-eval BLOCK

2000-09-28 Thread Perl6 RFC Librarian
This and other RFCs are available on the web at http://dev.perl.org/rfc/ =head1 TITLE caller-eval BLOCK =head1 VERSION Maintainer: David Nicol [EMAIL PROTECTED] Date: 28 Sep 2000 Mailing List: [EMAIL PROTECTED] Number: 339 Version: 1 Status: Developing =head1 ABSTRACT Ccaller

Re: 'eval' odd thought

2000-09-15 Thread Bart Lateur
On Thu, 14 Sep 2000 18:14:49 -0400, Mark-Jason Dominus wrote: The perl 5 - perl 6 translator should replace calls to 'eval' with calls to 'perl5_eval', which will recursively call the 5-6 translator to translate the eval'ed string into perl 6, and will then eval the result. Blech, no. eval

Re: 'eval' odd thought

2000-09-15 Thread Dave Storrs
On Fri, 15 Sep 2000, Bart Lateur wrote: On Thu, 14 Sep 2000 18:14:49 -0400, Mark-Jason Dominus wrote: The perl 5 - perl 6 translator should [recursively handle eval] Blech, no. eval should stay eval. People are responsible for generating Perl6 compatible code, if they construct code

Re: 'eval' odd thought

2000-09-15 Thread Mark-Jason Dominus
eval should stay eval. Yes, and this is the way to do that. When you translate a script, the translator should translate things so that they have the same meanings as they did before. If it doesn't also translate eval, then your Perl 5 scripts will be using the Perl 6 eval, which isn't

Re: 'eval' odd thought

2000-09-15 Thread Bart Lateur
On Fri, 15 Sep 2000 12:01:55 -0400, Mark-Jason Dominus wrote: When you translate a script, the translator should translate things so that they have the same meanings as they did before. If it doesn't also translate eval, then your Perl 5 scripts will be using the Perl 6 eval, which isn't what

Re: $SIG{__DIE__} should be localized and cleared at the start of an eval block

2000-08-25 Thread Peter Scott
My statement: this shouldn't be the programmer's responsibility. If you're using other people's modules that depend on eval, you're in trouble anyway. The "local $SIG{__DIE__};" statement should be implicit at the start of the eval block. Why wouldn't you want to just get rid of

Re: $SIG{__DIE__} should be localized and cleared at the start of an eval block

2000-08-25 Thread Tom Christiansen
Why wouldn't you want to just get rid of the whole construct? Is there any need for it? It seems safer to kill it. --tom

<    1   2   3