Phobos vs Tango! What's your opinion?
Sean Kelly
sean at f4.ca
Wed Apr 18 08:27:48 PDT 2007
Dan wrote:
> As I just said in a different thread. Tango has this OO gleam in it's eye. It's implementing classes for the craziest of things. Strings don't need a class! Implementing a class to store an array is *hugely* wasteful.
For the most part, I think Tango is OO when appropriate. The objects
that exist do so to retain state, and it is rarely, if ever, necessary
for a user to define their own objects to use Tango. But that aside, a
String is an object, be it a class or a struct. I suppose there's no
reason for it not to be a struct--it simply hasn't come up before, and
no one has ever complained.
> Especially since you can already use:
>
> char[] foo(char[] s){
> s ~= " world";
> }
>
> char[] myS = "hello";
>
> myS.foo();
Yup. Tango may have a String class, but it isn't used very often. Its
real advantage in my opinion is UniString, a generic parent class for
String which doesn't restrict the underlying char type. This isn't
something that's available with built-in arrays.
> Classes are the Microsoft Windows of the programming world; opague, costly, slow, and they have burdensome licensing.
I disagree. Heap allocation may be slower than stack allocation, but
reference passing is fast, and it is often useful to have control over
copy semantics and such. Also, guaranteed reference semantics have some
very real advantages in terms of what's possible in a language.
Sean
More information about the Digitalmars-d
mailing list