Permalink
Browse files

Revert "CLJ-1024: Check for invalid varags/destrucuring uses."

This reverts commit ed9670b.
  • Loading branch information...
1 parent ed99515 commit c0b81aa9d7ef30a5c252367c162bf7fb410ea4d7 @stuarthalloway stuarthalloway committed Feb 14, 2013
Showing with 0 additions and 23 deletions.
  1. +0 −23 src/clj/clojure/core_deftype.clj
@@ -16,25 +16,6 @@
[ns]
(.replace (str ns) \- \_))
-(defn ^:private throw-on-varargs
- "Throws an exception if arglist contains a varargs declaration.
- Protocol/interface method impls defined with deftype, defrecord, and reify
- don't support varags."
- [arglist]
- (when (some #(= '& %) arglist)
- (throw (IllegalArgumentException.
- "No varargs support for definterface and defprotocol method sigs;
-ditto for method impls defined with deftype, defrecord, and reify."))))
-
-(defn ^:private throw-on-varargs-or-destr
- "Throws an exception if arglist contains a varargs declaration or a
- destructuring form.
- Protocol/interface method signatures shouldn't use varargs/destructuring."
- [arglist]
- (when (some #(or (= '& %) (coll? %)) arglist)
- (throw (IllegalArgumentException.
- "No varargs nor destructuring support for definterface and defprotocol method sigs."))))
-
;for now, built on gen-interface
(defmacro definterface
"Creates a new Java interface with the given name and method sigs.
@@ -48,7 +29,6 @@ ditto for method impls defined with deftype, defrecord, and reify."))))
[name & sigs]
(let [tag (fn [x] (or (:tag (meta x)) Object))
psig (fn [[name [& args]]]
- (throw-on-varargs-or-destr args)
(vector name (vec (map tag args)) (tag name) (map meta args)))
cname (with-meta (symbol (str (namespace-munge *ns*) "." name)) (meta name))]
`(let []
@@ -81,7 +61,6 @@ ditto for method impls defined with deftype, defrecord, and reify."))))
(disj 'Object 'java.lang.Object)
vec)
methods (map (fn [[name params & body]]
- (throw-on-varargs params)
(cons name (maybe-destructured params body)))
(apply concat (vals impls)))]
(when-let [bad-opts (seq (remove #{:no-print} (keys opts)))]
@@ -626,8 +605,6 @@ ditto for method impls defined with deftype, defrecord, and reify."))))
(if (vector? (first rs))
(recur (conj as (first rs)) (next rs))
[(seq as) (first rs)]))]
- (doseq [arglist arglists]
- (throw-on-varargs-or-destr arglist))
(when (some #{0} (map count arglists))
(throw (IllegalArgumentException. (str "Protocol fn: " mname " must take at least one arg"))))
(assoc m (keyword mname)

0 comments on commit c0b81aa

Please sign in to comment.