14

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

Comments
  • 0
    Sounds like an utter waste of time.

    What does he claim it solves?
  • 0
    @lotd convert old JS project to Purescript project.
    But any auto generated code are hard to maintain 😝
  • 1
    Why 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
  • 2
    @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
  • 3
    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.
  • 0
    @RememberMe I Can't Post it on public domain 😔
  • 0
    jstopurstojs.sh:

    #!/bin/bash
    echo Circupiling...
    cat $1 > $1.purs.js
    echo done.

    🙂
  • 1
    @Root Haha
    Well can't just do that 😂
Add Comment