3 Phobos
is the standard runtime library that comes
with the
4 D language compiler
. Also
, check
out the
5 <a href
="http://www.prowiki.org/wiki4d/wiki.cgi?Phobos">wiki
for Phobos
</a
>.
10 Each
module in Phobos conforms as much as possible to the
11 following design goals
. These are goals
12 rather than requirements because D
is not a religion
,
13 it
's a programming language, and it recognizes that
14 sometimes the goals are contradictory and counterproductive
15 in certain situations, and programmers have
16 jobs that need to get done.
21 <dt>Machine and Operating System Independent Interfaces
23 <dd>It's pretty well accepted that gratuitous non
-portability
24 should be avoided
. This should
not be
25 construed
, however
, as meaning that access to unusual
26 features of an operating system should be prevented
.
29 <dt>Simple Operations should be Simple
31 <dd>A common
and simple operation
, like writing an array of
32 bytes to a file
, should be simple to
33 code
. I haven
't seen a class library yet that simply and efficiently
34 implemented common, basic file I/O operations.
37 <dt>Classes should strive to be independent of one another
39 <dd>It's discouraging to pull
in a megabyte of code bloat
40 by just trying to read a file
into an array of
41 bytes
. Class independence also means that classes that turn
42 out to be mistakes can be
deprecated and redesigned without
43 forcing a rewrite of the rest of the
class library
.
46 <dt>No pointless wrappers around C runtime library functions
or OS API functions
48 <dd>D provides direct access to C runtime library functions
49 and operating system API functions
.
50 Pointless D wrappers around those functions just adds blather
,
51 bloat
, baggage
and bugs
.
54 <dt>Class implementations should use DBC
56 <dd>This will prove that
DBC (Contract Programming
) is worthwhile
.
57 Not only will it aid
in debugging the
class, but
58 it will help every
class user use the
class correctly
.
59 DBC
in the
class library will have great leverage
.
62 <dt>Use Exceptions
for Error Handling
64 <dd>See
<a href
="../errors.html">Error Handling
in D
</a
>.
71 Runtime library modules can be imported
with the
72 <b
>import</b
> statement
. Each
module falls
into one of several
76 <dt><a href
="#std">std
</a
>
77 <dd>These are the core modules
.
81 <dt><a href
="#std_windows">std
.windows
</a
>
82 <dd>Modules specific to the Windows operating system
.
85 <dt><a href
="#std_linux">std
.linux
</a
>
86 <dd>Modules specific to the Linux operating system
.
89 <dt><a href
="#std_c">std
.c
</a
>
90 <dd>Modules that are simply interfaces to C functions
.
91 For example
, interfaces to standard C library functions
92 will be
in std
.c
, such as std
.c
.stdio would be the
interface
97 <dt><a href="#std_c_windows">std.c.windows</a>
98 <dd>Modules corresponding to the C Windows API functions.
101 <dt><a href="#std_c_linux">std.c.linux</a>
102 <dd>Modules corresponding to the C Linux API functions.
112 <dd>This is the root of a hierarchy of modules mirroring the std
113 hierarchy. Modules in etc are not standard D modules. They are
114 here because they are experimental, or for some other reason are
115 not quite suitable for std, although they are still useful.
120 <a name="std"><h3>std: Core library modules</h3></a>
124 <dt><a href="std_base64.html"><b>std.base64</b></a>
125 <dd>Encode/decode base64 format.
127 <dt><a href="std_bind.html"><b>std.bind</b></a>
128 <dd>Bind function arguments.
130 <dt><a href="std_bitarray.html"><b>std.bitarray</b></a>
133 <dt><a href="std_boxer.html"><b>std.boxer</b></a>
136 <dt><a href="std_compiler.html"><b>std.compiler</b></a>
137 <dd>Information about the D compiler implementation.
139 <dt><a href="std_conv.html"><b>std.conv</b></a>
140 <dd>Conversion of strings to integers.
142 <dt><a href="std_ctype.html"><b>std.ctype</b></a>
143 <dd>Simple character classification
145 <dt><a href="std_date.html"><b>std.date</b></a>
146 <dd>Date and time functions. Support locales.
148 <dt><a href="std_file.html"><b>std.file</b></a>
149 <dd>Basic file operations like read, write, append.
151 <dt><a href="std_format.html"><b>std.format</b></a>
152 <dd>Formatted conversions of values to strings.
154 <dt><a href="std_gc.html"><b>std.gc</b></a>
155 <dd>Control the garbage collector.
157 <dt><a href="std_intrinsic.html"><b>std.intrinsic</b></a>
158 <dd>Compiler built in intrinsic functions
160 <dt><a href="std_math.html"><b>std.math</b></a>
161 <dd>Include all the usual math functions like sin, cos, atan, etc.
163 <dt><a href="std_md5.html"><b>std.md5</b></a>
164 <dd>Compute MD5 digests.
166 <dt><a href="std_mmfile.html"><b>std.mmfile</b></a>
167 <dd>Memory mapped files.
169 <dt><a href="object.html"><b>object</b></a>
170 <dd>The root class of the inheritance hierarchy
172 <dt><a href="std_openrj.html"><b>std.openrj</b></a>
175 <dt><a href="std_outbuffer.html"><b>std.outbuffer</b></a>
176 <dd>Assemble data into an array of bytes
178 <dt><a href="std_path.html"><b>std.path</b></a>
179 <dd>Manipulate file names, path names, etc.
181 <dt><a href="std_process.html"><b>std.process</b></a>
182 <dd>Create/destroy threads.
184 <dt><a href="std_random.html"><b>std.random</b></a>
185 <dd>Random number generation.
187 <dt><a href="std_recls.html"><b>std.recls</b></a>
188 <dd>Recursively search file system and (currently Windows
191 <dt><a href="std_regexp.html"><b>std.regexp</b></a>
192 <dd>The usual regular expression functions.
194 <dt><a href="std_socket.html"><b>std.socket</b></a>
197 <dt><a href="std_socketstream.html"><b>std.socketstream</b></a>
198 <dd>Stream for a blocking, connected <b>Socket</b>.
200 <dt><a href="std_stdint.html"><b>std.stdint</b></a>
201 <dd>Integral types for various purposes.
203 <dt><a href="std_stdio.html"><b>std.stdio</b></a>
206 <dt><a href="std_cstream.html"><b>std.cstream</b></a>
209 <dt><a href="std_stream.html"><b>std.stream</b></a>
212 <dt><a href="std_string.html"><b>std.string</b></a>
213 <dd>Basic string operations not covered by array ops.
215 <dt><a href="std_system.html"><b>std.system</b></a>
216 <dd>Inquire about the CPU, operating system.
218 <dt><a href="std_thread.html"><b>std.thread</b></a>
219 <dd>One per thread. Operations to do on a thread.
221 <dt><a href="std_uri.html"><b>std.uri</b></a>
222 <dd>Encode and decode Uniform Resource Identifiers (URIs).
224 <dt><a href="std_utf.html"><b>std.utf</b></a>
225 <dd>Encode and decode utf character encodings.
227 <dt><a href="std_zip.html"><b>std.zip</b></a>
228 <dd>Read/write zip archives.
230 <dt><a href="std_zlib.html"><b>std.zlib</b></a>
231 <dd>Compression / Decompression of data.
235 <hr><!-- ===================================== -->
236 <a name="std_windows"><h3>std.windows: Modules specific to the Windows operating system</h3></a>
240 <dt><b>std.windows.syserror</b></a>
241 <dd>Convert Windows error codes to strings.
245 <hr><!-- ===================================== -->
246 <a name="std_linux"><h3>std.linux: Modules specific to the Linux operating system</h3></a>
248 <hr><!-- ===================================== -->
249 <a name="std_c"><h3>std.c: Interface to C functions</h3></a>
253 <dt><a href="#stdio"><b>std.c.stdio</b></a>
254 <dd>Interface to C stdio functions like printf().
258 <hr><!-- ===================================== -->
259 <a name="std_c_windows"><h3>std.c.windows: Interface to C Windows functions</h3></a>
263 <dt><b>std.c.windows.windows</b>
264 <dd>Interface to Windows APIs
268 <hr><!-- ===================================== -->
269 <a name="std_c_linux"><h3>std.c.linux: Interface to C Linux functions</h3></a>
273 <dt><b>std.c.linux.linux</b>
274 <dd>Interface to Linux APIs
278 <hr><!-- ===================================== -->
279 <a name="stdio"><h2>std.c.stdio</h2></a>
282 <dt>int <b>printf</b>(char* format, ...)
283 <dd>C printf() function.
287 TITLE=Phobos Runtime Library