An overview of the Parrot interpreter

2001-09-03 Thread Simon Cozens
Here's the first of a bunch of things I'm writing which should give you practical information to get you up to speed on what we're going to be doing with Parrot so we can get you coding away. :) Think of them as having a Apocalypse-Exegesis relationship to the PDDs. I haven't yet finished

Re: Source/Program metadata from within a program

2001-09-03 Thread Michael G Schwern
On Mon, Sep 03, 2001 at 04:56:28PM +0100, Nick Ing-Simmons wrote: The problem is, it appears DATA is only opened if there's an __END__ or __DATA__ tag. I don't remember it working this way... *shrug* We can fix that easy. :) No you can't - you run out of fd's pretty quick if every .pm

Re: An overview of the Parrot interpreter

2001-09-03 Thread Dan Sugalski
On Sun, 2 Sep 2001, Simon Cozens wrote: For instance, the Parrot VM will have a register architecture, rather than a stack architecture. It will also have extremely low-level operations, more similar to Java's than the medium-level ops of Perl and Python and the like. For those of you

Re: An overview of the Parrot interpreter

2001-09-03 Thread Dave Mitchell
Simon Cozens [EMAIL PROTECTED] wrote: Firstly, a magic number is presented to identify the bytecode file as Parrot code. Hopefully this is followed by a header that has a version number and lots of useful stuff like flags and offsets and things, just like wot real object files have :-) Next

Re: LangSpec: Statements and Blocks

2001-09-03 Thread Davíð Helgason
A few, hopefully relevant thoughts (some of them). Bryan C. Warnock wrote: -- Perl 6 Reference - Statements and Blocks (0.1/2001-09-01) A beauty to behold, this! Syntax Overview Keywords continue, do, else, elsif, for, foreach, given, goto, grep, if, last,

Re: LangSpec: Statements and Blocks

2001-09-03 Thread Bryan C . Warnock
On Monday 03 September 2001 01:06 pm, Davíð Helgason wrote: We will be adding 'try' 'catch'. 'finally' also? (or 'finalize' :-) I've not heard anything definite on this. 16. [ LABEL: ] when expr : { block } # Note 5 [Note 5. 'when' is only a valid construct when

Re: An overview of the Parrot interpreter

2001-09-03 Thread Uri Guttman
KF == Ken Fox [EMAIL PROTECTED] writes: KF Simon Cozens wrote: To be more specific about the software CPU, it will contain a large number of registers. KF The register frames store values, not pointers to values? If KF there's another level of indirection with registers, I'm not

Re: An overview of the Parrot interpreter

2001-09-03 Thread Sam Tregar
On Sun, 2 Sep 2001, Simon Cozens wrote: For instance, the Parrot VM will have a register architecture, rather than a stack architecture. s/rather than/as well as/; # we've got a stack of register frames, right? There will be global and private opcode tables; that is to say, an area of the

RE: An overview of the Parrot interpreter

2001-09-03 Thread Brent Dax
Note: this is my understanding of the situation; I could be wrong. Sam Tregar: # On Sun, 2 Sep 2001, Simon Cozens wrote: # # For instance, the Parrot VM will have a register # architecture, rather # than a stack architecture. # # s/rather than/as well as/; # we've got a stack of register #

Re: Should MY:: be a real symbol table?

2001-09-03 Thread Ken Fox
Brent Dax wrote: Ken Fox: # Lexicals are fundamentally different from Perl's package (dynamically # scoped) variables. *How* are they fundamentally different? Perl's local variables are dynamically scoped. This means that they are *globally visible* -- you never know where the actual

Re: Should MY:: be a real symbol table?

2001-09-03 Thread Dan Sugalski
At 05:44 PM 9/3/2001 -0400, Ken Fox wrote: Brent Dax wrote: What I'm suggesting is that, instead of the padlist's AV containing arrays, it should contain stashes, otherwise indistinguishable from the ones used for global variables. Lexicals are fundamentally different from Perl's package

Re: Should MY:: be a real symbol table?

