Let Go, Standard Library From Community

Lars Ivar Igesund larsivar at igesund.net
Wed Apr 18 08:35:20 PDT 2007


Dan wrote:

> 
> I just use phobos.  It gets the job done, instead of trying to be
> everything and anything the user might possibly want to interact with;
> like the Java libraries.
> 
> I find the Java libraries are so freakin' huge and multipurpose that they
> couldn't possibly be even close to efficient or practical for any one
> solution.
> 
> Likewise I fear for Tango, as it's got that OO gleam in it's eye and is
> implementing classes for crypto.. I mean.. crypto!?  What's next, a math
> class?  *shudders*

Seriously, classes don't inherently mean in-efficient as you seem to
believe. Tango puts it's pride in being an efficient library, and if it is
provably slower than other solutions, whether they are OO or procedural,
then we would like to know, as it is most likely a bug. Note that the
overhead with classes most often are related to the allocation cost. In
very many cases, when it makes sense to keep the ojbect a live for a
period, keeping state can you help you make many operations more efficient
than if they had to be done repeatedly through a free function, quickly
overcoming the initial allocation cost. This also often leads to easier
overall use. Then you have the cases where the related operations
(especially disk IO) are so expensive in itself, that whether classes are
used or not, won't be noticed in the grand scheme of things. They may
however ease use through encapsulation.

As for the String class; Yes, Tango has one, but do also have free functions
for the same operations, and in most cases we provide versions that do not
induce heap activity.

Additionally we try to design the library to be flexible and easy to use,
and coherent with itself. We even worry about binary sizes.

-- 
Lars Ivar Igesund
blog at http://larsivi.net
DSource, #d.tango & #D: larsivi
Dancing the Tango



More information about the Digitalmars-d mailing list