<< Back to previous view

[CONTRIB-102] clojure.contrib.core/-?> (and perhaps others?) have a quoting bug Created: 07/Dec/10  Updated: 26/Jul/13

Status: Open
Project: Clojure-Contrib
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: Defect Priority: Major
Reporter: Jason Wolfe Assignee: Laurent Petit
Resolution: Unresolved Votes: 0
Labels: None
Environment:

1.2 and 1.3


Attachments: File fix-CONTRIB-102.diff     File patch.diff    
Patch: Code

 Description   

See:

https://groups.google.com/group/clojure/browse_frm/thread/cc88ca26352bc604?hl=en#

When called via a namespace-qualified symbol and given three or more arguments, -?> gives the error:

user=> (clojure.contrib.core/-?> 1 inc inc)
CompilerException java.lang.Exception: Unable to resolve symbol: -?>
in this context, compiling:(NO_SOURCE_PATH:3)



 Comments   
Comment by Alan Malloy [ 07/Dec/10 11:27 PM ]

Root cause is in clojure.contrib.core/defnilsafe, so similar functions like .?. will have the same problem. I futzed around for a while to try and figure it out, but defnilsafe is a little too meta for me. The problem is, predictably enough once you've glanced at the code, with ~'~nil-safe-name.

The general solution ought to look like
(let [qname (symbol (name (ns-name *ns*)) (str nil-safe-name))]
`(existing body...
(more stuff using ~qname instead of ~'~nil-safe-name...)))

But I couldn't make it quite work.

Comment by Laurent Petit [ 08/Dec/10 2:14 AM ]

Patch added.

Simple patch where I specifically use fully qualified names when calling defnilsafe.

Comment by Alan Malloy [ 09/Jan/11 4:23 AM ]

What about this patch instead? It makes sure to resolve the symbols supplied to defnilsafe while still within the c.c.core namespace.

I also made the arglists a bit less ugly.

Generated at Tue Jul 29 06:00:48 CDT 2014 using JIRA 4.4#649-r158309.