Re: [Clojurescript] Way to avoid function call indirection in deftypes?

2012-03-08 Thread Philip K
> > Nope, JavaScript has a terrible notion of truth. What if you want to add > functionality to numbers? Or strings? 0 and blank strings are false-y. > > That said I have a branch where we inline the truth test which does a give > a perf boost on many JS engines. This needs to benchmarked more t

Re: [Clojurescript] Way to avoid function call indirection in deftypes?

2012-03-08 Thread Philip K
I see the rationale now, thanks. One question though, isn't it possible to generate: if (self && self.func) { return self.func(self); } instead of if (truth(truth(self) ? self.func : self)) { return self.func(self); } -- You received this message because you are subscribed to the Google G

[Clojurescript] Way to avoid function call indirection in deftypes?

2012-03-08 Thread Philip K
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 indir

MacOS menu bar time tracker in Clojure

2012-02-20 Thread Philip K
Hey, I just made a text file based menu bar timer tracker as a weekend project in Clojure. It allows for easy task management using your favorite text editor, easy prioritization, time tracking and easy Dropbox integration; it doesn't scale well beyond a single person, but for small projects it ma

Re: CLJS: Checked Arithmetic?

2012-01-28 Thread philip k
I'm not so sure about this, but is it possible to throw an exception when dividing by zero for example? I don't know if exceptions are the right way of dealing with this at all, but at least this would be bringing things more in line with Clojure. On Jan 27, 10:03 pm, David Nolen wrote: > In this

Re: (:require-macros ...) produces empty js file

2012-01-27 Thread philip k
an 27 18:12 ../ -rw-r--r-- 1 phil staff0 Jan 27 18:16 core.js i.e. core.js is empty. Very strange. On Jan 27, 5:16 pm, David Nolen wrote: > On Fri, Jan 27, 2012 at 1:26 AM, philip k wrote: > > Hi, I'm using cljs-watch to cross compile generic Clojure code into > &g

(:require-macros ...) produces empty js file

2012-01-27 Thread philip k
Hi, I'm using cljs-watch to cross compile generic Clojure code into both class files and js files using the latest master Clojurescript checkout; this all works wonderfully until I try to add a (:require- macros ...) directive as follows: // in xyz.base.view (ns xyz.base.view (:require ... (: