<< Back to previous view

[CLJ-940] Passing a non-sequence to refer :only results in uninformative exception Created: 24/Feb/12  Updated: 01/Sep/12  Resolved: 01/Sep/12

Status: Closed
Project: Clojure
Component/s: None
Affects Version/s: Release 1.3, Release 1.4
Fix Version/s: Release 1.5

Type: Defect Priority: Major
Reporter: Hugo Duncan Assignee: Stuart Sierra
Resolution: Completed Votes: 0
Labels: None

Attachments: File 0001-add-exception-for-non-sequence-in-refer-only.diff     Text File 0003-CLJ-940-check-for-sequential.patch     Text File clj-940-add-exception-for-non-sequence-in-refer-only-patch.txt    
Patch: Code
Approval: Ok
Waiting On: Rich Hickey


Compiling the following code results in a Don't know how to create ISeq from: clojure.lang.Symbol exception

(ns clj14.myns
[clojure.core :only seq]))

Comment by Andy Fingerhut [ 09/Mar/12 9:22 AM ]

Hugo, your patch doesn't apply cleanly to latest master due to some changed lines of context around it that are from before Nov 2011, which confuses me given that your patch was created recently. I could mechanically update it, but if you could take a look and create an updated patch yourself it would be safer.

Comment by Andy Fingerhut [ 26/Apr/12 7:36 PM ]

Patch clj-940-add-exception-for-non-sequence-in-refer-only-patch.txt dated Apr 26 2012 is same as Hugo Duncan's, except it applies cleanly to latest master as of today.

Comment by Stuart Sierra [ 17/Aug/12 9:14 AM ]

Previous patch does not accurately reflect new :refer syntax in ns:

(:require [... :refer ...])

I offer a new patch, 0003-CLJ-940-check-for-sequential.patch, as an alternative.

This patch also checks for the more specific clojure.lang.Sequential instead of IPersistentCollection (which includes sets and maps).

If I had my druthers, I'd check for IPersistentList, but I can't face the screaming that would result.

Neither patch provides file/line information in the error, but there isn't much affordance for that in core.clj right now.

Comment by Aaron Bedra [ 21/Aug/12 10:57 AM ]

Applies cleanly against d4170e65d001c8c2976f1bd7159484056b9a9d6d. This looks good to me. We should at some point talk more about the implications of checking IPersistenList, but I think there is enough value here to push it forward.

Generated at Fri Jan 19 23:43:21 CST 2018 using JIRA 4.4#649-r158309.