Expanding Phobos from a flat hierachy

rumbu rumbu at rumbu.ro
Wed Feb 6 03:06:05 PST 2013


On Wednesday, 6 February 2013 at 07:56:26 UTC, Don wrote:
>
> It would be great if people with extensive experience in other 
> languages could give a brief description of the structure of 
> the corresponding libraries. (Also include pseudo-standard 
> libraries, for example boost in C++).
>

I know very well the BCL in C#, but I don't think is possible to 
map existing D modules to the same hierarchy, because D is 
lacking the ideea of namespace. More than that, the way things 
are organized in BCL doesn't match the D phobos rules, only the 
System namespace in BCL contains more than 300 different types 
with thousands of functions. I don't think anybody will like a 
system.d file containing that number of elements.

The class hierarchy in main BCL assembly (mscorlib.dll) is 
organized as follows (important classes - almost everything in C# 
is a class) from D point of view:
- system - basic types, general purpose functions;
- system.collections - object ranges;
- system.collections.generic - generic ranges;
- system.diagnostics - debug helpers;
- system.globalization - locale support;
- system.io - streams, files, readers, writers
- system.reflection - runtime traits;
- system.resources - Windows resource management;
- system.runtime.interopservices - WinAPI;
- system.runtime.serialization - runtime serialization;
- system.security - general purpose security functions;
- system.security.cryptography - encryption algorithms;
- system.text - text encoding/decoding support
- system.threading - threading support
- system.threading.tasks - task based threading, asynchrony

Another important assembly (lib will be the immediate equivalent 
in D) is the system.dll assembly containing following important 
namespaces:
- system - general purpose types;
- system.codedom - compiler tools. somehow equivalent to ctfe in 
D;
- system.collections.concurrent - shared collections and 
algorithms
- system.componentmodel - particular cases of interfaces, events, 
classes
- system.configuration - user settings, reading registry, ini 
files or various forms of persiostent data;
- system.diagnostics - profiling, performance counters, unit 
testing;
- system.compression - well known compression algorithms and 
associated streams;
- system.io.ports - general purpose port interaction functions;
- system.net - various communication protocols
- system.security - various authentication systems
- system.text.regularexpressions - regex;

This is not a comprehensive list, there are more assemblies in 
BCL(eg: system.core.dll assembly contains also some important 
classes like linq extensions or system.xml.dll which contains all 
xml related stuff), and the namespaces above were shortened (eg: 
in BCL C# has system.net.mail for SMTP/IMAP or system.net.mime 
namespace for mime encoding).

Regarding code organization, C# compiler is not dependent of the 
file system, there are no files or packages, you can code any 
number of classes in the same file or you can even code a class 
in multiple files (partial classes).




More information about the Digitalmars-d mailing list