Error formatting macro: pagetree: java.lang.NullPointerException
Skip to end of metadata
Go to start of metadata
You are viewing an old version of this page. View the current version. Compare with Current  |   View Page History

Problems:

  • completeness and consistency: need to be able to read and write records like other Clojure types
  • dynamism: need to create defrecords without class-in-hand. Performantly, of course
  • convenience: want map-like construction instead of positional slotwise construction

Open questions:

  • modularity friendliness
    • multimethods are a poor fit
      • need to have a map that we can clear entries from later
    • keep a weak ref to the entire block of code that instantiates objects
      • tested this at the REPL and it works fine
    • instead of a multimethod for records:
      • record keeps a ConcurrentHashMap of keywords => (weak-ref instantiating-fn)
      • every update to the map walks the queue and clears dead entries
      • similar to the way Clojure handles keywords today
  • print/read syntax
    • for now, use #=(record ...)
    • caveat: forces people to allow arbitrary execution in order to deserialize records
    • Rich: is there some way to open record instantiation without opening arbitrary execution?
  • fn/macro/both?
    • both
    • need macro for metadata from reader
  • one fn, or fn-per-record?
    • one fn
    • otherwise you get namespace issues and name pollution

Note: the resolutions of these questions imply two significant changes to Stu's ancient patch

  • weakref map instead of multimethod
  • macro in addition to fn form

Tickets:

Some (non-contributed) code that demonstrates people's need for this:

Labels: