The new, new phobos sneak preview

Andrei Alexandrescu SeeWebsiteForEmail at erdani.org
Mon Apr 6 14:23:20 PDT 2009


Hi everybody,


I just committed all of Phobos into svn on dsource.org. That is not an
official release and has known and unknown bugs, limitations, and
rhinodemons. I expect some ripples before we stabilize, but when we will
we'll stabilize at a higher potential.

For convenience, I've also uploaded pre-built libraries for Windows and
Linux here:

http://www.erdani.dreamhosters.com/d/

The updated documentation is here:

http://www.erdani.dreamhosters.com/d/web/phobos/phobos.html

Finally, the whole shebang with source and all as dumped from my disk is
to be found here:

http://www.erdani.dreamhosters.com/d/src/

If you want to build Phobos yourself, check out the Makefile (not
linux.mak; that won't work). That GNU Makefile, hosted on Linux, can
build the Linux lib and also the Windows lib by using wine. (I'm very
happy about this; now I can test on Windows and Linux without switching
more than a command line tweak.)

Below are highlights of the additions and changes:

*** std.path

* getDrive now works with all string types
* isabs accepts in char[]
* join accepts variadic in char[]
* fnmatch works with in char[]

*** std.regexp

* Scheduled for deprecation. Use std.regex instead.

*** std.regex (new file)

* Regular expression library with wide char support, simplified
interface, better speed etc.

*** std.format

* Added vector parsing and printing with the specifier "%()". For
example, writefln("[%(s; )]", [1, 2, 3][]) writes "[1; 2; 3]". This
support is experimental and may be changed in the future.
* Added a formattedRead function (i.e., scanf that doesn't suck). The
implementation is incomplete but common cases are supported.

*** std.random

* Added RandomCover that covers a given range in a random manner
* Eliminated the old-fashioned random functions
* Defined a default random object that simplifies calls to the random
functions
* Changed generators to obey the range interface. So now you can write:

Random r;
foreach (n; take(100, uniform(0, 100)) { ... }


*** std.file

* read, write, append, rename, remove, getSize, getTimes, getAttributes,
isfile, isdir, chdir, mkdir, mkdirRecurse, rmdir, listdir, copy, take
filename(s) by "in char[]"
* Added function readText that reads and validates a text file
* Added function slurp that reads a file into an array of tuples. Example:

auto a = slurp!(int, double)("filename", "%s, %s");

Each line in the file looks like e.g. "1, 2.3". slurp returns an array
of Tuple!(int, double) with the parsed content.

*** std.mmfile

* Minor cosmetic changes

*** std.conv

* Rewrote conversions with constrained templates.
* Added text() function that transforms everything into text.

*** std.typecons

* Added constructors, assignment operator, length, toString, and slice
to Tuple.

** std.bitmanip

* Bitfields of length 0 are defined to be always 0.
* The read functions for bitfields are const.

*** std.numeric

* Added type CustomFloat that allows defining specialized floating-point
numbers (e.g. 16-bit floats, positive floats etc.)
* Added FPTemporary as the best type to store temporary values.
* Templatized oppositeSigns
* Added Euclidean distance
* Added dotProduct
* Added cosineSimilarity
* Added normalize
* Added string kernel functions gapWeightedSimilarity,
gapWeightedSimilarityNormalized, gapWeightedSimilarityIncremental.

*** std.outbuffer

* Added a few missing overloads of write()

*** std.contracts

* enforce accepts const(char)[] instead of string
* Added enforce overload that invokes a delegate on failure
* Added assumeSorted template
* Added structuralCast that implements, well, structural casting
(incomplete).

*** std.c.stdio

* Added fopen64 and friends

*** std.utf

* toUTF16z accepts in char[]

*** std.algorithm

* Everything converted to ranges. Big disruption. Algorithms added.

*** std.getopt

* Added support for parameterless delegates

*** std.functional

* Improved error messages
* Added configurable parameter names for functions as strings
* Added Adjoin template

*** std.variant

* Added support for Variants that contain vectors and hashes of themselves

*** std.string

* strip, stripl, stripr, startsWith, endsWith now work with any string type

*** std.array

* Range primitives for arrays
* Appender template
* insert, replace functions

*** std.date

* Added a benchmark function that allows for simple timing measurements.

*** std.stdio

* Major breaking changes: introduced the File struct.  Now stdin,
stdout, stderr are instances of the File struct.
* Due to bugs in the compiler, the copy constructor and destructor of
File are commented out. Walter will look into fixing the issues soon.
File should work fine, but you need to close it manually.
* A byRecord iteration mode makes it pretty easy to iterate structured
text files.

*** std.range (new file)

* Range manipulation stuff.


Andrei

P.S. If you have any troubles with the website, I'd appreciate if you
let me know. This is my first experiment with a new provider.



More information about the Digitalmars-d mailing list