www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - STL in std

reply Paul Anderson <paul.d.anderson.removethis comcast.andthis.net> writes:
While I appreciate the addition of the Standard Template Library to phobos in
2.008, I have misgivings about the package name(s). Rather than naming them
std.algorithm, std.functional, etc., how about stl.algorithm, stl.functional,
etc., i.e., STL rather than STD. Or, if the similarity is too confusing,
std.stl.algorithm, std.stl.functional,...

I know there is an ongoing flat (phobos) vs. hierarchical (Tango) debate, but
this seems to me to be a clear case for using a distinct package (or
subpackage) name: a group of interrelated modules that are (more or less)
independent of other packages.

The alternative seems to be an ever-lengthening list of
std.betterbeverydescriptive packages.

I hope since this is a very recent addition it won't cause a lot of work to
rename them in the next release. 

Anyone else feel the same way?

Paul
Dec 14 2007
next sibling parent reply Bill Baxter <dnewsgroup billbaxter.com> writes:
Paul Anderson wrote:
 While I appreciate the addition of the Standard Template Library to phobos in
2.008, I have misgivings about the package name(s). Rather than naming them
std.algorithm, std.functional, etc., how about stl.algorithm, stl.functional,
etc., i.e., STL rather than STD. Or, if the similarity is too confusing,
std.stl.algorithm, std.stl.functional,...
 
 I know there is an ongoing flat (phobos) vs. hierarchical (Tango) debate, but
this seems to me to be a clear case for using a distinct package (or
subpackage) name: a group of interrelated modules that are (more or less)
independent of other packages.
 
 The alternative seems to be an ever-lengthening list of
std.betterbeverydescriptive packages.
 
 I hope since this is a very recent addition it won't cause a lot of work to
rename them in the next release. 
 
 Anyone else feel the same way?
 
 Paul

What's the distinction between std.* and stl.* then? Anything in std.* can't have templates in it? That seems like an artificial distinction to me. The current way seems fine to me. --bb
Dec 14 2007
parent reply Paul Anderson <paul.d.anderson.removethis comcast.andthis.net> writes:
Bill Baxter Wrote:

 Paul Anderson wrote:
 While I appreciate the addition of the Standard Template Library to phobos in
2.008, I have misgivings about the package name(s). Rather than naming them
std.algorithm, std.functional, etc., how about stl.algorithm, stl.functional,
etc., i.e., STL rather than STD. Or, if the similarity is too confusing,
std.stl.algorithm, std.stl.functional,...
 
 I know there is an ongoing flat (phobos) vs. hierarchical (Tango) debate, but
this seems to me to be a clear case for using a distinct package (or
subpackage) name: a group of interrelated modules that are (more or less)
independent of other packages.
 
 The alternative seems to be an ever-lengthening list of
std.betterbeverydescriptive packages.
 
 I hope since this is a very recent addition it won't cause a lot of work to
rename them in the next release. 
 
 Anyone else feel the same way?
 
 Paul

What's the distinction between std.* and stl.* then? Anything in std.* can't have templates in it? That seems like an artificial distinction to me. The current way seems fine to me. --bb

I'm not suggesting that the existence of templates is the distinction. I'm suggesting that a reasonably stand-alone set of modules should not be mixed in higgledy-piggledy with all the rest. From the Introduction to the Standard Template Library <http://www.sgi.com/tech/stl/stl_introduction.html>: "The Standard Template Library, or STL, is a C++ library of container classes, algorithms, and iterators; it provides many of the basic algorithms and data structures of computer science." I'm suggesting this library of classes, algorithms and iterators deserves it's own distinct package. Particularly since it is derived from an existing, well-known library. Paul
Dec 14 2007
parent Bill Baxter <dnewsgroup billbaxter.com> writes:
Paul Anderson wrote:
 Bill Baxter Wrote:
 
 Paul Anderson wrote:
 While I appreciate the addition of the Standard Template Library to phobos in
2.008, I have misgivings about the package name(s). Rather than naming them
std.algorithm, std.functional, etc., how about stl.algorithm, stl.functional,
etc., i.e., STL rather than STD. Or, if the similarity is too confusing,
std.stl.algorithm, std.stl.functional,...

 I know there is an ongoing flat (phobos) vs. hierarchical (Tango) debate, but
this seems to me to be a clear case for using a distinct package (or
subpackage) name: a group of interrelated modules that are (more or less)
independent of other packages.

 The alternative seems to be an ever-lengthening list of
