P
Phil Tomson
I want to have a discussion on certain safety issues and then submit some
RCRs. Safety as in avoiding name collisions, etc.
In another thread some issues were raised about certain 'dangerous'
practices common within the Ruby community that could limit Ruby's
acceptance in some circles.
The first one is being able to add/change methods in base classes.
Personally, I consider this a great feature (the 'add' part much more than
the 'change' part - changing methods in base classes should be avoided),
but some consider it dangerous in a production environment. To make them
feel more comfortable, what if we added a command line option that would
essentially freeze all built-in classes/modules when Ruby starts up?
What about introducing different 'freeze levels'? For example one level
would allow you to add methods to built-in classes but would not allow you
to redefine existing methods. Another level would disallow both. The
default level would of course be no freeze (as things are now).
Another issue that was raised was that Ruby doesn't have effective methods
(or at least not as effective as other languages have) of avoiding
namespace collisions. For example, when we 'include' a module we get all
of the methods in that module imported into the current
namespace. What if we could optionally list the methods/classes we want
to include, similar to Python's import:
import Blah func1,func2,MyClass
This imports the methods func1 and func2 and the class MyClass from Blah.
Perhaps similar options could be added to 'require'.
Thoughts? Is this necessary? Is it advisable?
Could Ruby use some air bags and seatbelts?
Phil
RCRs. Safety as in avoiding name collisions, etc.
In another thread some issues were raised about certain 'dangerous'
practices common within the Ruby community that could limit Ruby's
acceptance in some circles.
The first one is being able to add/change methods in base classes.
Personally, I consider this a great feature (the 'add' part much more than
the 'change' part - changing methods in base classes should be avoided),
but some consider it dangerous in a production environment. To make them
feel more comfortable, what if we added a command line option that would
essentially freeze all built-in classes/modules when Ruby starts up?
What about introducing different 'freeze levels'? For example one level
would allow you to add methods to built-in classes but would not allow you
to redefine existing methods. Another level would disallow both. The
default level would of course be no freeze (as things are now).
Another issue that was raised was that Ruby doesn't have effective methods
(or at least not as effective as other languages have) of avoiding
namespace collisions. For example, when we 'include' a module we get all
of the methods in that module imported into the current
namespace. What if we could optionally list the methods/classes we want
to include, similar to Python's import:
import Blah func1,func2,MyClass
This imports the methods func1 and func2 and the class MyClass from Blah.
Perhaps similar options could be added to 'require'.
Thoughts? Is this necessary? Is it advisable?
Could Ruby use some air bags and seatbelts?
Phil