Comments (7)
I'm not very knowledgeable about this subject, but I don't understand how it could be possible to provide accurate analysis (or maybe even useful output) without expanding macros. For example, I'm getting lots of "free variable" errors for variables that are bound by macros. There are so many false positives that I can't find true ones in the output. e.g. using Elsa on Ement.el produces:
Analysis finished with 3369 errors, 2519 warnings and 24 notices after 19.827 seconds
And it looks like 95% of them are "free variable" and the like, all of them false positives.
from elsa.
I have no great solution for this, maybe we can special case some macros to be considered safe... but I really would like to avoid loading anything into the runtime if possible.
Having macros expand would also mean loading defuns because macros often defer to functions. This would lead to some crazy spiral of loading a lot of code which might not be safe. Also analyzing any files with side effect would suddenly be impossible. Imagine you have a script which deletes some files and every time elsa runs it would load it and delete your sutff. This is just a complete no-go.
I'm sure it could be done by cherry picking the declarations though and elsa already loads "base emacs" plus its dependencies, so for example expanding cl or dash macros should be safe (elsa itself depends on cl and dash so it loads the definitions anyway).
from elsa.
I'd be willing to run some of that risk, I guess, because if any macro in my code (or any library that I use) did that, I'd throw a fit and fix it or stop using it. (IOW it sounds like a "Doctor, it hurts when I..." problem. :) And I generally don't like macros that delegate to functions, but sometimes it may be necessary.
Anyway, if I as a developer could set an option to enable macro expansion on my own projects, and if it solved the noted problems, I'd be glad. Otherwise, I'm getting so many false positives, that Elsa's output just doesn't seem usable.
from elsa.
Anyway, if I as a developer could set an option to enable macro expansion on my own projects
Yes, I had something like this in mind as well. I just really don't want to destroy people's computers because someone publishes either maliciously or by accident some bad code somewhere... although I get it that right now people just pull in literally whatever garbage comes out of melpa, so :D
from elsa.
I feel your pain, as well. I'm sometimes amazed that something bad hasn't happened yet, AFAIK.
I'd be fine with some kind of requirement to, e.g. write a file named .elsa-expand-macros
in the project directory (or maybe outside of it, so it couldn't be in the git repo), to enable the feature.
from elsa.
Well, I've basically implemented the macro expansion... but the reporting is now garbage because the positions obviously don't align with the original :D That's going to be a tad bit tricky to work out.
from elsa.
Haha, oops! :) Thanks for your work! Looking forward to being able to really benefit from Elsa.
from elsa.
Related Issues (20)
- Replace the internal elsa sequence functions with implementations of seq- methods
- Build fails because it installs some old version of Elsa from melpa? HOT 2
- Implement cl object methods for Emacs interop
- Add rudimentary support for parsing basic defcustom types
- Elsa crashes with `Unknown specializer elsa-explainer` HOT 2
- Move analysis of annotations to analyser instead of reader
- Add rule to warn about ' or #' quoting lambdas => you shouldn't
- Refactor checks and messages to be centered around code
- Create some system of checks for defgeneric before defmethod
- unable to register with lsp or run via cask HOT 5
- Error on `(require 'elsa)`: `(void-variable elsa-type)` HOT 11
- Fix lexical variables and setq
- Using fewer dependencies HOT 1
- eask lint elsa issues HOT 7
- Use without Eask or Cask ? HOT 1
- LSP instructions fail HOT 2
- `elsa--get-requires` fails to process "cl-macs.el.gz" due to `syntax-ppss` HOT 1
- Bool-vector type not supported by elsa-reader HOT 3
- Was Elsa abandoned as a project? HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from elsa.