2001-09-03 Thread Ken Fox
Brent Dax wrote: What I'm suggesting is that, instead of the padlist's AV containing arrays, it should contain stashes, otherwise indistinguishable from the ones used for global variables. Lexicals are fundamentally different from Perl's package (dynamically scoped) variables. Even if you

Re: An overview of the Parrot interpreter

2001-09-03 Thread Dan Sugalski
At 06:37 PM 9/3/2001 -0400, Sam Tregar wrote: On Sun, 2 Sep 2001, Simon Cozens wrote: For instance, the Parrot VM will have a register architecture, rather than a stack architecture. s/rather than/as well as/; # we've got a stack of register frames, right? Well, register in the sense that

Internals Plan

2001-09-03 Thread Bryan C . Warnock
(From this week's summary, plus some additional info) --- The next phase of Parrot will be a code review - for the Perl internals community to poke and prod and make sense of what Dan and Simon have done. The community will provide feedback, and Dan and Simon will disappear for a brief period,

Re: An overview of the Parrot interpreter

2001-09-03 Thread Nathan Torkington
Sam Tregar writes: If our PMC is a string and has a vtable which implements Perl-like string operations, this will return the length of the string. If, on the other hand, the PMC is an array, we might get back the number of elements in the array. (If that's what we want it to do.) Ok,

RE: Should MY:: be a real symbol table?

2001-09-03 Thread Brent Dax
Note: some parts of this may seem a bit like a flame. This is unintentional. Ken Fox: # Brent Dax wrote: # What I'm suggesting is that, instead of the padlist's AV containing # arrays, it should contain stashes, otherwise indistinguishable from # the ones used for global variables. # #

Re: An overview of the Parrot interpreter

2001-09-03 Thread Ken Fox
Dan Sugalski wrote: For those of you worrying that parrot will be *just* low-level ops, don't. There will be medium and high level ops in the set as well. I was going to cite http://citeseer.nj.nec.com/romer96structure.html, but you guys have already read that, eh? ;) One thing I was

Re: An overview of the Parrot interpreter

2001-09-03 Thread Ken Fox
Thanks for the info. If you guys maintain this level of documentation as the code develops, Perl 6 will be easy for first-timers to work on. One goal down, N-1 to go... ;) Simon Cozens wrote: To be more specific about the software CPU, it will contain a large number of registers. The register

Re: Should MY:: be a real symbol table?

2001-09-03 Thread Dan Sugalski
At 08:09 PM 9/3/2001 -0400, Ken Fox wrote: Dan Sugalski wrote: At 05:44 PM 9/3/2001 -0400, Ken Fox wrote: Lexicals are fundamentally different from Perl's package (dynamically scoped) variables. No, actually, they're not. How can you possibly think that lexical scoping and dynamic

Re: An overview of the Parrot interpreter

2001-09-03 Thread Bryan C . Warnock
On Monday 03 September 2001 08:06 pm, Sam Tregar wrote: I think I understand this. What I don't understand is how this relates to the next section about Parrot's special relationship with strings. If Parrot has a string type and string handling functions, why use a PMC to implement a

Re: An overview of the Parrot interpreter

2001-09-03 Thread Sam Tregar
On Mon, 3 Sep 2001, Dan Sugalski wrote: Basically chunks of perl code can define opcodes on the fly--they might be perl subs that meet the proper critera, or opcode functions defined by C code with magic stuck in the parser, or wacky optimizer extensions or whatever. There won't be a single

RE: Should MY:: be a real symbol table?

2001-09-03 Thread Dan Sugalski
At 05:30 PM 9/3/2001 -0700, Brent Dax wrote: As far as expensiveness, I think this can be just as fast as our current offset-into-the-pad method. I was speaking in both speed and memory use when I was talking about expense. We'd need to maintain a hash structure for each pad, plus we'd need to

Where's da code?

2001-09-03 Thread Nathan Torkington
Simon and Dan have been teasing you, I know. I'm holding them back from releasing what they have until: 1) We have a CVS server running. (Ask has done this and is now working on anonymous access). 2) We have a bugtracking system. (We're currently thinking of Bugzilla). 3) We have a

Re: An overview of the Parrot interpreter

