You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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 #25 (comment)
The text was updated successfully, but these errors were encountered: