pseudo-lang / pseudo

transpile algorithms/libs to idiomatic JS, Go, C#, Ruby
MIT License
683 stars 43 forks source link

Application idea: css-layout #7

Closed vjeux closed 8 years ago

vjeux commented 8 years ago

Hey! This is a really cool project. I've been considering something similar but ended up using regexes in order to translate a subset of javascript to c, java and c#: https://github.com/facebook/css-layout

Not really sure how you plan to use this but if you need a use case, I think that css-layout is a good one. It is non trivial but not that hard, already exists and is being used in production.

alehander92 commented 8 years ago

Exactly this kind of use cases inspired me to create that project. (It's very weird because I even played with a toy web rendering engine several weeks before making the initial version of Pseudo)

I actually had a plan to add a JavaScript(probably ES6) to Pseudo compiler similar to Pseudo-Python, but I decided to get the python one to a relatively stable beta first.

If I decide to create a pseudo version of css-layout as a kind of real-world-example, would you like to help me if I have any questions about the current library?

vjeux commented 8 years ago

Nice! I'd be more than happy to answer any questions you have :)

alehander92 commented 8 years ago

Excellent. Which of ES5 or ES6 do you think that is more suited for a JS->Pseudo compiler ? In the beginning I was planning on ES5, because I wanted it to be easily accessible for max number of people, but on the other side it doesn't make sense to fight with the legacy stuff there in 2016, when ES6 is closer to Pseudo's standard semantics

vjeux commented 8 years ago

This is a tricky question indeed. In theory I would have said es5 but as you mentioned, pseudo semantics are much closer to es6 so it makes sense to use that. You really don't want people to write function a() {} a.prototype.m = function() { } for oop instead of the easier class a { m() { } }

alehander92 commented 8 years ago

I can work on Pseudo only in my free time, so while creating a js-to-pseudo compiler is relatively straightforward, I'll have to use pseudo-python in the near future. On the other side if I make a python version of css-layout , I'll be probably able to have Pseudo generate translations for it next week. Are you interested in Python or Go versions of the library? (I am making a list of several libs/tools as next targets of Pseudo, so if something can be useful for other people, it would make more sense for me to work on it)

vjeux commented 8 years ago

Just to be clear, I'm not interested in using Pseudo for css-layout, what we have is working well so far and don't plan on changing it. I wanted to give you an idea of existing projects that could have been using Pseudo :)

alehander92 commented 8 years ago

I wouldn't advice you to use Pseudo too : ) I had an idea to fork css-layout and make a css-layout to Python regex transpiler similar to your current C#/Java translators in order to use it with Pseudo-Python and I was just wondering if something like that would be useful for you (pushing such a thing to css-layout upstream, not the pseudo translations)

vjeux commented 8 years ago

We don't have any need for python so not directly useful for us, but I'm pretty sure people that use python would find it useful.

vjeux commented 8 years ago

However, we may not include it to the repo just yet. The more languages we add, the harder it gets to actually build features as you've got to manage all those different environments which is painful :(

alehander92 commented 8 years ago

Makes perfect sense, I'll have it in mind.

as you've got to manage all those different environments which is painful :(

That's exactly one of the things I hope to ease with the project.

Thanks for the clarifications, I'd open another issue if I have anything to ask about the porting of the library : )