this post was submitted on 02 Mar 2024
6 points (87.5% liked)

Lisp Community

684 readers
2 users here now

A community for the Lisp family of programming languages.

Lisp (historically LISP) is a family of programming languages with a long history and a distinctive, fully parenthesized prefix notation. Originally specified in 1958, Lisp is the second-oldest high-level programming language. Only Fortran is older, by one year.

History

Associations and meetings

Resources - TODO

Related communities (dialects) - TODO

founded 5 years ago
MODERATORS
top 5 comments
sorted by: hot top controversial new old
[–] [email protected] 3 points 8 months ago (2 children)

Isn't hy also a lisp for Python? What's the difference here?

[–] [email protected] 3 points 8 months ago (1 children)

As @[email protected] 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.

[–] [email protected] 1 points 8 months ago (1 children)

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.

[–] [email protected] 2 points 8 months ago

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

[–] [email protected] 2 points 8 months ago

I think it's the same idea, but different implementation.