<< Back to previous view

[CLJS-211] apply does not work on IFn objects in CLJS Created: 27/Apr/12  Updated: 27/Jul/13  Resolved: 28/Apr/12

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

Type: Defect Priority: Major
Reporter: Brandon Bloom Assignee: Unassigned
Resolution: Completed Votes: 0
Labels: patch,

Attachments: Text File apply1.patch    
Patch: Code and Test


http://dev.clojure.org/jira/browse/CLJS-135 fixed this for multimethods, but the same issue applies to anyone who implements IFn.

The attached patch fixes this by modifying extend-type to emit an apply method on the extended object's prototype.

Comment by Brandon Bloom [ 28/Apr/12 2:31 AM ]

Updated with patch!

Worth noting: String has an implementation of IFn and manually defines prototype.apply. I contemplated deleting it, since this makes it unnecessary, however, my general purpose implementation is probably a tad slower. Maybe, maybe not. Depends on how Google's inlining does. I figured: make it work, then make it fast. So I didn't bother profiling them and left the existing implementation there.

Comment by David Nolen [ 28/Apr/12 12:50 PM ]

fixed, https://github.com/clojure/clojurescript/commit/ddd8199b324997cfe0537be66372162b41ce8293

Generated at Mon Sep 25 01:20:08 CDT 2017 using JIRA 4.4#649-r158309.