This is the mail archive of the guile@sources.redhat.com mailing list for the Guile project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: Translators, yet once more (Re: PHP fork project- Guile vs Python vs ?)


At 02:43 AM 7/10/2000 , Moshe Zadka wrote:
>On Mon, 10 Jul 2000, Lalo Martins wrote:
>
>> > With all due respect, that is not true. Have a look at JPython, a
>> > Python-to-Java translator. It supports the Python language perfectly, and
>> > Java is a much more prmitive language then Scheme.
>> 
>> Well, that's because JPython is not a Python-to-Java
>> translator, but a Python-to-Java-Bytecode compiler. In may
>> aspects, it's a reimplementation of the Python interpreter.
>
>That's wrong: previous versions worked like that, the interactive
>interpreter works like that, but the regular JPython compiler works
>through a Java intermediary.
>
>
>> Of course there are proposital idiosyncrasies in languages that
>> it won't be worth copying exactly; perhaps emulating "more or
>> less". Actually, my example wasn't a good one because
>> __getitem__, __len__, __getattr__ and friends can be converted
>> into generic methods by the translator, so that "foo[5]" would
>> translate to e.g. "(python::getitem foo 5)" which would
>> evaluate to the method you provided for foo.__getitem__ thanks
>> to GOOPS...
>> 
>> Now, getattr would be trickier because every object in Python
>> is a first-class namespace to which you can add arbitrary
>> elements (foo.bar=2 when foo's class doesn't have a "bar"
>> attribute - in fact, classes _never_ have attributes in the
>> sense we're used to in other OOPLs) and even controlled more
>> finely via __getattr__. Perhaps the attributes of Python
>> objects could be stored in Scheme's object-properties instead
>> of proper GOOPS slots? Or, of course, a __dir__ slot with an
>> alist or something...
>
>What I'm thinking is to "generic method" the whole "access", so
>
>foo[5] --> ((python:getattr foo '__getitem__) 5)

I like the translate into Scheme approach, but won't the guile debugger produce a scheme backtrace rather than a python one?

k 

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]