JdeH
|
10 years ago
|
on: Show HN: Transcrypt – Fast, small Python 3.5 to JavaScript transpiler
Yes, after programming ever since I was 15, I've learned that it has to be one of both:
_ Either I have to accept the basic design choices made in a piece of code as is, and build upon it in the same line of thought
- Or, if I really don't want to live with that, I start out completely fresh, not even looking at existing code, since it will just distract me from my path
In this case I opted for the second approach. Many transpiler projects out there are somehow related. As you can see by the source code Transcrypt isn't. I needed a fresh approach to reach my goals (the shopping list in the docs). People ask: why not add this or that to an existing project. Answer: because it isn't that simple. For me multiple projects existing alongside each other isn't a problem, but a fact of nature. There exist many C/C++ compilers, prog languages, OS'es, processor chips. Diversity and survival of a rich, diverse set of fit-enough creatures is what drives IT as well, in my view.
JdeH
|
10 years ago
|
on: Show HN: Transcrypt – Fast, small Python 3.5 to JavaScript transpiler
Yes it currently works and is systematically tested on Windows and Linux. OSX is planned too. Btw RapydScript also works on Windows, you'll need NodeJS to run it.
JdeH
|
10 years ago
|
on: Show HN: Transcrypt – Fast, small Python 3.5 to JavaScript transpiler
My coding style took shape long before PEP8 or even Python emerged. I tried following PEP8 for a few months, but since I mosty use C++ and Python in combination, pure PEP8 didn't work on the C++ side of things. So I stick with a kind of geometric mean of my Fortran, Basic, Cobol, Algol, Ada, Pascal, Modula2, C, C++, Python, JavaScript, asssembler and PLC AWL coding styles. But that's just the way Transcrypt itself is coded. Feel free to follow PEP8 completely in your code using Transcrypt. It's parsed by the CPython parser, so no problem there. However, if you use JS libs they won't follow PEP 8 either. And that's probably something to accept, as, however big the Python world, one cannot ignore the JS world when programming for the browser. By the way of all those languages I like Python best. But since I write technical (signal processing) apps, C++ interoperation is an inevitable fact for me. To be more exact about the braces: I started out numerical programming in Fortran66, and wanted a formula to look like this: (a + b) * (c + d), so with blanks surrounding the braces, rather than (a+b)*(c+d) which I found harder to decipher at that time. I stuck with that ever since, for any braces, unless adjacent to each other.
JdeH
|
10 years ago
|
on: Show HN: Transcrypt – Fast, small Python 3.5 to JavaScript transpiler
Yes, you know, in the home of an electrician the wiring is a mess... But of course in due time I'll use Transcrypt to make a smashing website...
JdeH
|
10 years ago
|
on: Show HN: Transcrypt – Fast, small Python 3.5 to JavaScript transpiler
Rapydscript came closest to what I was looking for. But I wanted multiple inheritance, assignment of bound functions, properties and recursive tuple assigment.
JdeH
|
10 years ago
|
on: Show HN: Transcrypt – Fast, small Python 3.5 to JavaScript transpiler
Thanks. It had to be debuggable in the browser, so I paid a lot of attention to that. But I wanted the multiple inheritance in. The combination of lean, readable JS and multiple inheritance, is why I started the project.
JdeH
|
10 years ago
|
on: Show HN: Transcrypt – Fast, small Python 3.5 to JavaScript transpiler
The idea is to embrace the JS world to the max and not reinvent any wheels. So Transcrypt will cooperate with any existing JS lib. Only personal I code far more efficiently in Python, especially for bigger apps. But (as is elaborated in the docs) that's personal. I've coded quite complicated technical web apps in JS, but somehow it didn't fit me like Python does. For different people that will be different, I guess.
JdeH
|
10 years ago
|
on: Show HN: Transcrypt – Fast, small Python 3.5 to JavaScript transpiler
Purpose of Transcrypt is to be able to use Python in the JavaScript world. The call document.getElementById doesn't have meaning outside a browser. For non-gui debugging purposes module org.transcrypt.stubs.browser is present supporting the bare minimum. Of course someone could write a library supporting all kinds of DOM functions. But I don't think it would be very useful. The idea is to be able to do the whole web "chain" in Python. So CPython + a framework on the server, Transcrypt in the Browser (or, generally, JS client).
JdeH
|
10 years ago
|
on: Show HN: Transcrypt – Fast, small Python 3.5 to JavaScript transpiler
Because I haven't yet found the time to make something decent. It will change, but cannot promise when...