pirate refactoring update

2005-08-25 Thread Michal Wallace
Hello! Here's an update on pirate (the python to parrot compiler) from the trenches. Pirate started as an example that fit in one small file and it stayed in that single file over the years while it grew into a *huge* mess: one monolithic object performing a variety of transformations on

Re: [pirate] Re: Python PMC's

2005-08-24 Thread Michal Wallace
On Wed, 24 Aug 2005, Sam Ruby wrote: [huge cut] Below is from the sample that Leo provided. # print foo.f(2) # emulate python find_name, which checks attributes too push_eh m_nf $P0 = foo.f(2) clear_eh goto m_f m_nf: # getattribute would also check

Re: [pirate] OSCON slides

2005-08-06 Thread Michal Wallace
On Fri, 5 Aug 2005, Leopold Toetsch wrote: There are still issues e.g. with namespaces. I've put out numberless mails on p6i where I invited HLL folks to discuss it and make some proposals. Guess how many answers these mails got. Zero? I don't think p6i is the right place for that. We should

Re: urgent parrot bug / PR opportunity

2005-08-04 Thread Michal Wallace
On Thu, 4 Aug 2005, Leopold Toetsch wrote: Michal Wallace wrote: And wouldn't you know it... A bug on the parrot side cropped up out of nowhere to break them! ==17366== valgrind's libpthread.so: IGNORED call to: pthread_attr_destroy ==17366== Invalid read of size 4 ==17366

urgent parrot bug / PR opportunity

2005-08-03 Thread Michal Wallace
Help! :) Sam Ruby is giving a speech at OSCON tomorrow about python on parrot. The pirate tests run hourly against the latest repository versions of pirate and parrot at: http://pirate.tangentcode.com/ And wouldn't you know it... A bug on the parrot side cropped up out of nowhere to break

Re: PMCs: Should We Use Them?

2005-07-08 Thread Michal Wallace
On Thu, 7 Jul 2005, Larry Wall wrote: On Thu, Jul 07, 2005 at 09:28:04PM -0400, Michal Wallace wrote: : What I'd want is to be able to download the language : specific extensions as a library from cpan. Better : yet if users can do it themselves without having : to bug me. Hmm... : Sure, I'd

Re: PMCs: Should We Use Them?

2005-07-07 Thread Michal Wallace
On Thu, 7 Jul 2005, Roger Browne wrote: Leopold Toetsch wrote: Well, if you have some mixed environment, you'd probably build parrot on all machines with the PMC's needed. Something like: perl Configure.pl --with-tcl --with-python to get these PMCs built on it. I'm thinking of

Re: [pirate] Setting up Pirate Parrot

2005-07-01 Thread Michal Wallace
On Fri, 1 Jul 2005, Leopold Toetsch wrote: Kevin Tew wrote: I've been working on a python compiler also, feel free to take a look,, svn co http://svn.openfoundry.org/pyparrot languages/python/pyparrot My current boggle is how to handle the self parameter to method functions. You can do

new list for pirate [python on parrot]

2005-06-12 Thread Michal Wallace
I just set up a new list for pirate, a python compiler for parrot. Quite a bit of work has been done on pirate since I last updated the website back in 2003, mostly by Sam Ruby of http://intertwingly.net/ Sam is giving a python-on-parrot presentation at OSCON on August 4, so I'd like to

Re: about python on parrot

2005-05-25 Thread Michal Wallace
On Wed, 25 May 2005, [EMAIL PROTECTED] wrote: hi python on parrot already have not develop? Hi there, I'm not sure I understand your question either... But maybe this will help? http://pirate.tangentcode.com/ - Michal http://withoutane.com/

refcounts and DOD

2005-05-25 Thread Michal Wallace
Hi all, So I'm still thinking about a generic wrapper for python modules. I would like to be able to recompile the python standard library (and other libraries) to run on parrot with only a few minor patches. I realize this is probably completely foolish, but I'm lazy, so... :) I've done

Re: Python on parrot

2005-05-16 Thread Michal Wallace
On Sun, 15 May 2005, Kevin Tew wrote: I've taken the code from http://www.intertwingly.net/stories/2004/10/05/pyrate.zip, which I assume to be Sam's code. It was basically stubs with a few AST nodes implemented when I started with it. Er. Yes. I can't speak for Sam, but I interpreted his post as

Re: Objects: Now or forever (well, for a while) hold your peace

