Download Reference Manual
The Developer's Library for D
About Wiki Forums Source Search Contact

Ticket #558 (closed defect: duplicate)

Opened 5 years ago

Last modified 4 years ago

Adding 'utf8' alias as first step in D 2.0 support

Reported by: KirkMcDonald Assigned to: sean
Priority: normal Milestone: 0.99.7
Component: Core Functionality Version: 0.99 RC3 Xammy
Keywords: 2.0 Cc:

Description

Phobos added the 'string' alias (and its friends) to ease the transition to D 2.0. If Tango eventually plans to move to 2.0, it should add something equivalent. If code starts being written now with such aliases, then any eventual transition will be that much smoother.

Discussion in #d.tango favored using the aliases utf8, utf16, and utf32 to represent char[], wchar[], and dchar[]. I recommend adding the following to Tango's object.di:

version (D_Version2) {
    mixin("alias const(char)[] utf8;");
    mixin("alias const(wchar)[] utf16;");
    mixin("alias const(dchar)[] utf32;");
} else {
    alias char[] utf8;
    alias wchar[] utf16;
    alias dchar[] utf32;
}

The mixins are necessary since the contents of the version block must still be parsed in D 1.0, and const() is not valid syntax there.

The rest of the Tango codebase could then be gradually converted to use these aliases where they are appropriate.

Change History

12/06/07 15:36:08 changed by sean

  • status changed from new to assigned.

05/24/08 15:17:26 changed by larsivi

  • status changed from assigned to closed.
  • resolution set to duplicate.
  • milestone changed from 1.0 to 0.99.7.

This is a duplicate of #548