Ramblings of a curious coder

I’ve just started learning elixir (reading through the excellent Programming Elixir at the moment) and although it’s still very early days I’m already in love. Pattern matching for example is something I remembered fondly from my days dabbling with ML. As Dave says in the book though, there’s a bit of a leap of faith involved in leaving behind the object oriented world. I’m used to being able to do things like

I love keyword arguments. No more excuses for methods with too many positional parameters and say goodbye to all the awkward hash wrangling code that was needed when using optional hashes as poor man’s keyword arguments

Ruby 2.0 didn’t allow for mandatory keyword arguments. You could fake it by doing something like

12

defsome_methodrequired:(raiseArgumentError,"you must pass a value for required ")end

it used to precompile everything twice: once with the digests (the checksums in the filename) and once without.

The precompilation happened twice because your assets can reference other assets (eg a stylesheet with some image or font urls) so the difference between the digest assets and the non digest assets wasn’t just the filename.

In the session I presented at railsclub I finished off by showing how to use FFI to call into Objective-C (If you weren’t there on then my slides are online - I would recommend browsing through the section on FFI). I didn’t go into any detail because it was the end of what I think was a pretty technically intense session.

This definitely comes under the category of “doing something to prove it can be done” rather than anything more serious, but if you’d like to know how it works then read on!

NSToolbar has a mode where the toolbar items are selectable - this is commonly used to create preference windows, each item in the toolbar representing a section.
If your delegate responds to toolbarSelectableItemIdentifiers: then the toolbar will allow these items to be selected.

You can do all this in IB (along with the rest of the standard NSToolbarDelegate stuff), since IB allows you to mark items as selectable.

The bit that confused me is that unless you also assign an action to the toolbar item (I’ve got mine pointing at a selectSection: method) then nothing will happen when you click the toolbar items, not even a change of selection state. Nowhere does this seem to be documented. I expected that even though I’d hooked up no actions and the toolbar wouldn’t be useful I would at least be able to play
with the selection state. Hopefully this helps anyone else wondering why their toolbar isn’t working.