Merge branch 'master' of github.com:D-Programming-Language/phobos into fewer-imports

This commit is contained in:
Andrei Alexandrescu 2013-12-19 15:31:37 -08:00
commit edddfa2455
13 changed files with 28 additions and 260 deletions

View file

@ -2900,9 +2900,9 @@ unittest
assert(equal(splitter!"a=='本'"("日本語"), ["日", "語"])); assert(equal(splitter!"a=='本'"("日本語"), ["日", "語"]));
} }
//Explicitly undocumented. It will be removed in December 2014.
//@@@6730@@@ This exists already in std.array, so this declaration, at best, will only create ambiguity. //@@@6730@@@ This exists already in std.array, so this declaration, at best, will only create ambiguity.
//unfortunatly, an alias will conflict with the existing splitter in std.algorithm. //unfortunately, an alias will conflict with the existing splitter in std.algorithm.
//It needs to be removed.
deprecated("Please use std.array.splitter for string specific splitting") deprecated("Please use std.array.splitter for string specific splitting")
auto splitter(Range)(Range input) auto splitter(Range)(Range input)
if (isSomeString!Range) if (isSomeString!Range)
@ -5213,14 +5213,6 @@ unittest
} }
} }
// Explicitly undocumented. It will be removed in November 2013.
deprecated("Please use std.algorithm.countUntil instead.")
ptrdiff_t indexOf(alias pred = "a == b", R1, R2)(R1 haystack, R2 needle)
if (is(typeof(startsWith!pred(haystack, needle))))
{
return countUntil!pred(haystack, needle);
}
/** /**
Interval option specifier for $(D until) (below) and others. Interval option specifier for $(D until) (below) and others.
*/ */
@ -10666,9 +10658,8 @@ was succesful.
+/ +/
template canFind(alias pred="a == b") template canFind(alias pred="a == b")
{ {
//Explictly Undocumented. Do not use. It may be deprecated in the future. //Explictly Undocumented. It will be removed in December 2014.
//Use any instead. deprecated("Please use any instead.") bool canFind(Range)(Range haystack)
bool canFind(Range)(Range haystack)
if (is(typeof(find!pred(haystack)))) if (is(typeof(find!pred(haystack))))
{ {
return any!pred(haystack); return any!pred(haystack);

View file

@ -1285,129 +1285,6 @@ body
assert(to!string(long.max) == "9223372036854775807"); assert(to!string(long.max) == "9223372036854775807");
} }
// Explicitly undocumented. It will be removed in November 2013.
deprecated("Please use std.format.formattedWrite instead.")
T toImpl(T, S)(S s, in T leftBracket, in T separator = ", ", in T rightBracket = "]")
if (!isSomeChar!(ElementType!S) && (isInputRange!S || isInputRange!(Unqual!S)) &&
isExactSomeString!T)
{
static if (!isInputRange!S)
{
alias toImpl!(T, Unqual!S) ti;
return ti(s, leftBracket, separator, rightBracket);
}
else
{
alias Unqual!(ElementEncodingType!T) Char;
// array-to-string conversion
auto result = appender!(Char[])();
result.put(leftBracket);
bool first = true;
for (; !s.empty; s.popFront())
{
if (!first)
{
result.put(separator);
}
else
{
first = false;
}
result.put(to!T(s.front));
}
result.put(rightBracket);
return cast(T) result.data;
}
}
// Explicitly undocumented. It will be removed in November 2013.
deprecated("Please use std.format.formattedWrite instead.")
T toImpl(T, S)(ref S s, in T leftBracket, in T separator = " ", in T rightBracket = "]")
if ((is(S == void[]) || is(S == const(void)[]) || is(S == immutable(void)[])) &&
isExactSomeString!T)
{
return toImpl(s);
}
// Explicitly undocumented. It will be removed in November 2013.
deprecated("Please use std.format.formattedWrite instead.")
T toImpl(T, S)(S s, in T leftBracket, in T keyval = ":", in T separator = ", ", in T rightBracket = "]")
if (isAssociativeArray!S && !is(S == enum) &&
isExactSomeString!T)
{
alias Unqual!(ElementEncodingType!T) Char;
auto result = appender!(Char[])();
// hash-to-string conversion
result.put(leftBracket);
bool first = true;
foreach (k, v; s)
{
if (!first)
result.put(separator);
else first = false;
result.put(to!T(k));
result.put(keyval);
result.put(to!T(v));
}
result.put(rightBracket);
return cast(T) result.data;
}
// Explicitly undocumented. It will be removed in November 2013.
deprecated("Please use std.format.formattedWrite instead.")
T toImpl(T, S)(S s, in T nullstr)
if (is(S : Object) &&
isExactSomeString!T)
{
if (!s)
return nullstr;
return to!T(s.toString());
}
// Explicitly undocumented. It will be removed in November 2013.
deprecated("Please use std.format.formattedWrite instead.")
T toImpl(T, S)(S s, in T left, in T separator = ", ", in T right = ")")
if (is(S == struct) && !is(typeof(&S.init.toString)) && !isInputRange!S &&
isExactSomeString!T)
{
Tuple!(FieldTypeTuple!S) * t = void;
static if ((*t).sizeof == S.sizeof)
{
// ok, attempt to forge the tuple
t = cast(typeof(t)) &s;
alias Unqual!(ElementEncodingType!T) Char;
auto app = appender!(Char[])();
app.put(left);
foreach (i, e; t.field)
{
if (i > 0)
app.put(to!T(separator));
app.put(to!T(e));
}
app.put(right);
return cast(T) app.data;
}
else
{
// struct with weird alignment
return to!T(S.stringof);
}
}
/*
$(LI A $(D typedef Type Symbol) is converted to string as $(D "Type(value)").)
*/
deprecated T toImpl(T, S)(S s, in T left = to!T(S.stringof~"("), in T right = ")")
if (is(S == typedef) &&
isExactSomeString!T)
{
static if (is(S Original == typedef))
{
// typedef
return left ~ to!T(cast(Original) s) ~ right;
}
}
/** /**
Narrowing numeric-numeric conversions throw when the value does not Narrowing numeric-numeric conversions throw when the value does not

View file

@ -463,7 +463,6 @@ unittest
} }
enforceEx!E1(s); enforceEx!E1(s);
enforceEx!E2(s); enforceEx!E2(s);
enforceEx!E3(s, ""); // deprecated
} }
/++ /++
@ -541,18 +540,6 @@ template enforceEx(E)
} }
} }
// Explicitly undocumented. It will be removed in November 2013.
deprecated("Please use the version of enforceEx which takes an exception that constructs with new E(msg, file, line).")
template enforceEx(E)
if (is(typeof(new E(""))) && !is(typeof(new E("", __FILE__, __LINE__))) && !is(typeof(new E(__FILE__, __LINE__))))
{
T enforceEx(T)(T value, lazy string msg = "")
{
if (!value) throw new E(msg);
return value;
}
}
unittest unittest
{ {
assertNotThrown(enforceEx!Exception(true)); assertNotThrown(enforceEx!Exception(true));

View file

@ -73,10 +73,6 @@ version (Windows)
LPCWSTR lpNewFileName, LPCWSTR lpNewFileName,
DWORD dwFlags); DWORD dwFlags);
} }
else version (Posix)
{
deprecated alias stat_t struct_stat64;
}
// }}} // }}}

View file

@ -71,10 +71,6 @@ class FormatException : Exception
} }
} }
// Explicitly undocumented. It will be removed in November 2013.
deprecated("Please use FormatException instead.")
alias FormatException FormatError;
private alias enforceFmt = enforceEx!FormatException; private alias enforceFmt = enforceEx!FormatException;

View file

@ -4216,12 +4216,6 @@ Take!(Repeat!T) repeat(T)(T value, size_t n)
return take(repeat(value), n); return take(repeat(value), n);
} }
// Explicitly undocumented. It will be removed in November 2013.
deprecated("Please use std.range.repeat instead.") Take!(Repeat!T) replicate(T)(T value, size_t n)
{
return repeat(value, n);
}
unittest unittest
{ {
enforce(equal(repeat(5, 4), [ 5, 5, 5, 5 ][])); enforce(equal(repeat(5, 4), [ 5, 5, 5, 5 ][]));
@ -8589,9 +8583,6 @@ sgi.com/tech/stl/binary_search.html, binary_search).
} }
return false; return false;
} }
// Explicitly undocumented. It will be removed in November 2013.
deprecated("Please use contains instead.") alias contains canFind;
} }
// Doc examples // Doc examples

View file

@ -145,16 +145,6 @@ version(unittest)
/// Base exception thrown by $(D std.socket). /// Base exception thrown by $(D std.socket).
class SocketException: Exception class SocketException: Exception
{ {
// Explicitly undocumented. It will be removed in November 2013.
deprecated("Please use std.socket.SocketOSException instead.") @property int errorCode() const
{
auto osException = cast(SocketOSException)this;
if (osException)
return osException.errorCode;
else
return 0;
}
/// ///
this(string msg, string file = __FILE__, size_t line = __LINE__, Throwable next = null) this(string msg, string file = __FILE__, size_t line = __LINE__, Throwable next = null)
{ {
@ -2029,9 +2019,6 @@ struct TimeVal
} }
} }
// Explicitly undocumented. It will be removed in November 2013.
deprecated("Please use std.socket.TimeVal instead.") alias TimeVal timeval;
/** /**
* A collection of sockets for use with $(D Socket.select). * A collection of sockets for use with $(D Socket.select).
@ -2257,9 +2244,6 @@ struct Linger
} }
} }
// Explicitly undocumented. It will be removed in November 2013.
deprecated("Please use std.socket.Linger instead.") alias Linger linger;
/// Specifies a socket option: /// Specifies a socket option:
enum SocketOption: int enum SocketOption: int
{ {
@ -3140,9 +3124,8 @@ public:
return result; return result;
} }
// This overload is explicitly not documented. Please do not use it. It will // Explicitly undocumented. It will be removed in December 2014.
// likely be deprecated in the future. It is against Phobos policy to have deprecated("Please use the overload of select which takes a Duration instead.")
// functions which use naked numbers for time values.
static int select(SocketSet checkRead, SocketSet checkWrite, SocketSet checkError, long microseconds) static int select(SocketSet checkRead, SocketSet checkWrite, SocketSet checkError, long microseconds)
{ {
TimeVal tv; TimeVal tv;

View file

@ -2505,15 +2505,7 @@ unittest
} }
/***************************************************** // Explicitly undocumented. It will be removed in July 2014.
* $(RED Deprecated. It will be removed in November 2013.
* Please use std.string.format instead.)
*
* Format arguments into a string.
*
* $(LREF format) was changed to use this implementation in November 2012,
*/
deprecated("Please use std.string.format instead.") alias format xformat; deprecated("Please use std.string.format instead.") alias format xformat;
deprecated unittest deprecated unittest
@ -2537,16 +2529,7 @@ deprecated unittest
} }
/***************************************************** // Explicitly undocumented. It will be removed in July 2014.
* $(RED Deprecated. It will be removed in November 2013.
* Please use std.string.sformat instead.)
*
* Format arguments into string $(D buf) which must be large
* enough to hold the result. Throws RangeError if it is not.
*
* $(LREF sformat) was changed to use this implementation in November 2012,
*/
deprecated("Please use std.string.sformat instead.") alias sformat xsformat; deprecated("Please use std.string.sformat instead.") alias sformat xsformat;
deprecated unittest deprecated unittest

