Thanks Max! The unsigned char / _Bool type distinction is probably the root 
cause.

I did a little digging and found that exported BOOL properties are _supposed_ 
to be handled "correctly." JSExport.h indicates

    BOOL: values are converted consistently with valueWithBool/toBool.

where valueWithBool/toBool almost certainly are referring to methods on 
JSValue, and thus imply that we will end up with boolean values in JavaScript.

I've put together a small standalone Xcode project exhibiting the behavior 
(which indeed isolates it to ObjC/JSC and not ClojureScript): 
https://github.com/mfikes/js-export-bool

Incidentally, this Xcode project illustrates another workaround (in lieu of 
treating 0 as falsey): You can simply avoid BOOL and explicitly use JSValue 
instances. I think I may do this as it pushes the problem into my ObjC code and 
keeps my ClojureScript clean.

I'll file a rdar with Apple, but your explanation of the runtime limitations 
may prevent Apple from actually addressing the issue. (I've also confirmed that 
the problem exists in the latest betas from Apple.)

-- 
Note that posts from new members are moderated - please be patient with your 
first post.
--- 
You received this message because you are subscribed to the Google Groups 
"ClojureScript" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/clojurescript.

Reply via email to