<< Back to previous view

[CLJS-436] defn missing arg vector gives error about max Created: 06/Dec/12  Updated: 01/Dec/15  Resolved: 01/Dec/15

Status: Closed
Project: ClojureScript
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: Defect Priority: Minor
Reporter: David Nolen Assignee: Michał Marczyk
Resolution: Completed Votes: 0
Labels: None

Attachments: Text File 0001-CLJS-436-validate-arguments-to-fn-forms.patch    

Comment by David Nolen [ 06/Dec/12 10:09 AM ]

The issue is actually a bit subtle for example:

(defn foo "name")

is valid Clojure - however this doesn't work in ClojureScript. In this case ClojureScript generates the following:

function () {
    switch (arguments.length) {
    throw (new Error("Invalid arity: " + arguments.length));
Comment by David Nolen [ 06/Dec/12 10:19 AM ]

After talking to Rich the above really should not compile.

Comment by Michał Marczyk [ 08/Dec/12 6:09 PM ]

Here's a patch with the fn* validations I could think of. It seems to cause the compilation time to increase by a measurable amount, which I find quite surprising (even though it's to be expected that there will be quite of few fn* forms in CLJS sources). I'd love to know if it's just on my box (let's hope so). If validations really have that sort of effect, I'm thinking about refactoring the analyser so that they can be turned on (which should also be the default) and off (for particularly fast compilations).

Comment by Michał Marczyk [ 08/Dec/12 6:11 PM ]

Ah, wait, there's a minor typo in the commit message, I'll fix it in a second...

Comment by Michał Marczyk [ 08/Dec/12 6:13 PM ]

...um, no there isn't. Sorry for the confusion.

Comment by Samuel Miller [ 30/Nov/15 9:32 PM ]

I am not totally sure what the original issue was but both CLJ and CLJS give a "Parameter declaration missing". Maybe this is resolved?

Generated at Wed Jan 17 07:06:30 CST 2018 using JIRA 4.4#649-r158309.