I suggest that this may live happily as an add on module.
Ruby is quite 'liberal' in the access control. You may still get acces to a var via reflection, so introducing a safe syntax like this still does'nt gain you the security you may expect from eiffel.
BTW, having this as a pluggable module still makes this a powerful feature to include in your code, if you feel the need for it..
I tend to agree with the last comment. I do not think this should be built into Ruby "out of the box".
But, I do think, that if you keep fine tuning this as a module so it works really well, it would certainly make a fine add-on library to include in the Ruby distribution.
The problem with using this as a module (at least as Ruby is right now) is that it gives very (very!) limited call-stack access, which makes determining the caller of a method very fragile.
I agree that reflection in Ruby can bypass any sort of protection, but that's not really the point. All I want is to make it difficult for people to access my methods, to encourage the use of my published, "public" API. Also, since this is really a superset of Ruby's existing access control, it shouldn't change anything at all as far as those developers who don't want it are concerned.
I could live with doing this as a module, though, as long as the call-stack becomes more robustly accessible.
this is cool, but maybe as a module (, 2003-12-06 11:26:07)
Ruby is quite 'liberal' in the access control. You may still get acces to a var via reflection, so introducing a safe syntax like this still does'nt gain you the security you may expect from eiffel.
BTW, having this as a pluggable module still makes this a powerful feature to include in your code, if you feel the need for it..
concur, a good module (transami, 2003-12-07 16:57:11)
I tend to agree with the last comment. I do not think this should be built into Ruby "out of the box".
But, I do think, that if you keep fine tuning this as a module so it works really well, it would certainly make a fine add-on library to include in the Ruby distribution.
Problem with using this as module (minam, 2003-12-07 20:29:57)
I agree that reflection in Ruby can bypass any sort of protection, but that's not really the point. All I want is to make it difficult for people to access my methods, to encourage the use of my published, "public" API. Also, since this is really a superset of Ruby's existing access control, it shouldn't change anything at all as far as those developers who don't want it are concerned.
I could live with doing this as a module, though, as long as the call-stack becomes more robustly accessible.