2001-09-03 Thread Dan Sugalski
At 08:19 PM 9/3/2001 -0400, Sam Tregar wrote: On Mon, 3 Sep 2001, Dan Sugalski wrote: Basically chunks of perl code can define opcodes on the fly--they might be perl subs that meet the proper critera, or opcode functions defined by C code with magic stuck in the parser, or wacky optimizer

Re: An overview of the Parrot interpreter

2001-09-03 Thread Sam Tregar
On Mon, 3 Sep 2001, Dan Sugalski wrote: avoid using a call opcode all over the place, right? No, more a try and leave the bytecode sections read-only hack. Imagine, if you will, building LWP and bytecode compiling it. It uses private opcodes 1024-1160. Then you later build, say,

Re: Should MY:: be a real symbol table?

2001-09-03 Thread Ken Fox
Dan Sugalski wrote: First, of course, runtime and compiletime are mixed on perl. String eval has to go walk back up the pads *at runtime* and resolve the variable names. Sure, if you use eval, the symbol table for the current scope needs to be available. There's no reason to have more than one

Re: An overview of the Parrot interpreter

2001-09-03 Thread Dan Sugalski
At 09:26 PM 9/3/2001 -0400, Sam Tregar wrote: On Mon, 3 Sep 2001, Dan Sugalski wrote: avoid using a call opcode all over the place, right? No, more a try and leave the bytecode sections read-only hack. Imagine, if you will, building LWP and bytecode compiling it. It uses private

Re: An overview of the Parrot interpreter

2001-09-03 Thread Sam Tregar
On Mon, 3 Sep 2001, Dan Sugalski wrote: I'm not entirely sure how much this'll be used, but I really, *really* want to be able to call any sub that qualifies as an op rather than as a sub. What would a sub have to do (be?) to qualify? I don't understand this restriction. Won't it make

Re: Should MY:: be a real symbol table?

2001-09-03 Thread Ken Fox
Bryan C. Warnock wrote: Except that Perl 6 will have the ability to inject lexical variables in its scope, and in any dynamic parent's scope. (It isn't clear whether that is write-only access or not - which it probably should be for lexicals.) That, invariably, forces at least some

Re: An overview of the Parrot interpreter

2001-09-03 Thread Dan Sugalski
At 09:41 PM 9/3/2001 -0400, Sam Tregar wrote: On Mon, 3 Sep 2001, Dan Sugalski wrote: I'm not entirely sure how much this'll be used, but I really, *really* want to be able to call any sub that qualifies as an op rather than as a sub. What would a sub have to do (be?) to qualify? It'd have

Re: Should MY:: be a real symbol table?

2001-09-03 Thread Dan Sugalski
At 09:58 PM 9/3/2001 -0400, Ken Fox wrote: Bryan C. Warnock wrote: Except that Perl 6 will have the ability to inject lexical variables in its scope, and in any dynamic parent's scope. (It isn't clear whether that is write-only access or not - which it probably should be for lexicals.)

RE: Should MY:: be a real symbol table?

2001-09-03 Thread Brent Dax
# -Original Message- # From: Dan Sugalski [mailto:[EMAIL PROTECTED]] # Sent: Monday, September 03, 2001 5:50 PM # To: Brent Dax; Ken Fox # Cc: Simon Cozens; [EMAIL PROTECTED] # Subject: RE: Should MY:: be a real symbol table? # # # At 05:30 PM 9/3/2001 -0700, Brent Dax wrote: # As far as

Re: Should MY:: be a real symbol table?

2001-09-03 Thread Dan Sugalski
At 09:42 PM 9/3/2001 -0400, Ken Fox wrote: Dan Sugalski wrote: First, of course, runtime and compiletime are mixed on perl. String eval has to go walk back up the pads *at runtime* and resolve the variable names. Sure, if you use eval, the symbol table for the current scope needs to be

Re: Should MY:: be a real symbol table?

2001-09-03 Thread Ken Fox
Dan Sugalski wrote: At 05:44 PM 9/3/2001 -0400, Ken Fox wrote: Lexicals are fundamentally different from Perl's package (dynamically scoped) variables. No, actually, they're not. How can you possibly think that lexical scoping and dynamic scoping are not fundamentally different?! Even

Re: An overview of the Parrot interpreter

2001-09-03 Thread Sam Tregar
On Mon, 3 Sep 2001, Nathan Torkington wrote: Ok, so one example of a PMC is a Perl string... If you grok vtables, think of a PMC as the thing a vtable hangs off. Another way to think of it is that a PMC is an object. To the outside (the interpreter that is manipulating data values) its

Re: Should MY:: be a real symbol table?

2001-09-03 Thread Bryan C . Warnock
On Monday 03 September 2001 08:09 pm, Ken Fox wrote: Dan Sugalski wrote: At 05:44 PM 9/3/2001 -0400, Ken Fox wrote: Lexicals are fundamentally different from Perl's package (dynamically scoped) variables. No, actually, they're not. How can you possibly think that lexical scoping

Re: Prototypes

2001-09-03 Thread Dan Sugalski
At 10:17 PM 9/3/2001 -0400, Bryan C. Warnock wrote: On Monday 03 September 2001 09:30 pm, Dan Sugalski wrote: A clever idea, and one I'd not though of. That's probably the best way to do it. Has some other issues, like do we allow prototypes like: sub foo ($$) {}; to be called as:

Re: Prototypes

2001-09-03 Thread Bryan C . Warnock
On Monday 03 September 2001 10:27 pm, Dan Sugalski wrote: To me, that seems only a language decision. This could certainly handle that. Ah, but calling in the first way has two PMCs in as parameters, while the second has only one. Potentially at least. A world of difference there. A single

Re: Prototypes

2001-09-03 Thread Dan Sugalski
At 10:32 PM 9/3/2001 -0400, Bryan C. Warnock wrote: On Monday 03 September 2001 10:27 pm, Dan Sugalski wrote: To me, that seems only a language decision. This could certainly handle that. Ah, but calling in the first way has two PMCs in as parameters, while the second has only one.

Re: Prototypes

2001-09-03 Thread Bryan C . Warnock
On Monday 03 September 2001 10:46 pm, Dan Sugalski wrote: At 10:32 PM 9/3/2001 -0400, Bryan C. Warnock wrote: On Monday 03 September 2001 10:27 pm, Dan Sugalski wrote: To me, that seems only a language decision. This could certainly handle that. Ah, but calling in the first way

Re: Prototypes

2001-09-03 Thread Dan Sugalski
At 10:11 PM 9/2/2001 -0400, Bryan C. Warnock wrote: On Sunday 02 September 2001 07:49 pm, Dan Sugalski wrote: On Sun, 2 Sep 2001, Bryan C. Warnock wrote: Are prototypes going to be checked at runtime now? For methods, at least. Dunno about subs, that's Larry's call. I could make a good

Re: Multiple-dispatch on functions

