Very belatedly, I now think that get, set, and has should maybe all live on ObjectDict instead, as static methods. The hand-wavy reason is that they are "infrastructure" (with regards to interacting with an object), and mixing them with "regular properties" in the object itself is asking for trouble down the line.
Interestingly, there's a recent ES proposal which seems to make the same point, belatedly proposing Object.hasOwn(obj, prop) as a safer obj.hasOwnProperty(prop); for reasons see which post.
I take this general sentiment ("put reflective/meta stuff outside of the object-level stuff") to be the driving force behind Bracha/Ungar's ideas about mirrors (ACM link) — without claiming to understand that work in detail. Indeed, from the abstract of that paper: "Stratification: meta-level facilities must be separated from base-level functionality".
Very belatedly, I now think that
get
,set
, andhas
should maybe all live onObject
Dict
instead, as static methods. The hand-wavy reason is that they are "infrastructure" (with regards to interacting with an object), and mixing them with "regular properties" in the object itself is asking for trouble down the line.Interestingly, there's a recent ES proposal which seems to make the same point, belatedly proposing
Object.hasOwn(obj, prop)
as a saferobj.hasOwnProperty(prop)
; for reasons see which post.I take this general sentiment ("put reflective/meta stuff outside of the object-level stuff") to be the driving force behind Bracha/Ungar's ideas about mirrors (ACM link) — without claiming to understand that work in detail. Indeed, from the abstract of that paper: "Stratification: meta-level facilities must be separated from base-level functionality".
Originally posted by @masak in https://github.com/masak/alma/issues/25#issuecomment-867294686