digitalmars.D - Modules and libraries
- Vladimir (8/8) Mar 29 2005 Hello All !
- =?ISO-8859-1?Q?Anders_F_Bj=F6rklund?= (13/21) Mar 29 2005 That is the default behaviour, but you can usually use the D
- Vladimir (13/19) Mar 30 2005 Yes, but following some (restrictive and complicated) rules one can keep...
- =?ISO-8859-1?Q?Anders_F_Bj=F6rklund?= (7/14) Mar 30 2005 They do check the type of the parameter, since that is available in D...
- Vladimir (4/13) Mar 30 2005 Thanks a lot for suggestion.
- =?ISO-8859-1?Q?Anders_F_Bj=F6rklund?= (7/13) Mar 30 2005 It has been replaced by others, both with other GC and with malloc.
- Ben Hinkle (9/17) Mar 30 2005 What do you mean by compile-time type-safe? Note one can run
- Vladimir (4/20) Mar 30 2005 OK, it's good for built-in types. But can I extend it in such way, that
- =?ISO-8859-1?Q?Anders_F_Bj=F6rklund?= (3/6) Mar 30 2005 You can override "char[] toString();", if that is what you mean here ?
- Ben Hinkle (3/7) Mar 30 2005 Structs cause problems, I believe. Everything else should work - though ...
- Vladimir (3/13) Mar 30 2005 Yes, you are right. Using toString is a good solution.
- Ben Hinkle (2/4) Mar 30 2005 writef and writefln are type-safe. You are probably thinking of printf,
- J C Calvarese (10/28) Mar 30 2005 "by my own one" - I think it depends how dirty you like to get your
Hello All ! I'm newbie in D. Reading sections "Modules" in specs I've realized, that any time I want to use any D library I need a full source of that library, not just compiled .o file and header file as in C/C++. Am I right ? Is it right behavior ? One more question: it seems that I can use printf even if I do not import any modules. Does it means that printf is language feature or does compiler implicitly import some libraries ?
Mar 29 2005
Vladimir wrote:I'm newbie in D.You might want to check out the new digitalmars.D.learn newsgroup too ?Reading sections "Modules" in specs I've realized, that any time I want to use any D library I need a full source of that library, not just compiled .o file and header file as in C/C++. Am I right ? Is it right behavior ?That is the default behaviour, but you can usually use the D libraries by providing a static library and the "import modules" These look the same as the regular modules, but without the code (i.e. the { ... } blocks have just been replaced with a simple ; } Linking between systems and versions is about as much as fun as in C++, so you might want to consider "extern(C)", and also no (external) GC... Hopefully things shouldn't be in as much flux in the future, as now.One more question: it seems that I can use printf even if I do not import any modules. Does it means that printf is language feature or does compiler implicitly import some libraries ?printf lives in the std.c.stdio module, it has just been added to the main object module "while debugging the Phobos library". If you can, you should be using std.stdio.writef instead of it ? --anders
Mar 29 2005
Thanks for suggestion, I've just overlooked link to it.I'm newbie in D.You might want to check out the new digitalmars.D.learn newsgroup too ?Linking between systems and versions is about as much as fun as in C++,Yes, but following some (restrictive and complicated) rules one can keep C++ library binary compitable. When this rules becomes too restrictive it's good time to redesign the library, which almost surely will break even source-level compatibility.so you might want to consider "extern(C)", and also no (external) GC...BTW, is GC somehow customizable ? Can I replace default GC by my own one ? And, is GC fully run-time system, or does it uses some compile-time predictions ?Hopefully things shouldn't be in as much flux in the future, as now.Page about ABI in specs says almost nothing. Are there some work to make some standard ABI ? Are that ever possible ? Features such as properties, auto-virtual functions, RAII can make standartization very hard.If you can, you should be using std.stdio.writef instead of it ?All those seems to be type-unsafe. Are there something like C++ cin/cout ?
Mar 30 2005
Vladimir wrote:You can replace the garbage collector by hacking the library sources.so you might want to consider "extern(C)", and also no (external) GC...BTW, is GC somehow customizable ? Can I replace default GC by my own one ?They do check the type of the parameter, since that is available in D...If you can, you should be using std.stdio.writef instead of it ?All those seems to be type-unsafe.Are there something like C++ cin/cout ?Yes, you can use the Reader/Writer classes under the Mango Tree: http://svn.dsource.org/svn/projects/mango/trunk/doc/html/classReader.html http://svn.dsource.org/svn/projects/mango/trunk/doc/html/classWriter.html --anders
Mar 30 2005
So GC is fully in library ? Compiler are not involved ?BTW, is GC somehow customizable ? Can I replace default GC by my own one ?You can replace the garbage collector by hacking the library sources.I meant compile-time type-safe.They do check the type of the parameter, since that is available in D...If you can, you should be using std.stdio.writef instead of it ?All those seems to be type-unsafe.Thanks a lot for suggestion. Again, thanks for your replies.Are there something like C++ cin/cout ?Yes, you can use the Reader/Writer classes under the Mango Tree: http://svn.dsource.org/svn/projects/mango/trunk/doc/html/classReader.html http://svn.dsource.org/svn/projects/mango/trunk/doc/html/classWriter.html
Mar 30 2005
Vladimir wrote:It has been replaced by others, both with other GC and with malloc. If you search around, you can probably find some more details... I am using an open source D compiler (GDC), so it's not an issue.You can replace the garbage collector by hacking the library sources.So GC is fully in library ? Compiler are not involved ?Let's call it semi-safe :-) (You probably won't like that "readf" uses pointers either, then?) --andersThey do check the type of the parameter, since that is available in D...I meant compile-time type-safe.
Mar 30 2005
"Vladimir" <Vladimir_member pathlink.com> wrote in message news:d2e785$1241$1 digitaldaemon.com...What do you mean by compile-time type-safe? Note one can run writef("hello ",10," there ",3.456) if you don't need any formatting control. The D version is just as safe as cout << "hello " << 10 << " there " << 3.456 I do agree that the D version checks types at run-time but that affects performance, not safety. Is there an example you have in mind? -BenSo GC is fully in library ? Compiler are not involved ?BTW, is GC somehow customizable ? Can I replace default GC by my own one ?You can replace the garbage collector by hacking the library sources.I meant compile-time type-safe.They do check the type of the parameter, since that is available in D...If you can, you should be using std.stdio.writef instead of it ?All those seems to be type-unsafe.
Mar 30 2005
In article <d2e8dj$13lg$1 digitaldaemon.com>, Ben Hinkle says...OK, it's good for built-in types. But can I extend it in such way, that expressions like writef("my class: ", my_class_instance) work as expected ? In C++ extensibility is a grate benefit of using cout instead of printf.What do you mean by compile-time type-safe? Note one can run writef("hello ",10," there ",3.456) if you don't need any formatting control. The D version is just as safe as cout << "hello " << 10 << " there " << 3.456 I do agree that the D version checks types at run-time but that affects performance, not safety. Is there an example you have in mind?So GC is fully in library ? Compiler are not involved ?BTW, is GC somehow customizable ? Can I replace default GC by my own one ?You can replace the garbage collector by hacking the library sources.I meant compile-time type-safe.They do check the type of the parameter, since that is available in D...If you can, you should be using std.stdio.writef instead of it ?All those seems to be type-unsafe.
Mar 30 2005
Vladimir wrote:OK, it's good for built-in types. But can I extend it in such way, that expressions like writef("my class: ", my_class_instance) work as expected ? In C++ extensibility is a grate benefit of using cout instead of printf.You can override "char[] toString();", if that is what you mean here ? --anders
Mar 30 2005
OK, it's good for built-in types. But can I extend it in such way, that expressions like writef("my class: ", my_class_instance) work as expected ? In C++ extensibility is a grate benefit of using cout instead of printf.Structs cause problems, I believe. Everything else should work - though I don't particularly like the default toString for objects just giving the class name.
Mar 30 2005
In article <d2egcc$1cfj$1 digitaldaemon.com>, Ben Hinkle says...Yes, you are right. Using toString is a good solution. Thanks.OK, it's good for built-in types. But can I extend it in such way, that expressions like writef("my class: ", my_class_instance) work as expected ? In C++ extensibility is a grate benefit of using cout instead of printf.Structs cause problems, I believe. Everything else should work - though I don't particularly like the default toString for objects just giving the class name.
Mar 30 2005
writef and writefln are type-safe. You are probably thinking of printf, which is not type-safe.If you can, you should be using std.stdio.writef instead of it ?All those seems to be type-unsafe. Are there something like C++ cin/cout ?
Mar 30 2005
Vladimir wrote:"by my own one" - I think it depends how dirty you like to get your hands. ;) Some people have worked using different GC's. For example: http://wxd.sourceforge.net/misc.html More GC-related links are here: http://www.prowiki.org/wiki4d/wiki.cgi?DocComments/Garbage -- jcc7 http://jcc_7.tripod.com/d/Thanks for suggestion, I've just overlooked link to it.I'm newbie in D.You might want to check out the new digitalmars.D.learn newsgroup too ?Linking between systems and versions is about as much as fun as in C++,Yes, but following some (restrictive and complicated) rules one can keep C++ library binary compitable. When this rules becomes too restrictive it's good time to redesign the library, which almost surely will break even source-level compatibility.so you might want to consider "extern(C)", and also no (external) GC...BTW, is GC somehow customizable ? Can I replace default GC by my own one ?
Mar 30 2005