2004-02-19 Thread Michal Wallace
On Thu, 19 Feb 2004, Dan Sugalski wrote: I tried to unify attributes and properties--I really did. The problem is that they're horribly semantically different. Attributes are class private and guaranteed across all objects of a class, while properties are ad hoc and can be thrown on anything.

Re: Objects: Now or forever (well, for a while) hold your peace

2004-02-18 Thread Michal Wallace
On Wed, 18 Feb 2004, Dan Sugalski wrote: Just to let everyone know, if there aren't any comments on the scheme in PDD 15, I'm going to implement it as-is and be done with it, at least for now. This would be a good time to speak up--can't guarantee that I'll put the changes in for this rev,

Re: Rules for method resolution?

2004-02-15 Thread Michal Wallace
On Sun, 15 Feb 2004, Luke Palmer wrote: As with Perl 6. A sub object has a Cdo trait which specifies what to do when it's called. Cool. But I think findmethod is a good idea, cross-language-wise. Each language has a different idea of what a method is, and they can store it that way. As

Re: Rules for method resolution?

2004-02-14 Thread Michal Wallace
On Fri, 13 Feb 2004, Dan Sugalski wrote: We also have to have a way to fetch the method PMC for a named method for later use, which is where the interesting bits come in. This is required for a number of reasons, including Python, so we have to have it. The question is... *When* is the name

Re: Rules for method resolution?

2004-02-14 Thread Michal Wallace
On Sat, 14 Feb 2004, Michal Wallace wrote: class Alice: def whoami(self): return Alice class Bruce: def whoami(self): return Bruce a = Alice() b = Bruce() a.whoami, b.whoami = b.whoami, a.whoami assert a.whoami()==Bruce

Re: RT Cleanup

2004-02-09 Thread Michal Wallace
On Mon, 9 Feb 2004, Melvin Smith wrote: At 07:26 PM 2/5/2004 -0500, Will Coleda wrote: Melvin: Here's a warnocked imcc issue for you: int main () { int if = 1; if (if) { if = 0; } } My take on it is, since it is an intermediate language, we don't need ability to have

python PMCs?

2004-02-02 Thread Michal Wallace
Dan, What is your plan for getting python objects working for the pie-thon? I've made a small start on wrapping PythonObjects as PMC's and that seems to work. It's also a whole lot easier than trying to recode them as PMCs directly or writing them in imc/pir. They just need to be tricked into

Re: Backward branch, warnocked.

2004-02-02 Thread Michal Wallace
On Tue, 3 Feb 2004, Pete Lomax wrote: .sub _main goto L1 test: $I1 = 1 ret L1: $I2 = 2 call test print $I2 # prints 1, not 2 end .end ... Again, sorry to be a pain, but I'd like the truth/an update, please! Or some hints... file

Re: how to subclass dynamic PMCs?

2004-01-22 Thread Michal Wallace
On Thu, 22 Jan 2004, Leopold Toetsch wrote: Michal Wallace [EMAIL PROTECTED] wrote: I'm trying to make a dynamically loaded PMC that subclasses another dynamically loaded PMC. Its a linker problem, but not too simple. Your analysis is correct: pistring needs the symbol

Re: How does perl handle HLL Ceval?

2004-01-22 Thread Michal Wallace
On Fri, 23 Jan 2004 [EMAIL PROTECTED] wrote: The subject says it all. As parrot is designed to be targetted by many langauges, how will it handle 'eval' opcodes for those different languages? Shell out to a seperate process? You could do that, or you can provide a C-based compiler as a PMC

how to subclass dynamic PMCs?

2004-01-21 Thread Michal Wallace
Hi all, I'm hoping this is just a simple linker option, but I've been reading ld manuals for the past few hours and I just don't get it. :) I'm trying to make a dynamically loaded PMC that subclasses another dynamically loaded PMC. I made two files in parrot/dynclasses/ : // file 1:

Re: Events and JIT

2004-01-16 Thread Michal Wallace
On Fri, 16 Jan 2004, Dan Sugalski wrote: 2) Those that explicitly check for events ... Ops like spin_in_event_loop (or whatever we call it) or checkevent is in category two. They check events because, well, that's what they're supposed to do. Compilers should emit these with some frequency,

Re: Events and JIT

2004-01-16 Thread Michal Wallace
On Fri, 16 Jan 2004, Dan Sugalski wrote: I don't understand that part. Why the compiler? Because we don't have the sort of control of the async environment that hardware does to deal with interrupts. And, realistically, all code has to deal with the possibility of interrupts. Even if they

Re: [PATCH] new_noinit and init ops

2004-01-12 Thread Michal Wallace
On Mon, 12 Jan 2004, Luke Palmer wrote: I have somewhat a predicament. I want to create a continuation, and have that continuation stored in the register stack that it closes over (this is how I'm implementing a loop with continuations). Unless I'm having a major braino, I don't think this

Re: [PATCH] new_noinit and init ops

2004-01-12 Thread Michal Wallace
On Mon, 12 Jan 2004, Luke Palmer wrote: Michal Wallace writes: On Mon, 12 Jan 2004, Luke Palmer wrote: I have somewhat a predicament. I want to create a continuation, and have that continuation stored in the register stack that it closes over (this is how I'm implementing a loop

Mr Parrot's Neighborhood

2004-01-12 Thread Michal Wallace
On Mon, 12 Jan 2004, Luke Palmer wrote: Well... A Coroutine is a pausable, resumable continuation, right? Or basically a closure with a continuation inside it. Both of those sentences seem wildly redundant to me. I think we might be stuck on vocabulary. We're surely both understanding

Re: yield op?

2004-01-11 Thread Michal Wallace
On Sun, 11 Jan 2004, Leopold Toetsch wrote: Michal Wallace [EMAIL PROTECTED] wrote: When you invoke a Coroutine, it calls swap_context() from src/sub.c ... There's an else clause in there that either swaps or restores theinterpreter stack, but as far as I can tell, swap_context

yield op?

2004-01-09 Thread Michal Wallace
Hey all, When you invoke a Coroutine, it calls swap_context() from src/sub.c ... There's an else clause in there that either swaps or restores theinterpreter stack, but as far as I can tell, swap_context() is ONLY called when entering a coroutine - not when we're suspending it. That means all

Re: BUG: coroutine + exception = stack_height segfault

2004-01-09 Thread Michal Wallace
On Fri, 9 Jan 2004, Jeff Clites wrote: On Jan 9, 2004, at 12:24 AM, Leopold Toetsch wrote: Michal Wallace [EMAIL PROTECTED] wrote: #!/bin/env parrot # # yieldbug.imc # # This program should print dots forever. # Instead it prints a few dots and then segfaults. It does print

Re: [PATCH] Continuations now close over register stacks

2004-01-09 Thread Michal Wallace
On Fri, 9 Jan 2004, Leopold Toetsch wrote: Michal Wallace [EMAIL PROTECTED] wrote: newsub $P1, .Continuation, done For returning just use a .RetContinuation. Or still better, just omit $P1 totally here: .pcc_call $P0, $P1 Aha! I like that even better. :) Thanks! Sincerely

Re: [PATCH] Continuations now close over register stacks

2004-01-09 Thread Michal Wallace
On Fri, 9 Jan 2004, Luke Palmer wrote: Very rarely would you not savetop before creating a *real* continuation. But again, very rarely would you actually create a *real* continuation (depending on your language). RetContinuations are almost always a better choice for traditional languages,

Re: yield op?

2004-01-09 Thread Michal Wallace
On Fri, 9 Jan 2004, Leopold Toetsch wrote: Michal Wallace [EMAIL PROTECTED] wrote: Hey all, When you invoke a Coroutine, it calls swap_context() Can you have a look at imcc/t/syn/pcc.t, there is an coroutine iterator test. Yep, it has the same problem. The patch below exposes

RESOLVED: how do I instantiate?

2004-01-08 Thread Michal Wallace
On Wed, 7 Jan 2004, Luke Palmer wrote: Er, sorry, that's IMCC's fault. This works: new felix, $I0 Yep! Thanks! Here's a short example of the final script: .sub _main .local object Cat .local object felix newclass Cat, Cat find_type $I0, Cat new felix, $I0 $P0 = new

Re: how do I instantiate? -- was: Objects!

2004-01-08 Thread Michal Wallace
On Thu, 8 Jan 2004, Leopold Toetsch wrote: Michal Wallace [EMAIL PROTECTED] wrote: I'm not even trying to get objects working yet. I just need something that'll let me run setprop on it You can attach properties to all PMCs. And WRT object instantiation: t/pmc/object*.t but only integer

Re: how do I instantiate? -- was: Objects!

2004-01-08 Thread Michal Wallace
On Thu, 8 Jan 2004, Leopold Toetsch wrote: Michal Wallace [EMAIL PROTECTED] wrote: What exactly is the difference between an attribute and a property? $ perldoc docs/pdds/pdd15_objects.pod /TRANSLATION AND GLOSSARY Thanks. Don't mind me. I'm going to go make a card that says RTFM on my

re: [PATCH] Continuations now close over register stacks

2004-01-08 Thread Michal Wallace
Luke Palmer wrote: This patch re-implements the register backing stacks as PObjs (so they can be garbage-collected), honors their COW flags, and adds them to the interpreter context (where they should be, honest!). As a healthy side-effect, it encapsulates their behavior nicely into

weird bug w/new imcc syntax

2004-01-08 Thread Michal Wallace
I love the new syntax for calling functions! Thanks Melvin!!! And... here's a weird bug. :) The following code fails with the message No Entries on UserStack! But, if you delete either/both of the empty comment lines and it works fine. :) .sub _main $P0 = new PerlString $P0 = hello\n

BUG: coroutine + exception = stack_height segfault

2004-01-08 Thread Michal Wallace
#!/bin/env parrot # # yieldbug.imc # # This program should print dots forever. # Instead it prints a few dots and then segfaults. # # parrot -t shows this bug: # #parrot: src/stacks.c:95: stack_height: #Assertion `height == (top-n_chunks - 1) * 256 + top-used' failed. #Aborted # # It

Re: [PATCH] Continuations now close over register stacks

2004-01-08 Thread Michal Wallace
On Thu, 8 Jan 2004, Luke Palmer wrote: @pcc_sub_call_4: set P0, P17 set P1, P16 set I0, 0 set I1, 0 set I2, 0 set I3, -2 updatecc savetop invoke done: restoretop set P16, P5 When the

how do I instantiate? -- was: Objects!

2004-01-07 Thread Michal Wallace
On Tue, 2 Dec 2003, Dan Sugalski wrote: *) Creating new objects involves calling the -init vtable entry *on the class*. Because of this each class gets a custom vtable where the init method has been swapped out for one (from objects.c) that creates a new object instead. Well, cool! How do I

