Re: [Rubydotnet-developer] [ANN] Ruby/.NET bridge release 4 now available
Status: Alpha
Brought to you by:
thomas
From: Richard K. <ri...@in...> - 2003-09-29 11:48:19
|
I will chime in here as someone who has written a lot of Ruby code. When I first started with Ruby, I did not use modules (as namespaces) much at all. Now I use them all the time. I used to use a lot of include <module> (as namespace...not mixin) now I don't do that much. The reason is this. From 95-01 I did mostly Java coding, and not only did you have to place stuff in packages, but anyone that wanted to use your classes either had to import your package, or fully qualify the class. You had a lot of imports just to satisfy casting objects to type. In Ruby because its dynamically typed, you can pass objects around (regardless of their originating namespace) and use them, without the import. This makes me do this quite often: module Foo class Bar class AnotherClass end end end And deeply nest the classes in namespaces without worries because I make sure that the consumption of those "inner" classes is simple (like adding a method to class Bar that accepts parameters and builds an instance of AnotherClass). I hope this makes some sense, and there is more that I could go into (like using the fxRuby API to build FreeRIDE)...but I will leave it at that for now. Now, there are lots of namespace modules in Ruby right now. Those namespaces are there for a reason...to disambiguate/group function. It would be very simple to provide a module that was a flat namespace for those that wanted to just script .NET, but if you are writing lots and lots of Ruby code (and .NET), I don't believe you would want a flat namespace. I would recommend syntax like.. include DotNet::AllClasses # (or something) ...that if you had in a script would give you what you want, but the default should be hierarchical. If I had to choose a library that made everything flat vs. allowed hierarchy, I would chose the latter. Also remember that folks may be building Ruby libraries on top of your .NET bridge to 'rubify' the .NET API. If they did this they would likely not want/need the .NET classes all available in a single namespace, because folks would not be directly using them. -rich On Sunday, September 28, 2003, at 07:03 PM, Thomas Sondergaard wrote: > Now that I'm caving in to your design decisions :-) ... I'd like to > know > how the other people on this list feels about the namespace flattening > feature. Is it what we want for ruby with .net? Why is it that we want > this with ruby, when the .net folks to great measures to make the > hierarchy? |