std.betterbeverydescriptive packages.

 I hope since this is a very recent addition it won't cause a lot of work to
rename them in the next release. 

 Anyone else feel the same way?

 Paul

can't have templates in it? That seems like an artificial distinction to me. The current way seems fine to me. --bb

I'm not suggesting that the existence of templates is the distinction. I'm suggesting that a reasonably stand-alone set of modules should not be mixed in higgledy-piggledy with all the rest. From the Introduction to the Standard Template Library <http://www.sgi.com/tech/stl/stl_introduction.html>: "The Standard Template Library, or STL, is a C++ library of container classes, algorithms, and iterators; it provides many of the basic algorithms and data structures of computer science." I'm suggesting this library of classes, algorithms and iterators deserves it's own distinct package. Particularly since it is derived from an existing, well-known library.

I could be wrong, but I believe the new modules in std are only loosely inspired by C++'s STL. Clearly Andrei is familiar with C++ STL, as any good C++ programmer should be, but I think it is serving only as a rough guide. And even if he were trying to port it verbatim, the differences between D and C++ are great enough (especially in the area of templates) that the result wouldn't really end up all that much like the original STL anyway. Finally, all of C++ STL lives in the std namespace, (along with some stuff like iostreams and wrappers of C headers that are not actually a part of STL), so if the new D stuff is intended to be a port, then doesn't it make the most sense for it to go into the std namespace in D too, along with the rest of the std library? --bb
Dec 14 2007
prev sibling next sibling parent Derek Parnell <derek psych.ward> writes:
On Fri, 14 Dec 2007 16:57:40 -0500, Paul Anderson wrote:

 While I appreciate the addition of the Standard Template Library to phobos in
2.008, I have misgivings about the package name(s). Rather than naming them
std.algorithm, std.functional, etc., how about stl.algorithm, stl.functional,
etc., i.e., STL rather than STD. Or, if the similarity is too confusing,
std.stl.algorithm, std.stl.functional,...
 
 I know there is an ongoing flat (phobos) vs. hierarchical (Tango) debate, but
this seems to me to be a clear case for using a distinct package (or
subpackage) name: a group of interrelated modules that are (more or less)
independent of other packages.
 
 The alternative seems to be an ever-lengthening list of
std.betterbeverydescriptive packages.
 
 I hope since this is a very recent addition it won't cause a lot of work to
rename them in the next release. 
 
 Anyone else feel the same way?

I don't think its such a good idea. It implies that templates are a special case. As most of phobos was written before we had templates, most of its contents are not in template form, but I can see that over time these will be templated. Do when then move them from std. to stl. ? I don't think so. -- Derek Parnell Melbourne, Australia skype: derek.j.parnell
Dec 14 2007
prev sibling parent S <S s.com> writes:
Templates generate new binary objects.  The way the D compiler currently
handles them is very screwy.

For example:

if foo.d makes use of a template in bar.d for the type of "string" then:

dmd foo.d bar.d 

will generate foo.o and bar.o.  Said instance of the template in bar exists in
bar.o.   If, however, foo.d is compiled separate from bar.d it will compile
fine, but no template code will be generated.

In order for phobos to have templates you would have to include the d files
from phobos that have templates in them on the command-line and then link them
together.

The other option to fix this is to have DMD implicitly, or by option, put the
generated object code for the template in the object file corresponding to the
D file that used it.

This second option causes name conflicts when linking two sources that used the
same template.....  The linker can be told to ignore duplicates though.  I
think this is the best option.

-SC


Paul Anderson Wrote:

 While I appreciate the addition of the Standard Template Library to phobos in
2.008, I have misgivings about the package name(s). Rather than naming them
std.algorithm, std.functional, etc., how about stl.algorithm, stl.functional,
etc., i.e., STL rather than STD. Or, if the similarity is too confusing,
std.stl.algorithm, std.stl.functional,...
 
 I know there is an ongoing flat (phobos) vs. hierarchical (Tango) debate, but
this seems to me to be a clear case for using a distinct package (or
subpackage) name: a group of interrelated modules that are (more or less)
independent of other packages.
 
 The alternative seems to be an ever-lengthening list of
std.betterbeverydescriptive packages.
 
 I hope since this is a very recent addition it won't cause a lot of work to
rename them in the next release. 
 
 Anyone else feel the same way?
 
 Paul

Dec 14 2007