emacs-elsa / Elsa

Emacs Lisp Static Analyzer and gradual type system.
GNU General Public License v3.0
640 stars 26 forks source link

Using fewer dependencies #218

Closed phikal closed 1 year ago

phikal commented 1 year ago

Hi,

when taking a look as Elsa I was first overwhelmed by the number of dependencies. Perhaps I am misunderstanding something, but I was expecting a command like M-x elsa-check-buffer that runs through the file and its dependencies to generate a buffer with messages. Could you perhaps explain the need for some of the these packages:

;; Package-Requires: ((emacs "26.1") (trinary "0") (f "0") (dash "2.14") (cl-lib "0.3") (lsp-mode "0") (ansi "0") (async "1.9.7"))

What is f used for? Why is cl-lib needed if the minimum version of Emacs is 26.1. Why the hard dependency on lsp-mode? Why is ansi needed? A lot of these packages are only available on MELPA, which not everyone uses. Would it be imaginable to try and simplify the code or modularize the code base into multiple packages?

Fuco1 commented 1 year ago

Hi. Thanks for your interest in trying this out.

Dependencies exist to reuse code and make development faster. I use some which helped me to make things faster. In the future, we might replace some with built-in functions.

F is used for working with files. Some of the functions have since been implemented in Emacs, but I did not refactor it yet. It's not a high priority.

I don't know why cl-lib is needed, it was necessary in 2018 and I did not remove it. If it's no longer needed, we can remove it.

lsp-mode is used to implement the Elsa language server.

Ansi is used for printing colorful output to the terminal.

Elsa is complex and it currently can't run from user session Emacs and most likely never will. There is many ways to run Elsa mentioned in the Readme. Currently no other ways are supported, but I'm sure it's possible. Elsa is not a linter like "checkdoc", it is a full evaluation engine for Emacs Lisp, it's a gradual type system, it's a language server, it's a refactoring tool. It will be more things in the future. You should imagine it being a separate program that you run alongside Emacs, not inside Emacs.

The code won't be split to multiple packages, that would introduce too much overhead and honestly would serve little purpose.