3 ms·
I've wanted enumerable classes for *so long*
- whitten 8y agoI am intrigued by the mention of writing AST walkers and a data flow tool for call graphs. Is it possible that you can talk about them on a blog post ? I would like to know why they are useful and how you write them.
- awinter-py 8y agonot sure there's a simple codebase to study for learning this stuff, but most sophisticated linters or static analyzers will have some amount of dataflow. At minimum you're going to be managing nested scopes, resolving names to values and assigning types to names. Sample PR from the eslint project that has all these elements: https://github.com/eslint/eslint/pull/10020/files https://github.com/eslint/eslint/pull/10020/files IMO dataflow is more useful for dynamically typed languages. In static languages where the type of every name is declared somewhere, tracing values through local scopes and function calls isn't as critical (though still valuable).
- ken 8y agoIn CLOS: just call CLASS-SLOTS. AMOP is one of the best books I've ever read and despite being over a quarter century old (1991) I've still never seen an object system as well designed.
- crux 8y agoJust in case anyone else was wondering, because it took me some googling: that stands for Art of the Metaobject Protocol.
- earenndil 8y agoIn d: __traits(allMembers)[1]. If you just want variables, it's _slightly_ more work, but not a lot. 1: https://dlang.org/spec/traits.html#allMembers https://dlang.org/spec/traits.html#allMembers