Actual arglists have a set structure and can be parsed automatically:
https://github.com/bwo/macroparser/blob/master/src/macroparser/bindings.clj

It's true that you couldn't reconstruct something as informative as the
:arglists metadata on defn from the actual declaration, of course.


On Mon, Jan 13, 2014 at 6:57 PM, Colin Fleming
<colin.mailingl...@gmail.com>wrote:

> This is an interesting discussion, I've been thinking about some of these
> problems as I move towards adding inspections in Cursive. arglist parsing
> is a real problem in Clojure. I'd like to be able to flag invocations of
> functions with bad arities in the editor, but it's very difficult. Even
> defn is complicated, given that its :arglists is:
>
> :arglists '([name doc-string? attr-map? [params*] prepost-map? body]
>             [name doc-string? attr-map? ([params*] prepost-map? body)+
> attr-map?])
>
> and its actual args declaration is:
>
> [&form &env name & fdecl]
>
> There's really no way to parse either of them automatically well. Does
> Eastwood use the actual fn declaration or :arglists for linting? What would
> it do in the case above? It's impossible to tell if doc-string? is a
> boolean or if it's an optional arg.
>
> Oh, and I agree that invalid :arglists as documentation is probably a bad
> idea, since it'll inevitably make this sort of tooling more difficult than
> it already is.
>
>
> On 14 January 2014 14:03, Sean Corfield <s...@corfield.org> wrote:
>
>> On Jan 13, 2014, at 3:09 PM, Nicola Mometto <brobro...@gmail.com> wrote:
>> > To be honest I don't like the idea of libraries attaching not-valid
>> > :arglists meta to Vars at all since the doc[1] for `def` says that
>> :arglists
>> > will be "a list of vector(s) of argument forms, as were supplied to
>> > defn" and the clojure Compiler uses :arglists for type-hints handling.
>>
>> I agree with you in principle - and I'm happy to change java.jdbc to
>> avoid the issue.
>>
>> Could Eastwood (or j.t.a) flag invalid :arglists? The "example" ones in
>> both java.jdbc and congomongo are clearly "invalid" according the special
>> forms page (but they silently "work"). Perhaps if Eastwood finds invalid /
>> suspicious metadata in :arglists, it could use a different linter warning?
>>
>> Sean Corfield -- (904) 302-SEAN
>> An Architect's View -- http://corfield.org/
>>
>> "Perfection is the enemy of the good."
>> -- Gustave Flaubert, French realist novelist (1821-1880)
>>
>>
>>
>>
>  --
> --
> You received this message because you are subscribed to the Google
> Groups "Clojure" group.
> To post to this group, send email to clojure@googlegroups.com
> Note that posts from new members are moderated - please be patient with
> your first post.
> To unsubscribe from this group, send email to
> clojure+unsubscr...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/clojure?hl=en
> ---
> You received this message because you are subscribed to the Google Groups
> "Clojure" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to clojure+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/groups/opt_out.
>



-- 
Ben Wolfson
"Human kind has used its intelligence to vary the flavour of drinks, which
may be sweet, aromatic, fermented or spirit-based. ... Family and social
life also offer numerous other occasions to consume drinks for pleasure."
[Larousse, "Drink" entry]

-- 
-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to