Comments (8)
I assume a CLI tool is what Josef had in mind.
If you want to make an LSP "plugin" for Vlad's sourcer, it would be pretty nice I guess. I don't know if there is a plugin mechanism of any sort. It might be some more work...
I would like to see plugins for rebar and erlang.mk as well so that you can run rebar3 gradualize
and make gradualize
.
It's all up to you!
from gradualizer.
Just adding to the brainstorming, Gradualizer could also be inserted as a parse transform, which does not actually transform the AST but emits errors in case of a type error. This way it could be part of compiling a module. (In a very futuristic setup it could even modify the AST applying small optimisations based on extra type information it gather during analysis - but I don't think this is the primary goal.)
But before that, I agree, it's better to keep Gradualizer as a standalone step and trigger it via CLI/build tool plugins.
from gradualizer.
Initially I imagined having a CLI tool, but I'm very open to other approaches as well. Right now, I load it together with the project I want to typecheck and use gradualize:type_check_module/1
which checks an already loaded module. It works quite well, but it'd clearly be good to have support for project-wide checking also.
Viktor's suggestions are all very good.
Ultimately, I would really like to see integration with the erlang shell/beam so that it would be possible to get typechecking autmatically when modules are loaded. Simon Thompson from University of Kent expressed interest for such a solution. He wanted to use it for teaching type driven development in Erlang.
from gradualizer.
@gomoripeti yes of course! Let's just case split on when init/1
is passed a rebar_state:t()
! That will probably work for erlang.mk and sourcer as well.
Edit: turns out that idea did not work (rebar-state:t()
is not exported and it does not seem like a common pattern to case split on records from other modules). Fortunately https://github.com/erlang/rebar3/blob/cd858a45e37f6563f22bf3aebee5911521f3c497/src/rebar_plugins.erl#L157 allows for customizing which modules are considered rebar3 providers! I'll go down this route soon.
from gradualizer.
Regarding integration with rebar3: it seems like a plugin needs to be its own OTP application (eventual sourcer integration probably needs this as well). I assume that means gradualizer would need to be an umbrella project? Is that fine with you @josefs and can erlang.mk support that?
from gradualizer.
If making Gradualizer an umbrella project is what it takes to integrate with rebar3, I'm all for it.
As for whether erlang.mk can support umbrella projects, I don't know. @gomoripeti, do you know?
from gradualizer.
I'm not a big fan of library application as an umbrella. For example rebar3 does not support an umbrella app as a dependency. Also creating a hex package with the old rebar3 hex plugin from apps in an umbrella is problematic.
OTOH Gradualizer is already an OTP application, wouldn't just adding a gradualizer_prv
module do the trick? (as a rebar3 plugin - I don't know how erlang.mk plugins work)
from gradualizer.
Erlang.mk plugins are GNU Make include files. No Erlang code involved. They can be used to add make targets such as make gradualize
. It should be a short piece of code that just runs the cli script IMO.
from gradualizer.
Related Issues (20)
- Crash with `Uncaught error: {case_clause, ..` in `typechecker:do_type_check_expr/2`
- Crash with Uncaught error: {badkey, ...} HOT 1
- No clause for gradualizer_lib:pick_value(module()) HOT 2
- No clause of gradualizer_lib:pick_value(any()) HOT 2
- Support the new dynamic() type
- `ok bsr ok` crashes erl_eval:do_apply/7 HOT 4
- An invalid utf32 value can crash eval_bits:eval_exp_field/6
- Crash in gradualizer_fmt:format_type_error: no function_clause_matching
- Crash in typechecker:do_type_check_expr_in/3: bad_key in map_get/2
- Invalid polymorphic code accepted HOT 2
- Support old-style 'catch' keyword HOT 5
- Wrong type in receive...after Timeout
- `binary_to_atom/1` breaks compatibility below OTP 23 HOT 4
- Solving local constraints at each function call to a polymorphic function HOT 6
- support for OTP 26 map comprehensions
- Wrong type location reported?
- Gradualizer can't tell that `m` and `f` don't exist in `erlang:apply(m, f, [some, args])` HOT 2
- Exhaustivity checking issue
- Type representation HOT 2
- How to mention Gradualizer in a paper? HOT 2
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 gradualizer.