Arc Forumnew | comments | leaders | submitlogin
2 points by akkartik 4436 days ago | link | parent

Templates are now first-class tagged types: http://github.com/nex3/arc/commit/d2a1f507e0

I've made two incompatible changes, however.

a) Default values are not inlined during initialization. Before:

  > (inst 'foo)
  #hash((field1 . default))
After:

  > (inst 'foo)
  (tagged tem (foo #hash() ...))
Non-existent fields are looked up from the template at read time. This is useful if you ever want to change the default. Say you decide to change the default value for showdead in HN. If you updated the template today it would only update for new users. You could go through and set everybody's showdead, but that seems invasive. After my changes existing users will pick up the new default, but if somebody tried setting showdead in the past and explicitly reset it to the default -- then they get to keep their setting.

b) Reading from file now includes all fields rather than just the ones included in the template. Does this seem reasonable? I think the reasoning for dropping unknown fields was so you could upgrade or rollback the template and it would work with existing data. But if you delete a field it doesn't do any harm if it's set, right?

inst has always permitted unknown fields, so this way things seem more consistent.