Re: how do I instantiate? -- was: Objects!

2004-01-07 Thread Michal Wallace
On Wed, 7 Jan 2004, Luke Palmer wrote: Should go something like this: .sub _main .local object Cat .local object felix newclass Cat, Cat find_type $I0, Cat felix = new $I0 # ... .end Thanks, but that doesn't work either. :/ The

Re: More object stuff

2003-12-03 Thread Michal Wallace
On Wed, 3 Dec 2003, Leopold Toetsch wrote: Dan Sugalski [EMAIL PROTECTED] wrote: At 12:17 PM +0100 12/3/03, Leopold Toetsch wrote: Create an Exception class hierarchy? I'm not 100% sure I want to go with a real OO style of exceptions, but that might just be the neo-luddite in me.

feature request: line numbers in errors?

2003-12-03 Thread Michal Wallace
Is it possible to print out the line number of the bad instruction when parrot encounters an error and fails? I'm trying to get my generated code to work with the latest version of pirate and I'm having to rely on GOT THIS FAR print statements to find the lines that are giving me errors. I

python exceptions broken

2003-12-03 Thread Michal Wallace
Looking more at exceptions here... I used to be able to put arbitrary stuff in the _message slot of a ParrotException... Now we can only use strings. Is that permanent? PythonException will need to be able to hold an arbitrary python object. I'm faking it by stuffing my PMC into a string

Re: Languages status (attention compiler maintainers)

2003-10-08 Thread Michal Wallace
On Mon, 6 Oct 2003, Melvin Smith wrote: In an attempt to get a handle on what the status is of all the language compilers we have (in various states) I added a file called LANGUAGES.STATUS under parrot/languages Just read the file and it explains itself. Please, if you are the author of

setline?

2003-09-25 Thread Michal Wallace
Sorry, I've been following this list with one eye tied behind my back... What happened to setline? Should I emit something else instead? Sincerely, Michal J Wallace Sabren Enterprises, Inc. - contact: [EMAIL PROTECTED] hosting: http://www.cornerhost.com/

Re: attaching debuggers

2003-09-19 Thread Michal Wallace
On Fri, 19 Sep 2003, Nicholas Clark wrote: [talking about dynamically intering the debugger] Can anyone see a sane way to do it? Better still, can anyone see a viable way to do it on perl5? Python does this. There's basically a hook after every statement, and you can put whatever you want

Re: Of AST and YAL

