On Nov 9, 2011, at 3:17 AM, Tom Van Cutsem wrote:
> 2011/11/8 Allen Wirfs-Brock <[email protected]>
> I don't think that [[GetP]] and [[PutP]] need to be "internal methods"
> In spec'ing this I think I would make them be "abstract operations". Internal
> methods are extensions points that can be over-ridden on a per object basis.
> That is what [[Get]] and [[Put]] provides. GetP and SetP define fixed
> operations.
>
> I proposed [[GetP]] and [[SetP]] as internal methods because Proxies would
> "inherit" the built-in behavior for [[Get]] and [[Put]], but "override" the
> [[GetP]] and [[SetP]] operations. If [[GetP]] and [[SetP]] become abstract
> operations, won't they need to explicitly dispatch? Proxies could override
> [[Get]] and [[Put]], but that would require them to duplicate the Object
> [[Get]] and [[Put]] code.
[[Get]] seems to do nothing but redispatch to [[GetP]] so its definition could
be replaced with the body of [[GetP]].
[[Puit] does a redispatch to [[SetP]] followed by a "mode" based conditional
throw depending upon the result of the [[SetP]]. I din't think the the throwing
behavior needs (or even should) be over-ride able by a proxy (or even by an
alternative internal implementation). I would factor the conditional throw code
out of [[Put]] and make it the responsibility of the caller. In practice,
this just means that I would define a new Abstraction Operation that is used
in place of direct calls to [[Put]]. The abstraction operation wold
essentially have the definition you provide for [[Put]] except that it would
call [[Put]] instead of [[SetP]] and the definition of [[Put]] would be
replaced with the body of [[SetP]]
Allen
_______________________________________________
es-discuss mailing list
[email protected]
https://mail.mozilla.org/listinfo/es-discuss