Skip to main content

Sherlock Holmes and the "Case of the Errant Erlang Macro"


The compiler dutifully informed me that:

case error_logger:logfile({open, ?IMP_LOGFILE} ) of

was giving out:

/imp_scan.erl:137: syntax error before: '}'

...and boy did I end up scratching my head until finally, applying Rule #1 (you spelled it wrong) coupled with the Holmes conjecture I realised that (a) I was indeed wrong again and (b) the compiler was correct and here was the problem:

-define(IMP_LOGFILE,"/tmp/impscan.log"}).

Yes, having decided that the string was best made a constant I refactored the code and accidentally left the trailing closing brace in the macro, hence my confusion! The error message was referring to that brace but because the parameter was itself a tuple I had become confused. Just another day on the job.

PS: As I like to call it, the "Holmes conjecture",
How often have I said to you that when you have eliminated the impossible, whatever remains, however improbable, must be the truth?
.

Comments

Popular posts from this blog

Cross platform development with Scheme

Just a quick note about something I recently found whilst trying not to buy MOCL… http://www.lambdanative.org/ LambdaNative is developed and maintained by the Pediatric Anethesia Research Team (PART) and the Electical and Computer Engineering in Medicine (ECEM) group at the University of British Columbia (UBC). I have spent a week or two evaluating it and accidentally contributed a pull request that got merged and one that didn’t and I have to say that, for what it offers, it is awesomely good. Having personally spent many hours with it now, I do not yet think it is ready for mainstream development for a few reasons. I don’t mean that it a bad way either. What I mean is that the language, Scheme, is not really that widely known and as such it probably won’t break out into the public arena any time yet. That’s a real shame because I think that they have achieved an amazing thing; total abstraction of the underlying platform with a really powerful, underestimated language. ...

The Coolest Shortest PHP Function I Will Ever Write

Having now released my own programming language, FELT , and learned a lot about this and that in the process I have of late, in the evenings, been struggling to reconcile my love of LISP and how simple FELT makes some PHP coding task leaner and meaner with the fact that I still have to use PHP for my day job. In my language, FELT , I have used the square brackets to define a "normal" array and curly braces to define a "key-value" array, mainly because this is identical to JSON format and anybody familiar with Javascript coding just won't have any issues getting to grips with that now will they! Let's take some simple examples of FELT code: (defvar simple-array [1 2 3 4]) (defvar simple-map {:name "Eric" :age 42 :occupation "Viking Hacker"}) When FELT has done its thing, we get the following PHP code, $simple_array = array(1, 2, 3, 4); $simple_map = array('name' => "Eric", 'age' => 42, ...

Angular.JS ... absolutely awesome BUT...

Aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaagh! Sort the documentation soon please!  More soon, I really do like it though. :)