2003-09-07 Thread Michal Wallace
On Sun, 7 Sep 2003, Leopold Toetsch wrote: I'm currently investigating the AST (abstract syntax tree) interface for Parrot. For getting a feeling, how this could look like, I've implemented (some parts) of Yet Another Language (YAL). I like it. What is this written in? C or Perl or what? If

Re: Method call parameters

2003-08-24 Thread Michal Wallace
On Sun, 24 Aug 2003, Benjamin Goldberg wrote: Togos wrote: What's the reasoning behind putting the object a method is being called on in P2 instead of in the first parameter of the method? I have a feeling that putting it as the first parameter of the method would make the lives of

Re: [CVS ci] PackFile-15: print warning location

2003-08-24 Thread Michal Wallace
On Sun, 24 Aug 2003, Leopold Toetsch wrote: We have two kinds of file/line information: Parrot source and HLL source. So the C.currentline macro needs duplication or an argument specifying, which source it should denote. And when parrot throws an error and complains about line 5, which one

Re: Should I target Parrot?

2003-08-24 Thread Michal Wallace
On Fri, 22 Aug 2003, Benjamin Goldberg wrote: Michal Wallace wrote: On Thu, 21 Aug 2003, Benjamin Goldberg wrote: If you want, instead, to serialize interpreter-microthreads, however... well, you'd *still* get almost the whole interpreter serialized, but you're getting more bang

Re: Should I target Parrot?

2003-08-22 Thread Michal Wallace
On Thu, 21 Aug 2003, Tom Locke wrote: (not sure who you're quoting here... dan I think) But Parrot has continuations. Doesn't this gives me (cooperative) microthreads? (with a little work on my part). Sure... So these would be real cheap right? Time and space overheads similar to

Re: Should I target Parrot?

2003-08-22 Thread Michal Wallace
On Thu, 21 Aug 2003, Benjamin Goldberg wrote: I hope you aren't planning on serializing just a single isolated microthread... that wouldn't work well with what I've got in mind due to how much stuff comes along when you serialize a continuation -- you'd get almost the whole interpreter

Re: Should I target Parrot?

2003-08-21 Thread Michal Wallace
On Wed, 20 Aug 2003, Tom Locke wrote: I am currently embarking on a project to create a new language. Right now I'm in the process of selecting the platform that's going to give me the best starting point. My first choice is whether to go for a VM, or a C-Python style implementation. Right

Re: there's no undef!

2003-08-17 Thread Michal Wallace
On Sun, 17 Aug 2003, Benjamin Goldberg wrote: Michal Wallace wrote: Uh-oh. I just went to implement del x and there's no op to remove a variable from a lexical pad! :) Why would you want to remove a variable from a lexical pad? Surely the right thing to do would be to create a new

Re: set vs. assign, continued: 'add' vs. 'add!'

2003-08-17 Thread Michal Wallace
On Sun, 17 Aug 2003, Luke Palmer wrote: Benjamin Goldberg writes: Hmm... I just thought of something. Since 'set' semantics can be easily simulated when we have only ops for 'assign' semantics, maybe imcc itself could do this for us. That is, by default, $P0 = $P1 + $P2 will

Re: there's no undef!

2003-08-17 Thread Michal Wallace
On Mon, 18 Aug 2003, Benjamin Goldberg wrote: Hmm. Do you mean if for stmt in block: if stmt.type == undef: flag_as_going_to_delet(stmt.varname) So I can create a new pad when it's assigned? Right. You'd create a new pad just before the for, and put stmt into

bug with parrot -O2

2003-08-17 Thread Michal Wallace
I haven't looked into this at ALL, but I was curious about the IMCC optimization flags: [~/pirate]: ./pirate.py -d weightless.py weightless.imc [~/pirate]: parrot weightless.imc ended with: L 450 total time: 23 [~/pirate]: parrot -O=1 weightless.imc ended with: L 450 total time: 22

Re: pirate 0.01 ALPHA!

2003-08-16 Thread Michal Wallace
On Sat, 16 Aug 2003, Sean O'Rourke wrote: Michal Wallace [EMAIL PROTECTED] writes: Tadaa! /me blinks at the list comprehensions. :) Cool stuff. test_microthreads failed for some reason I still need to look into, but there's a lot of cool stuff working already. Time for Dan

Re: thanks and pow / div ops

2003-08-16 Thread Michal Wallace
On Fri, 15 Aug 2003, Leopold Toetsch wrote: PS: have a look at the rather new Cunless a op b opcode in PIR ;-) Cool! :) Sincerely, Michal J Wallace Sabren Enterprises, Inc. - contact: [EMAIL PROTECTED] hosting: http://www.cornerhost.com/ my site:

