Welcome to std2

ATTENTION: Due to the advances in the D2 compiler, and also to increased and more advanced usage of D2 features the standard library, as of DMD 2.011 I find that it is quite difficult to backport D2 code to D1, and it looks like it will not be possible without spending huge amounts of time on it. So I'm afraid std2 is going to stay with the 2.008 version forever. My apologies. On the bright side, it is nice to see Phobos under such active development again, even if it is D2 only.

The std2 project is a collection of ports of Phobos 2.x modules to D1.x.

Why? Phobos in D2.x contains some nifty additions. Most of these have nothing to do with the additional language features of D2.x, and can be ported fairly easily to D1.x, mosly by stripping out the const and invariant everywhere. Unfortunately, the official D maintainers have declared that neither D1.x nor Phobos 1.x will have any new functionality added.

So this project aims to make some of the Phobos 2.x functionality available to D1.x users via a 'std2' package.

Currently the port consists of the following Phobos modules, ported from DMD Phobos 2.008:

Plus a few others that have only had minor changes in D2 (std.process, std.math).

The idea is that you substitute one of those std2 modules in place of an import of the regular std module to get the new functionality.

The ports are currently maintained by Bill Baxter. I don't plan to spend a whole lot of time on this, but it shouldn't require a whole lot of time. At least not for the time being. The above modules took about an hour to port altogether. Volunteers to port new modules and apply updates when new DMD's are released are certainly welcome and encouraged. Any developers who would like SVN commit access, let me know.

Installation

Using DSSS

Std2 can be installed using dsss via its net install feature. All it takes is to type the following command at a command prompt:

dsss net install std2

From SVN

You can also download the source from svn using an svn client. The repository is at http://svn.dsource.org/projects/std2/trunk/std2

For example, using a command line SVN client:

svn co http://svn.dsource.org/projects/std2/trunk/std2

This will create the directory tree with ./std2, ./std2/dsss.conf, and ./std2/std2/*.d.

Quick Example

import std.stdio;
import std2.conv;  // std2.conv includes all of std.conv's functionality, too

void main()
{
    int a = 42;
    auto b = to!(int)(a); // b is int with value 42
    auto c = to!(double)(3.14); // c is double with value 3.14
}

Project Information

Namestd2
CategoryLibraries-System
Status4 - Beta
Home Page
Short Descriptionports of D2 phobos std.* modules to D1
Long Description

Attachments

  • encoding.d (71.6 kB) -std2.encoding, added by y0uf00bar on 08/11/09 23:44:10.
  • xml.d (83.5 kB) -std2.xml, added by y0uf00bar on 08/12/09 00:05:41.