www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - Lack of STL is annoying

reply Joey Peters <Joey_member pathlink.com> writes:
I find the lack of a standard template library quite annoying. Being the weirdo
I am I tried to write one myself multiple times, but failed, making it too
clunky and slow. Is there an estimated time of release or group effort to make a
central STL, as part of the standard package? The biggest problem I had, by the
way, was that D is simply too perfect, and -I- am not. It's hard to code it in
such a way that it's elegant and makes semantic sense at the same time. Coding
an STL is a very fun practise though.

I'm thinking of objects like stacks, vectors, strings, just containers. I tried
to expand it with more functionality like spawn objects (keeps track of object
instances) and extra string functionality (expanded with regexp), it would be
nice if the D STL would be an improvement over the C++ STL.

Maybe somebody already has a nice, simplistic STL? Or, if there's no group
effort yet, maybe somebody wants to help me code a tiny, but powerful STL.

PS: I don't like it that Phobos' namespace eats the names you may use for
filenames like error.d, object.d, etc.

PSS: Any good IDE there yet?
Mar 10 2005
next sibling parent reply "Matthew" <admin.hat stlsoft.dot.org> writes:
I find the lack of a standard template library quite annoying.
I don't doubt it.
 Being the weirdo
 I am I tried to write one myself multiple times, but failed, making it too
 clunky and slow. Is there an estimated time of release or group effort to make
a
 central STL, as part of the standard package?
This year.
 The biggest problem I had, by the
 way, was that D is simply too perfect, and -I- am not. It's hard to code it in
 such a way that it's elegant and makes semantic sense at the same time. Coding
 an STL is a very fun practise though.
Indeed!
 I'm thinking of objects like stacks, vectors, strings, just containers.
They're in the prototypical DTL, and also in minTL.
 I tried
 to expand it with more functionality like spawn objects (keeps track of object
 instances) and extra string functionality (expanded with regexp), it would be
 nice if the D STL would be an improvement over the C++ STL.
It most certainly will be
 Maybe somebody already has a nice, simplistic STL? Or, if there's no group
 effort yet, maybe somebody wants to help me code a tiny, but powerful STL.
Go for it. Good bits can be folded in when we get serious on DTL.
Mar 10 2005
parent reply Joey Peters <Joey_member pathlink.com> writes:
This year.
Good.
Go for it. Good bits can be folded in when we get serious on DTL.
Do you have some sort of a roadmap or design document for the DTL?
Mar 10 2005
parent reply "Matthew" <admin stlsoft.dot.dot.dot.dot.org> writes:
Go for it. Good bits can be folded in when we get serious on DTL.
Do you have some sort of a roadmap or design document for the DTL?
Did have, but have been sidetracked in a big way for some time. Thankfully the process of doing DPD will cause it to receive focus. Essentially, I'd like for it to be similar to STL in purpose: providing useful, consistent and efficient containers & algorithms, and also a framework/paradigm for extension. I expect to get back to it before the month is out, and that minTL, DTL and anyone else's inputs in this area will coallesce before the end of the year. I know Walter's skeptical that it'll be ready for 1.0, but I think it will. (But then Walter and I have somewhat differing views on how far D has to go before it's 1.0-able. <g>)
Mar 10 2005
parent Joey Peters <Joey_member pathlink.com> writes:
In article <d0qisj$7hl$2 digitaldaemon.com>, Matthew says...
Go for it. Good bits can be folded in when we get serious on DTL.
Do you have some sort of a roadmap or design document for the DTL?
Did have, but have been sidetracked in a big way for some time. Thankfully the process of doing DPD will cause it to receive focus. Essentially, I'd like for it to be similar to STL in purpose: providing useful, consistent and efficient containers & algorithms, and also a framework/paradigm for extension. I expect to get back to it before the month is out, and that minTL, DTL and anyone else's inputs in this area will coallesce before the end of the year. I know Walter's skeptical that it'll be ready for 1.0, but I think it will. (But then Walter and I have somewhat differing views on how far D has to go before it's 1.0-able. <g>)
We should certainly work together, setting a STL for D. I think the C++ STL is a pretty good example of what it should look like, however, I also think that in D some things could look so much better. Iterator types for example, or anything you can think of. By the end of the year... This year will still take pretty long. :P
Mar 11 2005
prev sibling next sibling parent reply =?ISO-8859-1?Q?Anders_F_Bj=F6rklund?= <afb algonet.se> writes:
Joey Peters wrote:

 PS: I don't like it that Phobos' namespace eats the names you may use for
 filenames like error.d, object.d, etc.
Do you mean that you want to re-define Error and Object ? (I hope not) Or just that you can't use those filenames without them being included ? (which is somewhat annoying, especially with stray dogs like unittest.d) Ignoring some out-of-place Phobos files like crc32.d & etc/c/zlib/zlib.d which I hope will get cleaned up before the library is released? (D 1.0) --anders
Mar 10 2005
parent Joey Peters <Joey_member pathlink.com> writes:
In article <d0pa16$1t4k$1 digitaldaemon.com>,
=?ISO-8859-1?Q?Anders_F_Bj=F6rklund?= says...
Joey Peters wrote:

 PS: I don't like it that Phobos' namespace eats the names you may use for
 filenames like error.d, object.d, etc.
Do you mean that you want to re-define Error and Object ? (I hope not) Or just that you can't use those filenames without them being included ? (which is somewhat annoying, especially with stray dogs like unittest.d)
Mainly the filename thing. I think names like object.d, error.d, etc are pretty common choises. I also don't really understand why it doesn't work, according to the modules section it should just be poured in it's own namespace?
Mar 10 2005
prev sibling next sibling parent reply "Craig Black" <cblack ara.com> writes:
 Maybe somebody already has a nice, simplistic STL? Or, if there's no group
 effort yet, maybe somebody wants to help me code a tiny, but powerful STL.
Perhaps I could help. I am a C++ programmer that has a lot of experience writing C++ templates. I personally don't like C++ STL, so I wrote my own template library. It's WAY easier to use than C++ STL and more powerful IMO. It currently only lacks a hash table template, but I understand that capability is provided by D natively. I've never programmed in D, but I've kept my eye on the language since it was introduced on the internet. To get a library started, I could port my templates to D. However, I do not like the idea of having to rely on a slow GC. I understand that D supports the old new and delete approach. This would be better for container templates IMO. Anyone interested? -Craig
Mar 10 2005
next sibling parent reply Georg Wrede <georg.wrede nospam.org> writes:
Craig Black wrote:
Maybe somebody already has a nice, simplistic STL? Or, if there's no group
effort yet, maybe somebody wants to help me code a tiny, but powerful STL.
Perhaps I could help. I am a C++ programmer that has a lot of experience writing C++ templates. I personally don't like C++ STL, so I wrote my own template library. It's WAY easier to use than C++ STL and more powerful IMO. It currently only lacks a hash table template, but I understand that capability is provided by D natively. I've never programmed in D, but I've kept my eye on the language since it was introduced on the internet. To get a library started, I could port my templates to D. However, I do not like the idea of having to rely on a slow GC. I understand that D supports the old new and delete approach. This would be better for container templates IMO.
Have you actually tried the "slow GC"?
Mar 10 2005
parent reply "Craig Black" <cblack ara.com> writes:
 Have you actually tried the "slow GC"?
No I haven't. But I know for a fact that in its current state, it is slow. Walter says so himself. It hasn't been optimized yet. And I don't see Walter optimizing GC in the near future. Let me clarify myself. I do not mean to prevent programmers from using GC. I just don't want to use it internally for templates when there are more efficient ways of doing things. -Craig
Mar 10 2005
parent "Unknown W. Brackets" <unknown simplemachines.org> writes:
Personally, I agree.  I mean, I've argued with people about garbage 
collection before, to convince them that in many ways it is a necessary 
evil; this is exactly as I believe.

However, some people take it too far, imho.  Instead of letting the 
garbage collector just help for the areas where it is needed, they let 
it take over everything.  This is good in many ways, and prevents 
mistakes... but I've always felt explicit deallocation is good too.

Explicitly deallocating memory you know you don't need to pass around, 
so long as you don't expect the garbage collector to really optimize the 
freeing of larger groups of data so easily, seems like only a good 
thing.  If phobos does this by default, all the better, no?

-[Unknown]


Have you actually tried the "slow GC"?
No I haven't. But I know for a fact that in its current state, it is slow. Walter says so himself. It hasn't been optimized yet. And I don't see Walter optimizing GC in the near future. Let me clarify myself. I do not mean to prevent programmers from using GC. I just don't want to use it internally for templates when there are more efficient ways of doing things. -Craig
Mar 10 2005
prev sibling next sibling parent reply clayasaurus <clayasaurus gmail.com> writes:
Craig Black wrote:
Maybe somebody already has a nice, simplistic STL? Or, if there's no group
effort yet, maybe somebody wants to help me code a tiny, but powerful STL.
Perhaps I could help. I am a C++ programmer that has a lot of experience writing C++ templates. I personally don't like C++ STL, so I wrote my own template library. It's WAY easier to use than C++ STL and more powerful IMO. It currently only lacks a hash table template, but I understand that capability is provided by D natively. I've never programmed in D, but I've kept my eye on the language since it was introduced on the internet. To get a library started, I could port my templates to D.
maybe you could get a project at dsource.org, post your c++ templates online, then the community can help speed up the c++ --> d process.
 However, I do not like the idea of having to rely on a slow GC.  I 
 understand that D supports the old new and delete approach.  This would be 
 better for container templates IMO.
D doesn't force anyone to use the GC. Adding your own new/delete doesn't hurt either. Just give the users of your library the option of using the GC or not.
 
 Anyone interested?
 
 -Craig 
 
 
Mar 10 2005
parent reply "Craig Black" <cblack ara.com> writes:
 maybe you could get a project at dsource.org, post your c++ templates 
 online, then the community can help speed up the c++ --> d process.
Sure. Just keep in mind that these templates are easy to use but the implementation is involved. How would I go about doing that? -Craig
Mar 10 2005
parent clayasaurus <clayasaurus gmail.com> writes:
Craig Black wrote:
maybe you could get a project at dsource.org, post your c++ templates 
online, then the community can help speed up the c++ --> d process.
Sure. Just keep in mind that these templates are easy to use but the implementation is involved. How would I go about doing that? -Craig
There's a forum on dsource named 'potential projects' where you make a post about your project and what its goals are etc. Note you need to register before you can post. (http://www.dsource.org/forums/viewforum.php?f=13) Then the admin (brad) will set up a svn directory for you to post the project. SVN is very straightfoward IMO, and on windows you can use a good graphical frontend called tourtise svn. So you can check out the default stuff in your directory with a command similar to , 'right click -->checkout' or ... svn co http://svn.dsource.org/svn/projects/myproject which will create 'myproject' folder on your desktop/wherever. you can then add / remove files and folders as you wish, and it will be accessable to anyone with an internet connection. you can make changes and update the folder as need be. with tortoise on windows it shouldn't be harder than 'right click' and 'add folder' on linux, just a command line 'svn add folder/' after you get it installed (apt-get install subversion on debian) http://subversion.tigris.org/ for more about subversion www.dsource.org/ 'getting started' reiterates most of what i'm saying
Mar 10 2005
prev sibling next sibling parent "Matthew" <admin stlsoft.dot.dot.dot.dot.org> writes:
Where can we find your C++ template library?

"Craig Black" <cblack ara.com> wrote in message 
news:d0q4u9$2p9j$1 digitaldaemon.com...
 Maybe somebody already has a nice, simplistic STL? Or, if there's no 
 group
 effort yet, maybe somebody wants to help me code a tiny, but powerful 
 STL.
Perhaps I could help. I am a C++ programmer that has a lot of experience writing C++ templates. I personally don't like C++ STL, so I wrote my own template library. It's WAY easier to use than C++ STL and more powerful IMO. It currently only lacks a hash table template, but I understand that capability is provided by D natively. I've never programmed in D, but I've kept my eye on the language since it was introduced on the internet. To get a library started, I could port my templates to D. However, I do not like the idea of having to rely on a slow GC. I understand that D supports the old new and delete approach. This would be better for container templates IMO. Anyone interested? -Craig
Mar 10 2005
prev sibling next sibling parent reply Joey Peters <Joey_member pathlink.com> writes:
In article <d0q4u9$2p9j$1 digitaldaemon.com>, Craig Black says...
 Maybe somebody already has a nice, simplistic STL? Or, if there's no group
 effort yet, maybe somebody wants to help me code a tiny, but powerful STL.
Perhaps I could help. I am a C++ programmer that has a lot of experience writing C++ templates. I personally don't like C++ STL, so I wrote my own template library. It's WAY easier to use than C++ STL and more powerful IMO. It currently only lacks a hash table template, but I understand that capability is provided by D natively. I've never programmed in D, but I've kept my eye on the language since it was introduced on the internet. To get a library started, I could port my templates to D. However, I do not like the idea of having to rely on a slow GC. I understand that D supports the old new and delete approach. This would be better for container templates IMO. Anyone interested? -Craig
If I am going to try to pull something off I need all the help I can get. However, it's always better to work on something in existance, I don't know how open DTL is. I have to say for myself that I'm not that much of an advanced programmer, but I know my things. The thing with the STL is that I always try to make it too perfect. Perhaps we could just port a STL. I tried to port the C++ STL earlier but that was such a load of work predicting all those preprocessors and figuring out in what order things were, I quit the very same day.
Mar 11 2005
parent "Matthew" <admin stlsoft.dot.dot.dot.dot.org> writes:
"Joey Peters" <Joey_member pathlink.com> wrote in message 
news:d0rp00$1haf$1 digitaldaemon.com...
 In article <d0q4u9$2p9j$1 digitaldaemon.com>, Craig Black says...
 Maybe somebody already has a nice, simplistic STL? Or, if there's no 
 group
 effort yet, maybe somebody wants to help me code a tiny, but 
 powerful STL.
Perhaps I could help. I am a C++ programmer that has a lot of experience writing C++ templates. I personally don't like C++ STL, so I wrote my own template library. It's WAY easier to use than C++ STL and more powerful IMO. It currently only lacks a hash table template, but I understand that capability is provided by D natively. I've never programmed in D, but I've kept my eye on the language since it was introduced on the internet. To get a library started, I could port my templates to D. However, I do not like the idea of having to rely on a slow GC. I understand that D supports the old new and delete approach. This would be better for container templates IMO. Anyone interested? -Craig
If I am going to try to pull something off I need all the help I can get. However, it's always better to work on something in existance, I don't know how open DTL is. I have to say for myself that I'm not that much of an advanced programmer, but I know my things. The thing with the STL is that I always try to make it too perfect. Perhaps we could just port a STL. I tried to port the C++ STL earlier but that was such a load of work predicting all those preprocessors and figuring out in what order things were, I quit the very same day.
I think you need to show your wares, as it's a little difficult to judge where you're at / going to from these posts.
Mar 11 2005
prev sibling parent "Zz" <Zz Zz.com> writes:
 Perhaps I could help.  I am a C++ programmer that has a lot of experience 
 writing C++ templates.  I personally don't like C++ STL, so I wrote my own 
 template library.  It's WAY easier to use than C++ STL and more powerful 
 IMO.  It currently only lacks a hash table template, but I understand that 
 capability is provided by D natively.  I've never programmed in D, but 
 I've kept my eye on the language since it was introduced on the internet. 
 To get a library started, I could port my templates to D.
Is this C++ library available for download? Zz
Mar 14 2005
prev sibling next sibling parent "Ben Hinkle" <bhinkle mathworks.com> writes:
"Joey Peters" <Joey_member pathlink.com> wrote in message 
news:d0p88j$1ru8$1 digitaldaemon.com...
I find the lack of a standard template library quite annoying. Being the 
weirdo
 I am I tried to write one myself multiple times, but failed, making it too
 clunky and slow. Is there an estimated time of release or group effort to 
 make a
 central STL, as part of the standard package? The biggest problem I had, 
 by the
 way, was that D is simply too perfect, and -I- am not. It's hard to code 
 it in
 such a way that it's elegant and makes semantic sense at the same time. 
 Coding
 an STL is a very fun practise though.

 I'm thinking of objects like stacks, vectors, strings, just containers. I 
 tried
 to expand it with more functionality like spawn objects (keeps track of 
 object
 instances) and extra string functionality (expanded with regexp), it would 
 be
 nice if the D STL would be an improvement over the C++ STL.

 Maybe somebody already has a nice, simplistic STL? Or, if there's no group
 effort yet, maybe somebody wants to help me code a tiny, but powerful STL.

 PS: I don't like it that Phobos' namespace eats the names you may use for
 filenames like error.d, object.d, etc.

 PSS: Any good IDE there yet?
Note in-depth design discussions about STL-like libraries for D should probably be on the newsgroup digitalmars.D.dtl It's generally very quiet so getting that puppy as busy as this main newsgroup would be a good thing.
Mar 10 2005
prev sibling parent "Charlie Patterson" <charliep1 excite.com> writes:
"Joey Peters" <Joey_member pathlink.com> wrote in message 
news:d0p88j$1ru8$1 digitaldaemon.com...
 I'm thinking of objects like stacks, vectors, strings, just containers. I 
 tried
 to expand it with more functionality like spawn objects (keeps track of 
 object
 instances) and extra string functionality (expanded with regexp), it would 
 be
 nice if the D STL would be an improvement over the C++ STL.
I'm just a D lurker so far, but it has been pointed out that half of the STL goes away since D has built in associative arrays (maps), and arrays act similar to vectors (and therefore stacks). Array slices also solve the problem of many algorithms. But yeah it would need filling out with libaries (deques and some algorithms).
Mar 10 2005