What’s hawt

  • Google Apps and App Engine
  • Creating the Guardian's Glassware
  • An overview of Javascript reactive frameworks
  • Interviewing in software 2023
  • About
  • Three Little Mockers

By Category

  • Widgets
  • Search

Echo One

Sequentially arranged sentences composed of words (and punctuation)

Tag Archives: metadata

Programming

Clojure metadata, the compromise solution

27 October 2010rreesclojure, dojo, London, metadata Leave a comment

One thing I think is really great about Clojure is the deep reflection and runtime manipulation capabilities that are on offer (it is one thing that I really miss in Scala for example). Last night at the London Clojure Dojo (website needs to be created this month I feel) we needed to distinguish a subset of functions. Now ideally we should have put this subset in a different namespace but you know code that is written by many hands doesn’t always make sense and now we are where we are.

We knew it was possible to examine all the functions in our namespace and that the relevant functions would take two arguments with particular names (we are at least consistent in that respect). My initial view was “hell, lets just find every function taking the the right names”, at the other end of the spectrum were people who thought we should explicitly declare the list of valid functions. In the end we settled on adding some metadata to the relevant functions.

This seemed a reasonable compromise, it means that applicable functions are explicitly defined but that in terms of code maintenance we only have to write one function that generates a list of all the valid functions and this will correctly respond to changes in the code as they are made.

This led to another conversation at work about whether a function’s metadata is mutable or not. Now it seems that as map it should be possible to edit it but it’s an interesting question.

Standard
Blog at WordPress.com.
  • Subscribe Subscribed
    Echo One
    Join 216 other subscribers

    Have a WordPress.com account? Log in now.

  • Echo One
    View site in Reader
    Manage subscriptionsSign upLog in
    Report this content
    Collapse this bar