[General] Encapsulation in LK
Daniel Ingalls
Dan.Ingalls at Sun.com
Fri May 1 21:49:34 CEST 2009
hi, it does not look like LK provides any language extension to help
with encapusulation, so all the properties of LK "classes" are public,
isn't it?
Hi Haowei -
Yes. I have been pushing to augment our current "extends" construct
with a message category name, so that the browser can give a bit more
help in the case of major classes. I believe this would be the place
to add a public/private distinction as well.
It's true that without a type system it is harder to guarantee proper
behavior, but in my view 90% of the value is in highlighting the
public protocol so the system is more understandable, and authors are
motivated to make it so.
The fact is that with our cool method-wrapping metasystem (that we use
for profiling of various sorts) it would be easy (truly only a couple
of lines of code!) to implement a test mode in which the system ran
with dynamic checks for violation of private access. This is not a
guarantee of conformance, but it would catch violations in any code
that actually ran. I think we'd be very happy with the result.
Thanks for your interest
- Dan
More information about the lively-kernel
mailing list