Archive for March 16, 2014

Sunday, March 16, 2014

Compiler Warnings Explained

Peter Hosey:

There are some warnings I don’t turn on, for any of several reasons […] The rest of the warnings, I turn on because either they make something clearer or they tell me about either real or potential (i.e., future real) bugs.

The Siren Call of KVO and (Cocoa) Bindings

Marcel Weiher:

Bindings are one-way dataflow constraints, specifically with the equation limited to y = x1. More complex equations can be obtained by using NSValueTransformers. KVO is more of an implicit invocation mechanism that is used primarily to build ad-hoc dataflow constraints.


Anyway, when you add it all up, my conclusion is that while I would really, really, really like a good constraint solving system (at least for spreadsheet constraints), KVO and Bindings are not it. They are too simplistic, too fragile and solve too little of the actual problem to be worth the trouble. It is easier to just write that damn state maintenance code, and infinitely easier to debug it.


KVO is akin to manual memory management - a lot of individual pieces to tweak and remember, and the outcome is very brittle and error-prone.

Why objc_msgSend Must be Written in Assembly

Ari Grant:

Calling a function in C requires the signature to be known for each call-site at compile-time; doing so at run-time is not possible and so one must drop down into assembly and party there instead.

OptionBits and BOOL

Jeremy W. Sherman:

Use bool or use !!, and beware the wicked type conversions.