Ranter
Join devRant
Do all the things like
++ or -- rants, post your own rants, comment on others' rants and build your customized dev avatar
Sign Up
Pipeless API
From the creators of devRant, Pipeless lets you power real-time personalized recommendations and activity feeds using a simple API
Learn More
Comments
-
@lotd convert old JS project to Purescript project.
But any auto generated code are hard to maintain 😝 -
lotd77757yWhy would that provide sny particular benefits..
I guess one could make the compilers transcode quite opinionated with strict rules and it could be slightly better.
But at that point, wouldn't a big ol' refactor or rewrite do a better job -
@lotd writing compiler for converting imperative code to functional causes lot of issue specially with mutability and These F**king loops and Try catch. And we need to write the Compiler looking at only one Project. but it need to work on many other projects too
Yeah Rewriting will do better job and code will be much more understandable -
Oh my.
A compiler with a FP language as a target is a very difficult thing indeed, you'll need to do an insane amount of verification and validation to ensure that it works. Especially, like you said, things like try/catch and loops.
Plus, the main benefit of FP comes from the way you use it to structure your program, and it is fundamentally different from imperative or object-oriented styles. You could use monads to mimic imperative structure efficiently (code-wise, that is) but it defeats the whole point of using PureScript.
Rewriting is definitely a better idea, but eh, managers.
If they're okay with it (probably not) you could post your code to the public domain, I'm sure it'll be a pretty interesting thing.
Working on a compiler which Convert JavaScript Code to Purescript Code Which Complie back to JavaScript.
I don't understand this decision of my Manager
rant
fml jstopurstojs why?