I’ve been remiss in my emacs-fu. Lexical binding has been around for awhile, but I haven’t played with it.
Until tonight.
One of the things I discovered is that enabling it isn’t exactly easy when you’re just farting around in an org-mode babel source buffer. According to the docs you can use set variable lexical-binding to a non-nil value, and you’re golden… with some very annoying caveats: It has to be a buffer-local variable, and it has to be set at the top of the file. This doesn’t work well in a *scratch* buffer, or an org-mode source buffer for that matter.
Luckily, there is another way. Eval takes a second argument now, that when true will eval the expression using lexical binding. This makes it really easy to build a macro that is perfect for playing with lexical binding, or using lexical binding in your init file:
(defmacro lexically (&rest forms)
"Lexically execute forms"
`(eval '(progn ,@forms)
t))
BAM! And there you go. Now you can just wrap whatever forms you want in a “lexically” form, and you’re good to go. This works for random snippets, or full defuns.
Obviously this isn’t ideal for writing a package, but it is good for smaller snippets in your init file, or messing around.
The list of words beginning with ‘S’ that Phineas and Ferb are endeavoring to say “this summer”.
I think in a later episode they actually bust out ‘solipsism’.
It’s a small thing, but when I see code like this:
if (somefoo) {
....
} // end somefoo
I know I am in for a bad time.
Don’t do this. If you do this, stop. There are plenty of ways to fix this. One way is by replacing the body of your consequent with a call to a function. Oh, what’s that? your code depends on 5 variables that are set before the consequent?
Yea, you’re probably doing that wrong too.
Moose and Squirrel!
I got to “I Am Error” in Binding of Issac.
God I love that game.
Issac themed art coming soon!