Hacker News new | ask | show | jobs
by toddmorey 4765 days ago
The way they position Brython is pretty off-putting and kind of confuses the issue.

CoffeeScript page: "CoffeeScript is a little language that compiles into JavaScript."

Brython page: "Brython is designed to replace Javascript as the scripting language for the Web."

Maybe that's the end goal, but the reality is far from it. Of course JS is still required, and of course the Python gets compiled into JS.

Finally, the approach seems a bit off. I would think it would be better for the Python to be compiled with a pre-processor, not done on the client.

2 comments

The approach and the phrasing seems exactly right to me and not at all off-putting.

The goal of Brython is to replace javascript on the web, seems straightforward right? The way they go about it is to implement a compiler in javascript, and use that to bootstrap a python in the browser community. Seems like that is much easier than convincing Chrome/Firefox/IE to include a python compiler in their browser.

How would Brython replace javascript if it were precompiled on the server?

Why not provide both options, ala LESS?
Because that takes time and effort and this is relatively new.
tinco seemed to be arguing that allowing server-side compilation would be harmful to the goals of the project. That's orthogonal to your argument about time and effort.
The argument for compiling the Python with the pre-processor seems roughly analogous to traditional arguments for compiling rather than interpreting languages - i.e. how many times the conversion from source code to machine instructions must be done.

One isn't necessarily better than the other - sometimes human generated python source code in the browser may be more useful than machine generated javascript.

If nothing else, it allows us to explore a new way of constructing web apps and determine whether it is better.

I'm not sure what the commenter meant, and perhaps a silly comment to make, but doesn't python's strong indentation make it harder to simply include on a webpage? proxies, ad filters, and other optimizers might break the lines in unexpected places.

I guess it can be solved by gziping the file, or base64 encoding it. But this is also an argument (albeit trivial or weak) for compiling it on the server rather than the client.