[Web-SIG] JavaScript libraries
David Fraser
davidf at sjsoft.com
Fri May 6 12:04:08 CEST 2005
Peter Hunt wrote:
> Hello everyone,
>
> A long time ago (before the advent of IronPython), I wrote a small
> Python module that compiled a python file to a JScript.NET
> <http://JScript.NET> file and compiled it. Seeing as JScript and
> JavaScript are very similar, I bet this could be very helpful. See
> http://subway.python-hosting.com/attachment/wiki/Py2Js/pyc.2.py for
> the code.
>
> I envision a world where we can write something like:
> <input type="button" onclick="server.onButtonClick()" />
>
> And it will do a server-side RPC to the onButtonClick() method, which
> could do something like this:
> def onButtonClick(ctx):
> ctx.document.writeln("Button clicked")
>
> ctx would serve as a magical proxy for method calls back to the
> client. This would allow seamless integration of JavaScript and Python
> without even writing a line of JS. What do you think?
I think your original Python to Javascript compiler is way cool.
The server-side RPC can be done in lots of ways, as has been
discussed... I'm not sure why that's linked to the javascript to python
converter though, although you could always incorporate server-side
processing for methods you can't convert to javascript.
I'm very keen to write scripts that actually need to be written in
Python syntax rather than javascript, just because its nicer :-)
David
More information about the Web-SIG
mailing list