Re: Prothon IS different inside
Paul Prescod <[email protected]>
| Newsgroups | gmane.comp.lang.prothon.user |
|---|---|
| Message-ID | <[email protected]> |
Joe Mason wrote: >>>... >>>Well, you have to use them when writing the object internals. >>>Otherwise, what actual Parrot asembly instructions do you emit while >>>adding two int objects? >> >>The instructions call add_ methods on the objects. And then the >>objects are implemented in C so they do addition C-style. That's more or >>less how Python does it although there is an optimization for if the >>interpreter detects that both operands are really just integers: then it >>skips the method call and does the addition itself. > > > Objects are implemented in C? Man, suddenly the porting effort (of > Parrot to a new platform) doubles... ??? How hard can it be to recompile a C library that implements a simple object? Anyhow, if you implement ADD_INT, ADD_FLOAT and CONCAT_STRING operators in the bytecode interpreter you are still implementing them in C. You still have to port them. Also: in Python and Prothon you hardly ever know at compile when the things you are adding are integers or floats so I don't really understand how you would know when to emit type-specific opcodes. Paul Prescod