2001-09-03 Thread Dan Sugalski
At 07:46 AM 9/2/2001 +0100, Piers Cawley wrote: Dan Sugalski [EMAIL PROTECTED] writes: Nope, the cost will be paid on all sub calls. We at least need to check on every sub call to see if there are multiple versions of the functions. (We can't tell at compile time if it's a single or

Re: My, our, thems-over-theres.....

2001-09-03 Thread Bryan C . Warnock
A while ago, I posted some inconsistencies with scope declarators. (http:[EMAIL PROTECTED]/msg08028.html) A few more related notions $a = test; { chop(my $a = our $a = hello); # The lexical is chopped print 1-$a\n; # But the global is printed } print 2-$a\n; #

Re: Should MY:: be a real symbol table?

2001-09-03 Thread Dan Sugalski
At 10:50 PM 9/3/2001 -0400, Ken Fox wrote: Dan Sugalski wrote: Oh, it gets better. Imagine injecting a lexically scoped sub into the caller's lexical scope. Overriding one that's already there. (Either because it was global, or because it was lexically defined at the same or higher level)

Re: Should MY:: be a real symbol table?

2001-09-03 Thread Nathan Torkington
Dan Sugalski writes: Needless to say, this makes the optimizer's job... interesting. On the other hand, it does allow for some really powerful things to be done by code at runtime. The big thing I want it for is so I can write nats_settings.pm: # nats_settings.pm - turn on strict and

Re: Should MY:: be a real symbol table?

2001-09-03 Thread Ken Fox
Dan Sugalski wrote: Good. It should. It's a scary feature, and hopefully that same fear will strike anyone else who uses it But all it takes is one fool^Wbrave person to mess up somebody else's perfectly working code. Basically I think this throws us back to the bad old days when we only had

Re: Should MY:: be a real symbol table?

2001-09-03 Thread Dan Sugalski
At 11:35 PM 9/3/2001 -0400, Ken Fox wrote: Dan Sugalski wrote: Good. It should. It's a scary feature, and hopefully that same fear will strike anyone else who uses it But all it takes is one fool^Wbrave person to mess up somebody else's perfectly working code. Basically I think this throws

Re: An overview of the Parrot interpreter

2001-09-03 Thread Uri Guttman
BD == Brent Dax [EMAIL PROTECTED] writes: BD # s/rather than/as well as/; # we've got a stack of register BD # frames, right? BD IIRC, that's mostly for when we run out of registers or we're changing BD scopes or whatever. For the most part, it's a register architecture. as dan has

RE: Should MY:: be a real symbol table?

2001-09-03 Thread Dan Sugalski
At 07:05 PM 9/3/2001 -0700, Brent Dax wrote: # From: Dan Sugalski [mailto:[EMAIL PROTECTED]] # At 05:30 PM 9/3/2001 -0700, Brent Dax wrote: # As far as expensiveness, I think this can be just as fast as # our current # offset-into-the-pad method. # # I was speaking in both speed and memory use

RE: Should MY:: be a real symbol table?

2001-09-03 Thread Brent Dax
--Brent Dax [EMAIL PROTECTED] ...and if the answers are inadequate, the pumpqueen will be overthrown in a bloody coup by programmers flinging dead Java programs over the walls with a trebuchet. # -Original Message- # From: Dan Sugalski [mailto:[EMAIL PROTECTED]] # Sent: Monday,

Re: An overview of the Parrot interpreter

2001-09-03 Thread Uri Guttman
ST == Sam Tregar [EMAIL PROTECTED] writes: * Integer, String, and Number registers 0-x are used to pass parameters when the compiler calls routines. ST s/compiler/interpreter/, right? nope. he means when the compiler generates op codes. the compiler will generate code to put the op

Re: Should MY:: be a real symbol table?

2001-09-03 Thread Dan Sugalski
At 09:57 PM 9/3/2001 -0400, Bryan C. Warnock wrote: On Monday 03 September 2001 09:57 pm, Dan Sugalski wrote: Oh, it gets better. Imagine injecting a lexically scoped sub into the caller's lexical scope. Overriding one that's already there. (Either because it was global, or because it was

Re: Deoptimizations

2001-09-03 Thread Dan Sugalski
At 01:57 PM 9/2/2001 -0400, Ken Fox wrote: Bryan C. Warnock wrote: I think the only way your going to be able to detect dynamic redefinitions is dynamically. :-) Not really. Does the program include string eval? That throws out optimizations like folding and dead code elimination that use

Re: Should MY:: be a real symbol table?

2001-09-03 Thread Ken Fox
Dan Sugalski wrote: Oh, it gets better. Imagine injecting a lexically scoped sub into the caller's lexical scope. Overriding one that's already there. (Either because it was global, or because it was lexically defined at the same or higher level) Needless to say, this makes the optimizer's

Re: LangSpec: Statements and Blocks [first,last]

2001-09-03 Thread Damian Conway
iVAN wrote: As we read in Damian Conway- Perl6-notes, there will be ...may be... (Remember, I'm only the shambling henchman ;-) a var-iterator that can be used to see how many times the cycle has been traversed i.e. foreach my $el (@ary) { .. do something

Re: Prototypes

2001-09-03 Thread Dan Sugalski
At 11:47 PM 9/3/2001 -0400, Ken Fox wrote: Bryan C. Warnock wrote: { my $a = sub ($$) { code }; gork($a); } sub gork { my ($a) = shift; $a-(@some_list); # - Here } The reason prototypes aren't checked at Here is because there really isn't a way to know

Re: Prototypes

2001-09-03 Thread Damian Conway
But since the current prototyping system... has a highly positive pressure gradient compared to the surrounding air, Well...I think it's more a problem of I do no' thin' dat word means wha' you thin' it means. People want prototypes to be parameter type specifiers, when they're actually

Re: Prototypes

2001-09-03 Thread Damian Conway
Are prototypes going to be checked at runtime now? For methods, at least. Dunno about subs, that's Larry's call. I could make a good language case for and against it. It adds overhead on sub calls, which is a bad thing generally. I would strongly like to see a guarantee

Re: What's up with %MY?

2001-09-03 Thread Damian Conway
I haven't seen details in an Apocalypse, but Damian's Perl 6 overview has a bit about it. The Apocalypse specifically mentions *compile-time* scope management, but Damian is, uh, Damian. (DWIMery obviously. ;) Hmm. It would seem *very* odd to allow every symbol table

Re: Prototypes

2001-09-03 Thread Ken Fox
Bryan C. Warnock wrote: { my $a = sub ($$) { code }; gork($a); } sub gork { my ($a) = shift; $a-(@some_list); # - Here } The reason prototypes aren't checked at Here is because there really isn't a way to know what the prototype was. Um, that's not true. ML can do

Re: What's up with %MY?

2001-09-03 Thread Dan Sugalski
At 04:11 PM 9/4/2001 +1100, Damian Conway wrote: I would envisage that mucking about with symbol tables would be no more common in Perl 6 than it is in Perl 5. But I certainly wouldn't want to restrict the ability to do so. How am I expected to produce fresh wonders if you won't let me warp the

Re: Prototypes

2001-09-03 Thread Bryan C . Warnock
A few more ideas to put down, lest I lay wake all night, thoughts churning... One. Presumably, there will be an op for the actual calling of the subroutine. That op can take an (extra) argument, with one of three values, that the prototype checking can get to. The first value indicates that

What's up with %MY?

2001-09-03 Thread Ken Fox
I haven't seen details in an Apocalypse, but Damian's Perl 6 overview has a bit about it. The Apocalypse specifically mentions *compile-time* scope management, but Damian is, uh, Damian. (DWIMery obviously. ;) Is stuff like: %MY::{'$lexical_var'} = \$other_var; supposed to be a compile-time

Re: LangSpec: Statements and Blocks

2001-09-03 Thread Damian Conway
Some feedback. Syntax Overview Keywords continue, do, else, elsif, for, foreach, given, goto, grep, if, last, map, next, redo, sort, sub, unless, until, when, while Ctry and Ccatch (Cfinally is not nearly so certain.) Conditional Statement Modifiers

RE: Should MY:: be a real symbol table?

2001-09-03 Thread Sam Tregar
On Mon, 3 Sep 2001, Brent Dax wrote: Now is where the temp() stuff I was talking about earlier comes in. sub foo { my($bar); foo(); } is basically equivalent to sub foo { temp($MY::bar); foo(); } Oh,

RE: Should MY:: be a real symbol table?

2001-09-03 Thread Dan Sugalski
At 09:12 PM 9/3/2001 -0700, Brent Dax wrote: From: Dan Sugalski [mailto:[EMAIL PROTECTED]] # At 07:05 PM 9/3/2001 -0700, Brent Dax wrote: # # From: Dan Sugalski [mailto:[EMAIL PROTECTED]] # # At 05:30 PM 9/3/2001 -0700, Brent Dax wrote: # # As far as expensiveness, I think this can be just as

Re: What's up with %MY?

2001-09-03 Thread Damian Conway
Dan revealed: How am I expected to produce fresh wonders if you won't let me warp the (new) laws of the Perl universe to my needs? That's easy--you slip the pumpking or internals designer a 10-spot. Amazing what it'll do... :) And how do you think I got five of my modules