ClojureScript

defn missing arg vector gives error about max

Details

  • Type: Defect Defect
  • Status: Open Open
  • Priority: Minor Minor
  • Resolution: Unresolved
  • Affects Version/s: None
  • Fix Version/s: None
  • Component/s: None
  • Labels:
    None

Activity

Hide
David Nolen added a comment -

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));
}
Show
David Nolen added a comment - 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));
}
Hide
David Nolen added a comment -

After talking to Rich the above really should not compile.

Show
David Nolen added a comment - After talking to Rich the above really should not compile.
Michał Marczyk made changes -
Field Original Value New Value
Assignee Michał Marczyk [ michalmarczyk ]
Hide
Michał Marczyk added a comment -

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).

Show
Michał Marczyk added a comment - 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).
Michał Marczyk made changes -
Hide
Michał Marczyk added a comment -

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

Show
Michał Marczyk added a comment - Ah, wait, there's a minor typo in the commit message, I'll fix it in a second...
Hide
Michał Marczyk added a comment -

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

Show
Michał Marczyk added a comment - ...um, no there isn't. Sorry for the confusion.
David Nolen made changes -
Priority Major [ 3 ] Minor [ 4 ]

People

Vote (0)
Watch (1)

Dates

  • Created:
    Updated: