• dinomug@lemmy.mlM
      link
      fedilink
      English
      arrow-up
      3
      ·
      9 months ago

      As @yogthos@lemmy.ml mentioned, they differ in implementation:

      • The Hy compiler works by reading the Hy source code into Hy model objects and compiling the Hy model objects into Python abstract syntax tree (ast) objects. In other words, at runtime it is essentially Python source code. Similar to Typescript and CoffeScript (JS).
      • Basilisp is hosted on the Python virtual machine, so its compiler generates native Python bytecode. Similar to Clojure and Scala (Java/JVM) or Elixir (Erlang/BEAM).

      Personally in these cases, I prefer the second approach, because the first one is basically “syntactic sugar”: a Python lispy syntax (embedded), on the other hand Basilisp is a “more complete implementation”, that is, a language independent of the host language with all the strengths and weaknesses of its host system/VM.

      • ☆ Yσɠƚԋσʂ ☆@lemmy.mlOPM
        link
        fedilink
        English
        arrow-up
        2
        arrow-down
        1
        ·
        9 months ago

        I agree, the second approach is more direct, so the only limitation comes from the properties of the VM itself. Transpiling to Python means also inheriting semantic quirks of the intermediate language. It makes sense for ClojureScript to do it, since js is the layer that browsers expose, but if you have the option to target the VM bytecode directly then that’s a much better option.

        • dinomug@lemmy.mlM
          link
          fedilink
          English
          arrow-up
          2
          ·
          9 months ago

          Exactly, The transpilers are necessary when the target system only works exclusively with a single language.