there's no undef!

2003-08-16 Thread Michal Wallace
Uh-oh. I just went to implement del x and there's no op to remove a variable from a lexical pad! :) Sincerely, Michal J Wallace Sabren Enterprises, Inc. - contact: [EMAIL PROTECTED] hosting: http://www.cornerhost.com/ my site: http://www.withoutane.com/

save/restore on yield?

2003-08-16 Thread Michal Wallace
Just tried out Kenneth Grave's yield stuff -- it works great! But shouldn't .pcc_begin_yield and .pcc_end_yield do saveall and restoreall, respectively? Is there a case where we wouldn't want this? Sincerely, Michal J Wallace Sabren Enterprises, Inc. -

Re: save/restore on yield?

2003-08-16 Thread Michal Wallace
I said: But shouldn't .pcc_begin_yield and .pcc_end_yield do saveall and restoreall, respectively? Is there a case where we wouldn't want this? Yes, because for python anyway, I also need to put pop_pad in there: saveall pop_pad .pcc_begin_yield .return whatever .pcc_end_yield

try/catch bug with coroutines

2003-08-16 Thread Michal Wallace
It seems that exception handlers get tied to subroutines when they're created, not when they're actually used. For example: ## this works: try: f = make_function() f.die() # raise some error except: pass ## this does not work: f = make_function()

Re: there's no undef!

2003-08-16 Thread Michal Wallace
On Sat, 16 Aug 2003, Leopold Toetsch wrote: I have put in scratchpad_delete peek_pad P0 delete P0[foo] deletes names only. Thanks! works great! Sincerely, Michal J Wallace Sabren Enterprises, Inc. - contact: [EMAIL PROTECTED] hosting:

getprop and find_lex?

2003-08-16 Thread Michal Wallace
I expected getprop to behave like find_lex and throw an exception if the property doesn't exist, but it doesn't: .sub _main .local object Class .local object setv .local object getv Class = new ParrotClass setv = new PerlString setv = value\n setprop Class, name, setv # ok

Re: getprop and find_lex?

2003-08-16 Thread Michal Wallace
On Sat, 16 Aug 2003, Sean O'Rourke wrote: Michal Wallace [EMAIL PROTECTED] writes: I expected getprop to behave like find_lex and throw an exception if the property doesn't exist, but it doesn't: Are you sure that properties are what you want to use here, rather than attributes (via

pirate 0.01 ALPHA!

2003-08-16 Thread Michal Wallace
Tadaa! Okay. I've done (almost) everything I can do for python without jumping into C. So here's a release! http://pirate.tangentcode.com/ Check out the generator-based microthreads demo. :) It's horribly slow, but it works! And note the PARROT_INLINE function - a nice little touch, I

thanks and pow / div ops

2003-08-15 Thread Michal Wallace
raise hell is working great with the new find_lex exceptions. Thanks! :) Any plans to to add pow for PMC's? What about separate ops for floor/true division? http://www.python.org/doc/2.2.1/whatsnew/node7.html Sincerely, Michal J Wallace Sabren Enterprises, Inc.

Re: A certain 4 letter word (was Re: Parrot and STDOUT/STDERR)

2003-08-15 Thread Michal Wallace
On Fri, 15 Aug 2003, Leopold Toetsch wrote: When we have more classes like a Python hierarchy, we will see, how and how far the functionality does match. If we find some, we can put in an intermediate ParrotScalar. I was thinking about this earlier today. Once dynamic PMCs are working, Perl*

bug: two segfaults

2003-08-14 Thread Michal Wallace
The following code segfaults immediately. If you uncomment the second line (print ) it works. However, if you then uncomment the #non_prototyped keyword in _depth1, it segfaults immediately again. When I say it segfaults immediately, I mean that the initial 0 is not printed. (Should I be

Re: IMCC hangs

