digitalmars.D - Phobos vs Tango! What's your opinion?
- =?ISO-8859-1?Q?Dl=e9?= (8/8) Apr 17 2007 Hello people!
- Robert Fraser (3/19) Apr 17 2007 Phobos is mostly open-source, too, now. Tango is more community-driven, ...
- Dan (6/11) Apr 17 2007 That's what Tango is going for.
- Bradley Smith (3/4) Apr 17 2007 Both? How do you use both Phobos and Tango in one program? I thought
- Dan (2/4) Apr 17 2007 Oh. Well then, My Bad(tm).
- Gregor Richards (8/16) Apr 17 2007 At their core, they are incompatible, because their implementations of
- Bill Baxter (4/24) Apr 17 2007 Tangobos will be great. Can't wait.
- Tomas Lindquist Olsen (3/29) Apr 18 2007 If you look at the tango object.di, there is a version(PhobosCompatibili...
- Frits van Bommel (5/12) Apr 18 2007 That still doesn't allow classes to override toString (they'd still need...
- Dan (8/8) Apr 18 2007 As I just said in a different thread. Tango has this OO gleam in it's e...
- Sean Kelly (16/27) Apr 18 2007 For the most part, I think Tango is OO when appropriate. The objects
- Frits van Bommel (10/11) Apr 18 2007 [snip]
- Deewiant (13/19) Apr 18 2007 From what I understand, the string class in Tango is handy because it ha...
- Alexander Panek (4/9) Apr 18 2007 http://dsource.org/projects/tango/docs/current/tango.io.File.html
- Deewiant (5/19) Apr 18 2007 Of course. But I feel uneasy with throwaway objects, like I'm fighting t...
- Alexander Panek (9/27) Apr 18 2007 I can understand that. I've got an issue with throw away objects, too,
- Deewiant (9/16) Apr 18 2007 That's true. Sometimes, however, a hackish method is best.
- torhu (17/36) Apr 18 2007 The only state contained in File is a FilePath instance. Which means
- Sean Kelly (11/16) Apr 18 2007 I prefer free functions in many cases as well. However, different
- Johan Granberg (11/24) Apr 18 2007 I disagree whit it being appropriate to leave the creation of shorthand
- Dan (7/18) Apr 18 2007 A file doesn't require any sort of class in order to manipulate. It's a...
- %u (5/9) Apr 18 2007 Out of interest, have you seen Andrei's "The Power of None" paper? Quite...
- Johan Granberg (2/3) Apr 18 2007 Link?
- David Gileadi (3/8) Apr 18 2007 I found some slides at http://www.nwcpp.org/Meetings/2006/05.html which
- Paolo Invernizzi (6/18) Apr 18 2007 Very very very cool! We'll use it for sure in our C++ works!
- Sean Kelly (5/9) Apr 18 2007 I haven't looked at the slides yet, but it is illegal to throw an
- James Dennett (6/14) Apr 18 2007 It's not illegal in C++, just generally ill-advised
- Sean Kelly (5/18) Apr 18 2007 True enough. Throwing from a dtor isn't illegal, just effectively
- Sean Kelly (4/13) Apr 18 2007 A bit difficult without copy semantics, but probably doable. It's an
- Daniel Giddings (9/25) Apr 17 2007 It is rather unfortunate having both. Ideally Tango should be a
- Bill Baxter (18/49) Apr 17 2007 From what I'm guessing based on what Gregor said, his "Tangobos" will
- Dejan Lekic (6/6) Apr 17 2007 Tango is an amazing project. Respect.
Hello people! I'm working and studing this new (for me :-) ) language. I have some questions and i think your opinion is so precious for me. First, D is a new language.The official library is Phobos. Why another library how Tango that is not compatible with Phobos? Because Tango is opensource and the comunity can develop the library? Why not a concept how java for example, where we have only one big family of class? Fundametals differences between Phobos and Tango? Tank's! I wait your opinions! Dié
Apr 17 2007
Phobos is mostly open-source, too, now. Tango is more community-driven, though. In my opinion, they're both capable and complete libraries, but I prefer tango's API, because it feels a bit more like Java's SE, which I'm used to, rather than C(++)'s standard library. Dlé Wrote:Hello people! I'm working and studing this new (for me :-) ) language. I have some questions and i think your opinion is so precious for me. First, D is a new language.The official library is Phobos. Why another library how Tango that is not compatible with Phobos? Because Tango is opensource and the comunity can develop the library? Why not a concept how java for example, where we have only one big family of class? Fundametals differences between Phobos and Tango? Tank's! I wait your opinions! Dié
Apr 17 2007
Robert Fraser Wrote:Phobos was originally written by Walter Bright to provide a working library for DMD. Several attempts have been made to replace this library, the latest of which is Tango; all were community driven.First, D is a new language.The official library is Phobos. Why another library how Tango that is not compatible with Phobos? Because Tango is opensource and the comunity can develop the library?That's what Tango is going for.Why not a concept how java for example, where we have only one big family of class?Apart from who implemented what, when, Phobos implements the "minimalist" approach, which I like, while Tango implements a "heavy-weight classes with everything" approach, which some people like. Fortunately, we have both libraries available for D, and I think the duality is definitely conducive to the language's development. I can also say that it hasn't been a problem by virtue of the fact that a program may use *either* library *or* both according to your preferences. If you're downloading someone else's code, having Tango and also Phobos on your computer would probably take less than 50mb, which is insignificant really.Fundametals differences between Phobos and Tango?
Apr 17 2007
Dan wrote:Fortunately, we have both libraries available for D, and I think the duality is definitely conducive to the language's development. I can also say that it hasn't been a problem by virtue of the fact that a program may use *either* library *or* both according to your preferences.Both? How do you use both Phobos and Tango in one program? I thought they were incompatible.
Apr 17 2007
Bradley Smith Wrote:Both? How do you use both Phobos and Tango in one program? I thought they were incompatible.Oh. Well then, My Bad(tm).
Apr 17 2007
Bradley Smith wrote:Dan wrote:At their core, they are incompatible, because their implementations of Object and such are incompatible. There is an almost-existent library, tangobos, that allows most Phobos software to compile over Tango. I'm going to get that released properly Any Day Now [tm]. (It exists, but I'm very busy today, don't have time to do everything) - Gregor RichardsFortunately, we have both libraries available for D, and I think the duality is definitely conducive to the language's development. I can also say that it hasn't been a problem by virtue of the fact that a program may use *either* library *or* both according to your preferences.Both? How do you use both Phobos and Tango in one program? I thought they were incompatible.
Apr 17 2007
Gregor Richards wrote:Bradley Smith wrote:Tangobos will be great. Can't wait. How are you going to deal with toString/toUtf8? --bbDan wrote:At their core, they are incompatible, because their implementations of Object and such are incompatible. There is an almost-existent library, tangobos, that allows most Phobos software to compile over Tango. I'm going to get that released properly Any Day Now [tm]. (It exists, but I'm very busy today, don't have time to do everything) - Gregor RichardsFortunately, we have both libraries available for D, and I think the duality is definitely conducive to the language's development. I can also say that it hasn't been a problem by virtue of the fact that a program may use *either* library *or* both according to your preferences.Both? How do you use both Phobos and Tango in one program? I thought they were incompatible.
Apr 17 2007
Bill Baxter wrote:Gregor Richards wrote:If you look at the tango object.di, there is a version(PhobosCompatibility) block which aliases toUTF8->toStringBradley Smith wrote:Tangobos will be great. Can't wait. How are you going to deal with toString/toUtf8? --bbDan wrote:At their core, they are incompatible, because their implementations of Object and such are incompatible. There is an almost-existent library, tangobos, that allows most Phobos software to compile over Tango. I'm going to get that released properly Any Day Now [tm]. (It exists, but I'm very busy today, don't have time to do everything) - Gregor RichardsFortunately, we have both libraries available for D, and I think the duality is definitely conducive to the language's development. I can also say that it hasn't been a problem by virtue of the fact that a program may use *either* library *or* both according to your preferences.Both? How do you use both Phobos and Tango in one program? I thought they were incompatible.
Apr 18 2007
Tomas Lindquist Olsen wrote:Bill Baxter wrote:That still doesn't allow classes to override toString (they'd still need to override toUtf8). Perhaps this should be filed as an enhancement request at IssueZilla (allowing classes to override aliases of member functions)?Tangobos will be great. Can't wait. How are you going to deal with toString/toUtf8?If you look at the tango object.di, there is a version(PhobosCompatibility) block which aliases toUTF8->toString
Apr 18 2007
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. Especially since you can already use: char[] foo(char[] s){ s ~= " world"; } char[] myS = "hello"; myS.foo(); Classes are the Microsoft Windows of the programming world; opague, costly, slow, and they have burdensome licensing.
Apr 18 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
Apr 18 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.[snip] I think you may be a bit confused. Nobody was talking about a string class here. What we were talking about was the fact that Tango has renamed Object.toString (which returns char[]) to object.toUtf8, and now when compiled with -version=PhobosCompatibility has "alias toUtf8 toString;" added to Object. I was pointing out that classes that override toString won't work even with that line added, since aliases can't be overridden.
Apr 18 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.From what I understand, the string class in Tango is handy because it handles Unicode text on the code point level. Thus you don't need to worry about whether it's in UTF-8, -16, or -32, and how this affects stuff like slicing. Of course, there's still the problem of combining characters and ligatures.Classes are the Microsoft Windows of the programming world; opague, costly, slow, and they have burdensome licensing.I don't quite agree with this, but I do prefer free functions in many cases. I can accept having a File class for "heavy-duty" file handling, but I still find myself missing a simple function for just dumping an ubyte[] array of a file's contents. The "problem" is that Tango is currently just so much *better* than Phobos, idioms aside. -- Remove ".doesnotlike.spam" from the mail address.
Apr 18 2007
Deewiant wrote:[...] I don't quite agree with this, but I do prefer free functions in many cases. I can accept having a File class for "heavy-duty" file handling, but I still find myself missing a simple function for just dumping an ubyte[] array of a file's contents.http://dsource.org/projects/tango/docs/current/tango.io.File.html auto contentOfAFile = (new File( "filename" )).read; There you go.
Apr 18 2007
Alexander Panek wrote:Deewiant wrote:Of course. But I feel uneasy with throwaway objects, like I'm fighting the library. There's probably no good reason to, but I do. -- Remove ".doesnotlike.spam" from the mail address.[...] I don't quite agree with this, but I do prefer free functions in many cases. I can accept having a File class for "heavy-duty" file handling, but I still find myself missing a simple function for just dumping an ubyte[] array of a file's contents.http://dsource.org/projects/tango/docs/current/tango.io.File.html auto contentOfAFile = (new File( "filename" )).read; There you go.
Apr 18 2007
Deewiant wrote:Alexander Panek wrote:I can understand that. I've got an issue with throw away objects, too, but given the fact, that you just want a file's content no matter what format it is... the whole process is a bit hackish, and I'd recommend to use other, less hackish solutions of tango's IO package. Even if that would mean two lines of source code more, you won't have throw away, and a proper, tested way of reading data from a file. Kind regards, AlexDeewiant wrote:Of course. But I feel uneasy with throwaway objects, like I'm fighting the library. There's probably no good reason to, but I do.[...] I don't quite agree with this, but I do prefer free functions in many cases. I can accept having a File class for "heavy-duty" file handling, but I still find myself missing a simple function for just dumping an ubyte[] array of a file's contents.http://dsource.org/projects/tango/docs/current/tango.io.File.html auto contentOfAFile = (new File( "filename" )).read; There you go.
Apr 18 2007
Alexander Panek wrote:I've got an issue with throw away objects, too, but given the fact, that you just want a file's content no matter what format it is... the whole process is a bit hackish, and I'd recommend to use other, less hackish solutions of tango's IO package. Even if that would mean two lines of source code more, you won't have throw away, and a proper, tested way of reading data from a file.That's true. Sometimes, however, a hackish method is best. Maybe it's just my general "OO only where it's needed" philosophy showing itself: I'd rather read the raw file contents and work with that, than inherit a Tango file class, redefining methods to handle whatever file format I'm dealing with --- this, I suppose, is what would be the proper "less hackish" method in this case. -- Remove ".doesnotlike.spam" from the mail address.
Apr 18 2007
Deewiant wrote:Alexander Panek wrote:The only state contained in File is a FilePath instance. Which means you can do things like this: auto f = new File("name"); if (f.path.exists) auto x = f.read(); else printf("file not found!\n"); But since you would probably wrap the whole thing in a try-catch block anyway, I'm not sure I'd ever do it like that. On the other hand, you could also create the file, delete it, get its size etc. So File basically combines FilePath and FileConduit into a single class, that's pretty easy to use. But since the FileConduit part is the most useful aspect of File, I'd also be more than happy if Tango just provided free functions to read, write, append etc. All in all, I haven't used Tango enough myself to really have an informed opinion about this issue. Other people might, though.Deewiant wrote:Of course. But I feel uneasy with throwaway objects, like I'm fighting the library. There's probably no good reason to, but I do.[...] I don't quite agree with this, but I do prefer free functions in many cases. I can accept having a File class for "heavy-duty" file handling, but I still find myself missing a simple function for just dumping an ubyte[] array of a file's contents.http://dsource.org/projects/tango/docs/current/tango.io.File.html auto contentOfAFile = (new File( "filename" )).read; There you go.
Apr 18 2007
Deewiant wrote:I don't quite agree with this, but I do prefer free functions in many cases. I can accept having a File class for "heavy-duty" file handling, but I still find myself missing a simple function for just dumping an ubyte[] array of a file's contents.I prefer free functions in many cases as well. However, different people have different needs in this area. Some may want such functions to throw an exception on error, others may want a return code, etc. With this in mind, I feel it is often more appropriate to let the programmer define such things for themselves. Particularly since the process is typically trivial. The only issue with wrapping object libraries is the risk of overhead from the construction of disposable objects, but between 'scope' allocation for classes and Tango's tendency towards highly efficient designs (IMO), I don't think that's a concern here. Sean
Apr 18 2007
Sean Kelly wrote:I prefer free functions in many cases as well. However, different people have different needs in this area. Some may want such functions to throw an exception on error, others may want a return code, etc. With this in mind, I feel it is often more appropriate to let the programmer define such things for themselves. Particularly since the process is typically trivial. The only issue with wrapping object libraries is the risk of overhead from the construction of disposable objects, but between 'scope' allocation for classes and Tango's tendency towards highly efficient designs (IMO), I don't think that's a concern here. SeanI disagree whit it being appropriate to leave the creation of shorthand functions to the users of a library. Of course it's unfeasible to define all the functions potential users might need but I think thouse most needed or used should be defined in the library. This can help to reduse code size of small programs or modules significantly. Regarding the exceptions or error codes issue it could be solved either by providing to versions of the utility functions or by choosing one of them, in the later case the rational is that it is easier to only have to do error handling yourself rather that having to do both error handling and class wrapping. Othervise tango looks great and much more compleat than phobos.
Apr 18 2007
Johan Granberg Wrote:I disagree whit it being appropriate to leave the creation of shorthand functions to the users of a library. Of course it's unfeasible to define all the functions potential users might need but I think thouse most needed or used should be defined in the library. This can help to reduse code size of small programs or modules significantly. Regarding the exceptions or error codes issue it could be solved either by providing to versions of the utility functions or by choosing one of them, in the later case the rational is that it is easier to only have to do error handling yourself rather that having to do both error handling and class wrapping. Othervise tango looks great and much more compleat than phobos.A file doesn't require any sort of class in order to manipulate. It's a raw stream of data. Enter void[]. Want it to be a wchar[]? cast() is a wonderful way to do it. Want to slice off a chunk? Want to perform something on it? Cast it, run it through a function via the notation I suggested earlier. Walter thought of this when he designed the language, and was considered it a design feature that you didn't need to make classes to support primitives. That said, I can see if someone needs to perform operator overloading, wrapping it in a struct (which is transparent and smaller than a class) and then going to it. Classes are inherently big. Want to call a method? It looks up the offset inside an (offsite?) vtbl, and then you lookup &this+offset and call that. 2-6 extra cycles can be trivial, but an offsite vtbl would mean potential cache misses and that's just to call a method, *everything* with classes is messier that way. I honestly don't think classes should *never* be used, I just think they should be used sparingly, when you actually *need* the functionality that a class offers. Occams Razor.
Apr 18 2007
== Quote from Sean Kelly (sean f4.ca)'s articleHowever, different people have different needs in this area. Some may want such functions to throw an exception on error, others may want a return code, etc.Out of interest, have you seen Andrei's "The Power of None" paper? Quite a cute approach to this problem, and IIRC it should be doable in D. cheers Mike
Apr 18 2007
Johan Granberg wrote:%u wrote:I found some slides at http://www.nwcpp.org/Meetings/2006/05.html which explained the concept quite well.The Power of NoneLink?
Apr 18 2007
Very very very cool! We'll use it for sure in our C++ works! But is it really doable in D? What about the casts? Or about the GC, and the throws in the destructors when the Likely goes out of scope? cheers, Paolo %u wrote:== Quote from Sean Kelly (sean f4.ca)'s articleHowever, different people have different needs in this area. Some may want such functions to throw an exception on error, others may want a return code, etc.Out of interest, have you seen Andrei's "The Power of None" paper? Quite a cute approach to this problem, and IIRC it should be doable in D. cheers Mike
Apr 18 2007
Paolo Invernizzi wrote:Very very very cool! We'll use it for sure in our C++ works! But is it really doable in D? What about the casts? Or about the GC, and the throws in the destructors when the Likely goes out of scope?I haven't looked at the slides yet, but it is illegal to throw an exception from a dtor in D, just as in C++. Doing so in Tango will cause the app to exit under normal circumstances. Sean
Apr 18 2007
Sean Kelly wrote:Paolo Invernizzi wrote:It's not illegal in C++, just generally ill-advised as it will terminate() the program if it occurs during stack unwinding while another exception is active. -- JamesVery very very cool! We'll use it for sure in our C++ works! But is it really doable in D? What about the casts? Or about the GC, and the throws in the destructors when the Likely goes out of scope?I haven't looked at the slides yet, but it is illegal to throw an exception from a dtor in D, just as in C++.
Apr 18 2007
James Dennett wrote:Sean Kelly wrote:True enough. Throwing from a dtor isn't illegal, just effectively prohibited. It's more than just a popular convention though, since many STL classes provide nothrow guarantees from their dtors. SeanPaolo Invernizzi wrote:It's not illegal in C++, just generally ill-advised as it will terminate() the program if it occurs during stack unwinding while another exception is active.Very very very cool! We'll use it for sure in our C++ works! But is it really doable in D? What about the casts? Or about the GC, and the throws in the destructors when the Likely goes out of scope?I haven't looked at the slides yet, but it is illegal to throw an exception from a dtor in D, just as in C++.
Apr 18 2007
%u wrote:== Quote from Sean Kelly (sean f4.ca)'s articleA bit difficult without copy semantics, but probably doable. It's an interesting idea. SeanHowever, different people have different needs in this area. Some may want such functions to throw an exception on error, others may want a return code, etc.Out of interest, have you seen Andrei's "The Power of None" paper? Quite a cute approach to this problem, and IIRC it should be doable in D.
Apr 18 2007
Dlé wrote:Hello people! I'm working and studing this new (for me :-) ) language. I have some questions and i think your opinion is so precious for me. First, D is a new language.The official library is Phobos. Why another library how Tango that is not compatible with Phobos? Because Tango is opensource and the comunity can develop the library? Why not a concept how java for example, where we have only one big family of class? Fundametals differences between Phobos and Tango? Tank's! I wait your opinions! DiéIt is rather unfortunate having both. Ideally Tango should be a stand-alone library that is an optional (and useful) extra. [Aside: is it possible to get the incompatible code in some way included in Phobos so they can run alongside happily? - are the incompatibilities in Tango enough to break large portions of Phobos if they were moved to it?] They are incompatible however, forcing anyone developing to choose between the two and fragmenting libraries where developers haven't explicitly supported both.
Apr 17 2007
Daniel Giddings wrote:Dlé wrote:From what I'm guessing based on what Gregor said, his "Tangobos" will be based on Tango, but will allow you from a Tango app to do things like "import std.string;" How he's going about it... I don't know. I think you pretty much have to create a modified copy of the Phobos source tree with all instances of toString changed to toUtf8. Then you need to make a compatibility std.gc module that delegates all the heavy lifting to Phobos. toString to toUtf8 should be pretty easy to automate with sed/perl/std.regex. The std.gc stuff used in phobos looks pretty minimal. Just file.d,outbuffer.d,stdio.d, and zlib.d seem to call the gc directly. Although toString is also a standalone function in addition to being a method on Phobos' object. So I guess that makes it a little trickier to translate. Oh, and there are exceptions to deal with too. And probably a few more things I haven't thought of but Gregor is knee-deep in trying to get working. --bbHello people! I'm working and studing this new (for me :-) ) language. I have some questions and i think your opinion is so precious for me. First, D is a new language.The official library is Phobos. Why another library how Tango that is not compatible with Phobos? Because Tango is opensource and the comunity can develop the library? Why not a concept how java for example, where we have only one big family of class? Fundametals differences between Phobos and Tango? Tank's! I wait your opinions! DiéIt is rather unfortunate having both. Ideally Tango should be a stand-alone library that is an optional (and useful) extra. [Aside: is it possible to get the incompatible code in some way included in Phobos so they can run alongside happily? - are the incompatibilities in Tango enough to break large portions of Phobos if they were moved to it?] They are incompatible however, forcing anyone developing to choose between the two and fragmenting libraries where developers haven't explicitly supported both.
Apr 17 2007
Tango is an amazing project. Respect. I understand reasons behind some decisions behind Tango, and I hope Walter will finally (re)consider suggestions from Tango team regarding phobos, and compiler... However, since I am the person who sticks to the standards, and Phobos is a "standard D library", I have chosen Phobos. I check Tango on every major release and it is definitely worth trying. So if You did not try Tango - do it! :D Kind regards Dejan
Apr 17 2007