View file

@ -2324,30 +2324,30 @@ Pointers to immutable objects are not considered raw aliasing.
Example: Example:
--- ---
// simple types // simple types
static assert(!hasRawLocalAliasing!int); static assert(!hasRawUnsharedAliasing!int);
static assert( hasRawLocalAliasing!(char*)); static assert( hasRawUnsharedAliasing!(char*));
static assert(!hasRawLocalAliasing!(shared char*)); static assert(!hasRawUnsharedAliasing!(shared char*));
// references aren't raw pointers // references aren't raw pointers
static assert(!hasRawLocalAliasing!Object); static assert(!hasRawUnsharedAliasing!Object);
// built-in arrays do contain raw pointers // built-in arrays do contain raw pointers
static assert( hasRawLocalAliasing!(int[])); static assert( hasRawUnsharedAliasing!(int[]));
static assert(!hasRawLocalAliasing!(shared int[])); static assert(!hasRawUnsharedAliasing!(shared int[]));
// aggregate of simple types // aggregate of simple types
struct S1 { int a; double b; } struct S1 { int a; double b; }
static assert(!hasRawLocalAliasing!S1); static assert(!hasRawUnsharedAliasing!S1);
// indirect aggregation // indirect aggregation
struct S2 { S1 a; double b; } struct S2 { S1 a; double b; }
static assert(!hasRawLocalAliasing!S2); static assert(!hasRawUnsharedAliasing!S2);
// struct with a pointer member // struct with a pointer member
struct S3 { int a; double * b; } struct S3 { int a; double * b; }
static assert( hasRawLocalAliasing!S3); static assert( hasRawUnsharedAliasing!S3);
struct S4 { int a; shared double * b; } struct S4 { int a; shared double * b; }
static assert( hasRawLocalAliasing!S4); static assert( hasRawUnsharedAliasing!S4);
// struct with an indirect pointer member // struct with an indirect pointer member
struct S5 { S3 a; double b; } struct S5 { S3 a; double b; }
static assert( hasRawLocalAliasing!S5); static assert( hasRawUnsharedAliasing!S5);
struct S6 { S4 a; double b; } struct S6 { S4 a; double b; }
static assert(!hasRawLocalAliasing!S6); static assert(!hasRawUnsharedAliasing!S6);
---- ----
*/ */
@ -2780,11 +2780,10 @@ unittest
static assert( hasIndirections!S26); static assert( hasIndirections!S26);
} }
// These are for backwards compatibility, are intentionally lacking ddoc, //Explicitly undocumented. They will be removed in December 2014.
// and should eventually be deprecated. deprecated("Please use hasLocalAliasing instead.") alias hasUnsharedAliasing hasLocalAliasing;
alias hasUnsharedAliasing hasLocalAliasing; deprecated("Please use hasRawLocalAliasing instead.") alias hasRawUnsharedAliasing hasRawLocalAliasing;
alias hasRawUnsharedAliasing hasRawLocalAliasing; deprecated("Please use hasLocalObjects instead.") alias hasUnsharedObjects hasLocalObjects;
alias hasUnsharedObjects hasLocalObjects;
/** /**
Returns $(D true) if and only if $(D T)'s representation includes at Returns $(D true) if and only if $(D T)'s representation includes at

View file

@ -6678,12 +6678,6 @@ public bool isWhite(dchar c)
return isWhiteGen(c); // call pregenerated binary search return isWhiteGen(c); // call pregenerated binary search
} }
deprecated ("Please use std.uni.isLower instead")
bool isUniLower(dchar c) @safe pure nothrow
{
return isLower(c);
}
/++ /++
Return whether $(D c) is a Unicode lowercase $(CHARACTER). Return whether $(D c) is a Unicode lowercase $(CHARACTER).
+/ +/
@ -6715,13 +6709,6 @@ bool isLower(dchar c)
} }
deprecated ("Please use std.uni.isUpper instead")
@safe pure nothrow
bool isUniUpper(dchar c)
{
return isUpper(c);
}
/++ /++
Return whether $(D c) is a Unicode uppercase $(CHARACTER). Return whether $(D c) is a Unicode uppercase $(CHARACTER).
+/ +/
@ -6752,14 +6739,6 @@ bool isUpper(dchar c)
} }
deprecated ("Please use std.uni.toLower instead")
@safe pure nothrow
dchar toUniLower(dchar c)
{
return toLower(c);
}
/++ /++
If $(D c) is a Unicode uppercase $(CHARACTER), then its lowercase equivalent If $(D c) is a Unicode uppercase $(CHARACTER), then its lowercase equivalent
is returned. Otherwise $(D c) is returned. is returned. Otherwise $(D c) is returned.
@ -7228,13 +7207,6 @@ unittest
} }
deprecated("Please use std.uni.toUpper instead")
@safe pure nothrow
dchar toUniUpper(dchar c)
{
return toUpper(c);
}
/++ /++
If $(D c) is a Unicode lowercase $(CHARACTER), then its uppercase equivalent If $(D c) is a Unicode lowercase $(CHARACTER), then its uppercase equivalent
is returned. Otherwise $(D c) is returned. is returned. Otherwise $(D c) is returned.
@ -7382,12 +7354,6 @@ unittest
} }
} }
deprecated("Please use std.uni.isAlpha instead.")
@safe pure nothrow
bool isUniAlpha(dchar c)
{
return isAlpha(c);
}
/++ /++
Returns whether $(D c) is a Unicode alphabetic $(CHARACTER) Returns whether $(D c) is a Unicode alphabetic $(CHARACTER)

View file

@ -94,10 +94,6 @@ class UTFException : Exception
} }
// Explicitly undocumented. It will be removed in November 2013.
deprecated("Please use std.utf.UTFException instead.") alias UtfException = UTFException;
/++ /++
Returns whether $(D c) is a valid UTF-32 character. Returns whether $(D c) is a valid UTF-32 character.

View file

@ -1278,12 +1278,14 @@ public:
return value; return value;
} }
//Explicitly undocumented. It will be removed in July 2014.
deprecated("Please use value_DWORD instead.") deprecated("Please use value_DWORD instead.")
uint value_DWORD_LITTLEENDIAN() uint value_DWORD_LITTLEENDIAN()
{ {
return value_DWORD; return value_DWORD;
} }
//Explicitly undocumented. It will be removed in July 2014.
deprecated("Please use value_DWORD instead.") deprecated("Please use value_DWORD instead.")
uint value_DWORD_BIGENDIAN() uint value_DWORD_BIGENDIAN()
{ {

View file

@ -94,7 +94,7 @@ final class ArchiveMember
@property ushort extractVersion() { return _extractVersion; } /// Read Only @property ushort extractVersion() { return _extractVersion; } /// Read Only
@property uint crc32() { return _crc32; } /// Read Only: cyclic redundancy check (CRC) value @property uint crc32() { return _crc32; } /// Read Only: cyclic redundancy check (CRC) value
/// OS specific file attributes // Explicitly undocumented. It will be removed in January 2015.
deprecated("Please use fileAttributes instead.") deprecated("Please use fileAttributes instead.")
@property ref inout(uint) externalAttributes() inout @safe pure nothrow @property ref inout(uint) externalAttributes() inout @safe pure nothrow
{ return _externalAttributes; } { return _externalAttributes; }
@ -206,6 +206,7 @@ final class ArchiveMember
**/ **/
@property CompressionMethod compressionMethod() { return _compressionMethod; } @property CompressionMethod compressionMethod() { return _compressionMethod; }
// Explicitly undocumented. It will be removed in January 2015.
deprecated("Please use the enum CompressionMethod to set this property instead.") deprecated("Please use the enum CompressionMethod to set this property instead.")
@property void compressionMethod(ushort cm) @property void compressionMethod(ushort cm)
{ {