2003-08-14 Thread Michal Wallace
On Sun, 10 Aug 2003, Vladimir Lipskiy wrote: Seems to be related with the multiple freeing reported by Michael. I thought his name was Michal (:8 yes, I was born without an e. :) Sincerely, Michal J Wallace Sabren Enterprises, Inc. - contact: [EMAIL

Re: why new_pad *INT*?

2003-08-14 Thread Michal Wallace
On Sat, 9 Aug 2003, Sean O'Rourke wrote: Remember, the pad depth reflects lexical scope nesting, not dynamic scoping. So if you mean current_depth as current compile-time depth above, then you're right, but the VM would have no way to tell. If you mean run-time depth, which the compiler

RE: pirate status / need help with instances

2003-08-14 Thread Michal Wallace
On Mon, 11 Aug 2003, Brent Dax wrote: Sean O'Rourke: # * make parrotclass handle invoke # this strikes me as the most efficient, # but I'm not really confident with C # so I'm hesitant to try it # # This seems to me like the way to go, except you might # subclass

repeat() not implemented in PerlInt

2003-08-14 Thread Michal Wallace
After running cvs up -d and then make, a bunch of my tests broke. Here's the problem boiled down to the simplest case I can find: [~/pirate]: cat bug.imc .sub __main__ $P2 = new PerlInt $P2 = 1 $P3 = new PerlInt $P3 = 1 if $P2 == $P3 goto cmp1

serializing functions?

2003-08-14 Thread Michal Wallace
This is just a question I've been wondering about, that I think could be a huge PR sell for parrot in the python world if the answer is yes. Could you serialize a parrot function? In other words, if you interactively define a function at the prompt, could you save it to disk? (not the source

Re: generic code generator? [was: subroutines and python status]

2003-08-14 Thread Michal Wallace
On Tue, 5 Aug 2003, Stephen Thorne wrote: It seems to me that if we want to maximize the number of languages using it, the generic compiler shouldn't depend on anything but C and parrot... But until we get it working, I'd like to stick to a dynamic language like

Re: parrot bug: continuations/multiple return

2003-08-14 Thread Michal Wallace
On Sun, 10 Aug 2003, Leopold Toetsch wrote: Piers Cawley [EMAIL PROTECTED] wrote: Leopold Toetsch [EMAIL PROTECTED] writes: As calling conventions clearly state, that the caller has to save everything, its probably up to imcc/pcc.c to insert above statements, if another sub gets called

Re: parrot bug: continuations/multiple return

2003-08-14 Thread Michal Wallace
On Sat, 9 Aug 2003, Benjamin Goldberg wrote: Michal Wallace wrote: [snip] def f(): return g() [snip] # f from line 3 .pcc_sub _sub1 non_prototyped .local object res1# (visitReturn:528) find_lex $P2, 'g' # (callingExpression:325

Re: calling conventions, variable-length parameter lists

2003-08-14 Thread Michal Wallace
On Fri, 8 Aug 2003, TOGoS wrote: I want to be able to have a function with this kind of signature: func ($param1, *$otherparams) AFAIK, there is no way to implement this with the current calling conventions. You would have to do something with variable register IDs, which we don't have

Re: why ~ for xor?

2003-08-14 Thread Michal Wallace
On Mon, 11 Aug 2003, Thomas Vesper wrote: Michal Wallace wrote: Out of curiosity, why does ~ map to both unary bitwise-not and binary bitwise-xor in imcc? I was expecting xor to be ^ and ^^ See Apocalypse 3 for this. ^ was reclaimed for hyperoperators. Binary ~ was chosen

RE: help raise hell

2003-08-14 Thread Michal Wallace
On Mon, 11 Aug 2003, Joseph F. Ryan wrote: How are you currently throwing/catching exceptions? I think it might be much more difficult to create a model that traps exceptions, rather than setting up code that just figures out how to handle an exception when it occurs. Both JVM-PIR and P6C

Re: parrot bug: continuations/multiple return

2003-08-14 Thread Michal Wallace
On Sat, 9 Aug 2003, Leopold Toetsch wrote: Nice coincidence. S. Togos' bug report too. Anyway, its already fixed. Gosh you're quick. Thanks! Want another one? :) def g(): return 0 def f(): return g() print f() This prints: 'No more I register frames

Re: This Week's Perl 6 Summary

