Right now, when I define a deftype function f the generated js code looks 
something like:

f = function(self, arg) {
  if (self.func) {
    return self.func(self, arg);
  }
  else {
    // check if self implements protocol
    return f._(self, arg);
  }
}
    
This seems like an awful lot of indirection just for a function call. Is 
there a way to disable the protocol checks (maybe with advanced 
optimization?). Or do I have to define all functions outside the deftype in 
order to avoid the additional overhead of type checking?

I mean, yes, the error messages are helpful, but when I call a deftype 
function with the wrong argument I'm gonna get a runtime error in 99% of 
the cases anyway when I access some invalid field.

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Reply via email to