From efd6ea0cbfa2036fe4a5a11c347264b43751a804 Mon Sep 17 00:00:00 2001 From: jmdavis Date: Wed, 11 Dec 2013 23:44:12 -0800 Subject: [PATCH] Move various deprecations along. --- std/algorithm.d | 17 ++---- std/conv.d | 123 ----------------------------------------- std/exception.d | 13 ----- std/file.d | 4 -- std/format.d | 4 -- std/range.d | 9 --- std/socket.d | 21 +------ std/string.d | 21 +------ std/traits.d | 33 ++++++----- std/uni.d | 34 ------------ std/utf.d | 4 -- std/windows/registry.d | 2 + std/zip.d | 3 +- 13 files changed, 28 insertions(+), 260 deletions(-) diff --git a/std/algorithm.d b/std/algorithm.d index 8408613c2..0df574e71 100644 --- a/std/algorithm.d +++ b/std/algorithm.d @@ -2897,9 +2897,9 @@ unittest 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. -//unfortunatly, an alias will conflict with the existing splitter in std.algorithm. -//It needs to be removed. +//unfortunately, an alias will conflict with the existing splitter in std.algorithm. deprecated("Please use std.array.splitter for string specific splitting") auto splitter(Range)(Range input) if (isSomeString!Range) @@ -5242,14 +5242,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. */ @@ -10747,9 +10739,8 @@ unittest assert(canFind([0, 1, 2, 3], [1, 3], [2, 4]) == 0); } -//Explictly Undocumented. Do not use. It may be deprecated in the future. -//Use any instead. -bool canFind(alias pred, Range)(Range range) +//Explictly Undocumented. It will be removed in December 2014. +deprecated("Please use any instead.") bool canFind(alias pred, Range)(Range range) { return any!pred(range); } diff --git a/std/conv.d b/std/conv.d index a94200731..2eb8d4351 100644 --- a/std/conv.d +++ b/std/conv.d @@ -1285,129 +1285,6 @@ body 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 diff --git a/std/exception.d b/std/exception.d index 297092a1b..69e2aa044 100644 --- a/std/exception.d +++ b/std/exception.d @@ -460,7 +460,6 @@ unittest } enforceEx!E1(s); enforceEx!E2(s); - enforceEx!E3(s, ""); // deprecated } /++ @@ -538,18 +537,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 { assertNotThrown(enforceEx!Exception(true)); diff --git a/std/file.d b/std/file.d index 8cbe5f0e7..0ccc35709 100644 --- a/std/file.d +++ b/std/file.d @@ -73,10 +73,6 @@ version (Windows) LPCWSTR lpNewFileName, DWORD dwFlags); } -else version (Posix) -{ - deprecated alias stat_t struct_stat64; -} // }}} diff --git a/std/format.d b/std/format.d index 6b7feb57f..9c5089f36 100644 --- a/std/format.d +++ b/std/format.d @@ -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; diff --git a/std/range.d b/std/range.d index b497b1f38..f5c16a2ad 100644 --- a/std/range.d +++ b/std/range.d @@ -4205,12 +4205,6 @@ Take!(Repeat!T) repeat(T)(T value, size_t 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 { enforce(equal(repeat(5, 4), [ 5, 5, 5, 5 ][])); @@ -8322,9 +8316,6 @@ sgi.com/tech/stl/binary_search.html, binary_search). } return false; } - - // Explicitly undocumented. It will be removed in November 2013. - deprecated("Please use contains instead.") alias contains canFind; } // Doc examples diff --git a/std/socket.d b/std/socket.d index 7c799a05d..49d9f70a4 100644 --- a/std/socket.d +++ b/std/socket.d @@ -145,16 +145,6 @@ version(unittest) /// Base exception thrown by $(D std.socket). 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) { @@ -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). @@ -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: enum SocketOption: int { @@ -3140,9 +3124,8 @@ public: return result; } - // This overload is explicitly not documented. Please do not use it. It will - // likely be deprecated in the future. It is against Phobos policy to have - // functions which use naked numbers for time values. + // Explicitly undocumented. It will be removed in December 2014. + deprecated("Please use the overload of select which takes a Duration instead.") static int select(SocketSet checkRead, SocketSet checkWrite, SocketSet checkError, long microseconds) { TimeVal tv; diff --git a/std/string.d b/std/string.d index 3da1ec273..98598bbbe 100644 --- a/std/string.d +++ b/std/string.d @@ -2505,15 +2505,7 @@ unittest } -/***************************************************** - * $(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, - */ - +// Explicitly undocumented. It will be removed in July 2014. deprecated("Please use std.string.format instead.") alias format xformat; deprecated unittest @@ -2537,16 +2529,7 @@ deprecated unittest } -/***************************************************** - * $(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, - */ - +// Explicitly undocumented. It will be removed in July 2014. deprecated("Please use std.string.sformat instead.") alias sformat xsformat; deprecated unittest diff --git a/std/traits.d b/std/traits.d index 0d106fc03..8cc1d0354 100644 --- a/std/traits.d +++ b/std/traits.d @@ -2324,30 +2324,30 @@ Pointers to immutable objects are not considered raw aliasing. Example: --- // simple types -static assert(!hasRawLocalAliasing!int); -static assert( hasRawLocalAliasing!(char*)); -static assert(!hasRawLocalAliasing!(shared char*)); +static assert(!hasRawUnsharedAliasing!int); +static assert( hasRawUnsharedAliasing!(char*)); +static assert(!hasRawUnsharedAliasing!(shared char*)); // references aren't raw pointers -static assert(!hasRawLocalAliasing!Object); +static assert(!hasRawUnsharedAliasing!Object); // built-in arrays do contain raw pointers -static assert( hasRawLocalAliasing!(int[])); -static assert(!hasRawLocalAliasing!(shared int[])); +static assert( hasRawUnsharedAliasing!(int[])); +static assert(!hasRawUnsharedAliasing!(shared int[])); // aggregate of simple types struct S1 { int a; double b; } -static assert(!hasRawLocalAliasing!S1); +static assert(!hasRawUnsharedAliasing!S1); // indirect aggregation struct S2 { S1 a; double b; } -static assert(!hasRawLocalAliasing!S2); +static assert(!hasRawUnsharedAliasing!S2); // struct with a pointer member struct S3 { int a; double * b; } -static assert( hasRawLocalAliasing!S3); +static assert( hasRawUnsharedAliasing!S3); struct S4 { int a; shared double * b; } -static assert( hasRawLocalAliasing!S4); +static assert( hasRawUnsharedAliasing!S4); // struct with an indirect pointer member struct S5 { S3 a; double b; } -static assert( hasRawLocalAliasing!S5); +static assert( hasRawUnsharedAliasing!S5); struct S6 { S4 a; double b; } -static assert(!hasRawLocalAliasing!S6); +static assert(!hasRawUnsharedAliasing!S6); ---- */ @@ -2780,11 +2780,10 @@ unittest static assert( hasIndirections!S26); } -// These are for backwards compatibility, are intentionally lacking ddoc, -// and should eventually be deprecated. -alias hasUnsharedAliasing hasLocalAliasing; -alias hasRawUnsharedAliasing hasRawLocalAliasing; -alias hasUnsharedObjects hasLocalObjects; +//Explicitly undocumented. They will be removed in December 2014. +deprecated("Please use hasLocalAliasing instead.") alias hasUnsharedAliasing hasLocalAliasing; +deprecated("Please use hasRawLocalAliasing instead.") alias hasRawUnsharedAliasing hasRawLocalAliasing; +deprecated("Please use hasLocalObjects instead.") alias hasUnsharedObjects hasLocalObjects; /** Returns $(D true) if and only if $(D T)'s representation includes at diff --git a/std/uni.d b/std/uni.d index 6639669a8..c040cb2b6 100644 --- a/std/uni.d +++ b/std/uni.d @@ -6660,12 +6660,6 @@ public bool isWhite(dchar c) 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). +/ @@ -6697,13 +6691,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). +/ @@ -6734,14 +6721,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 is returned. Otherwise $(D c) is returned. @@ -7210,13 +7189,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 is returned. Otherwise $(D c) is returned. @@ -7364,12 +7336,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) diff --git a/std/utf.d b/std/utf.d index 071edecd2..41ad4abf6 100644 --- a/std/utf.d +++ b/std/utf.d @@ -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. diff --git a/std/windows/registry.d b/std/windows/registry.d index cc80074be..ebcd555d2 100644 --- a/std/windows/registry.d +++ b/std/windows/registry.d @@ -1278,12 +1278,14 @@ public: return value; } + //Explicitly undocumented. It will be removed in July 2014. deprecated("Please use value_DWORD instead.") uint value_DWORD_LITTLEENDIAN() { return value_DWORD; } + //Explicitly undocumented. It will be removed in July 2014. deprecated("Please use value_DWORD instead.") uint value_DWORD_BIGENDIAN() { diff --git a/std/zip.d b/std/zip.d index b35454637..58f5a53c1 100644 --- a/std/zip.d +++ b/std/zip.d @@ -84,7 +84,7 @@ class ArchiveMember private ushort _madeVersion = 20; private ushort _extractVersion = 20; private ushort _diskNumber; - // should be private when deprecation done + // Explicitly undocumented. It will be undeprecated and made private in January 2015. deprecated("Please use fileAttributes instead.") uint externalAttributes; private DosFileTime _time; @@ -194,6 +194,7 @@ class ArchiveMember **/ @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.") @property void compressionMethod(ushort cm) {