2003-08-14 Thread Michal Wallace
On Tue, 5 Aug 2003, Piers Cawley wrote: Approaching Python Discussions (and coding) of the Parrot implementation of Python continued this week. Michal Wallace is working on taking a preexisting (but incomplete, it's a proof of concept only) python parse tree - Wow, after

Re: pirate status / need help with instances

2003-08-14 Thread Michal Wallace
On Tue, 12 Aug 2003, Michal Wallace wrote: I wound up getting a couple C books today. I'm trying to see what I can do about wrapping PyObject as a PMC... What's the secret to making parrot recognize a new PMC? I've got my .pmc file but I'm not sure what to do next. The article about making

Re: generic code generator? [was: subroutines and python status]

2003-08-14 Thread Michal Wallace
On Tue, 5 Aug 2003, Dan Sugalski wrote: The original thought was to use the new perl 6 grammar engine/code to do this, but I think it'll be a while before that's ready to go. I think perl6 is definitely the way to go, once it's ready. BTW, what's the deal with Bundle::Perl6? I tried

bug: clear_eh patricide after catch

2003-08-14 Thread Michal Wallace
Here's a new test case for t/pmc/sub.t output_is('CODE', 'OUTPUT', set_eh - throw - clear_eh); print start\n newsub P20, .Exception_Handler, _handler set_eh P20 new P30, .Exception throw P30 print not reached\n end _handler: clear_eh print caught

pirate status / need help with instances

2003-08-14 Thread Michal Wallace
Just wrapping up an all-night coding spree... Py-pirate can now handle: - functions (closures, recursion, etc) - global variables - tuples (but they turn into lists) - dictionaries (create, setitem, getitem, print) - list comprehensions - raise (strings only) - try...except

Re: bug: clear_eh patricide after catch

2003-08-14 Thread Michal Wallace
On Mon, 11 Aug 2003, Leopold Toetsch wrote: No, the exception object isn't around anymore in the handler, so you don't Cclear_eh there. This could of course be just my wrong implementation. No, it makes sense. You wouldn't want an exception in the catch: block to trigger an infinite loop.

Re: parrot bug: continuations/multiple return

2003-08-14 Thread Michal Wallace
On Sat, 9 Aug 2003, Leopold Toetsch wrote: As calling conventions clearly state, that the caller has to save everything, its probably up to imcc/pcc.c to insert above statements, if another sub gets called from a sub. I'll fix that in a minute ;-) I just synced up with cvs and now

Re: calling conventions, variable-length parameter lists

2003-08-14 Thread Michal Wallace
On Fri, 8 Aug 2003, TOGoS wrote: Unprototyped :-) I guess I didn't make that quite clear, enough. Nah, you did. I just didn't think about it... :) I think I see the problem now. maybe this kind of unprototyped function is expected to be uncommon enough that we can put up with having to

Re: pirate status / need help with instances

2003-08-14 Thread Michal Wallace
On Tue, 12 Aug 2003, Leopold Toetsch wrote: ... So I'm trying to decide between two approaches: 3) wait until classes and objects are done ;-) 4) simulate an object system with closures :) I wound up getting a couple C books today. I'm trying to see what I can do about wrapping PyObject

parrot bug: continuations/multiple return

2003-08-14 Thread Michal Wallace
Hey all, Sorry for the huge code listing here, but I don't have a simpler case. This is what pirate outputs when it compiles the following program: def f(x): if x: return 1 else: return 0 print f(1), f(0) As far as I can

help raise hell

2003-08-11 Thread Michal Wallace
Here is how I usually trigger a generic exception in python: raise hell Traceback (most recent call last): File stdin, line 1, in ? NameError: name 'hell' is not defined Unfortunately, I can't seem to trap that in parrot, because a find_lex failure isn't an exception. Or am

okay to use iterator?

2003-08-11 Thread Michal Wallace
perlhash.pod says: TODO: Steve Fink sayd: And if there were a keys() method, then 'defined' and 'exists' are very different. (And there ought to be, and would be if we weren't all ignoring Leo's iterator proposal.) I need to read that proposal :-) Looks like the proposal got accepted?

why ~ for xor?

2003-08-11 Thread Michal Wallace
Out of curiosity, why does ~ map to both unary bitwise-not and binary bitwise-xor in imcc? I was expecting xor to be ^ and ^^ Sincerely, Michal J Wallace Sabren Enterprises, Inc. - contact: [EMAIL PROTECTED] hosting: http://www.cornerhost.com/ my site:

Re: why new_pad *INT*?

2003-08-10 Thread Michal Wallace
On Sat, 9 Aug 2003, Sean O'Rourke wrote: The problem is that when adder() gets returned, it needs to remember the enclosing pad. So this needs to be newsub $P1, .Closure, _sub1 which (IIRC) will save the lexical environment in which it was created (see closure.pmc), then restore

Re: generic code generator? [was: subroutines and python status]

2003-08-10 Thread Michal Wallace
On Tue, 5 Aug 2003, Joseph Ryan wrote: Okay, I don't have a good syntax in mind yet, the point is it's a template language and you can subclass/override/extend the template. Maybe there's no syntax and it just uses cleanly coded classes in some oo language. Or perl6 with it's grammars and

  1   2   >