Skip to content

Commit

Permalink
Merge pull request #382 from jmdavis/deprecations
Browse files Browse the repository at this point in the history
Deprecated stuff that was scheduled for deprecation in January 2012.  This breaks one of the DMD tests, but I'm merging it anyhow because it's trivial and it's clearly a problem with the test, not the production code.
  • Loading branch information
dsimcha committed Jan 14, 2012
2 parents 1d2962b + 60a0a1c commit e815ad2
Show file tree
Hide file tree
Showing 6 changed files with 136 additions and 112 deletions.
40 changes: 20 additions & 20 deletions std/concurrency.d
Expand Up @@ -23,21 +23,21 @@
* receive(
* (int i) { writeln("Received the number ", i);}
* );
*
*
* // Send a message back to the owner thread
* // indicating success.
* send(tid, true);
* }
*
* void main()
* void main()
* {
* // Start spawnedFunc in a new thread.
* auto tid = spawn(&spawnedFunc, thisTid);
*
* // Send the number 42 to this new thread.
* send(tid, 42);
*
* // Receive the result code.
*
* // Receive the result code.
* auto wasSuccessful = receiveOnly!(bool);
* assert(wasSuccessful);
* writeln("Successfully printed number.");
Expand Down Expand Up @@ -269,7 +269,7 @@ class LinkTerminated : Exception


/**
* Thrown if a message was sent to a thread via
* Thrown if a message was sent to a thread via
* $(XREF concurrency, prioritySend) and the receiver does not have a handler
* for a message of this type.
*/
Expand Down Expand Up @@ -364,7 +364,7 @@ private:
* Returns:
* A Tid representing the new context.
*
* Notes:
* Notes:
* $(D args) must not have unshared aliasing. In other words, all arguments
* to $(D fn) must either be $(D shared) or $(D immutable) or have no
* pointer indirection. This is necessary for enforcing isolation among
Expand All @@ -374,23 +374,23 @@ private:
* ---
* import std.stdio;
*
* void f1(string str)
* void f1(string str)
* {
* writeln(str);
* }
*
* void f2(char[] str)
* void f2(char[] str)
* {
* writeln(str);
* }
*
* void main()
*
* void main()
* {
* auto str = "Hello, world";
*
* // Works: string is immutable.
* auto tid1 = spawn(&f1, str);
*
* auto tid1 = spawn(&f1, str);
*
* // Fails: char[] has mutable aliasing.
* auto tid2 = spawn(&f2, str.dup);
* }
Expand Down Expand Up @@ -470,7 +470,7 @@ void send(T...)( Tid tid, T vals )

/**
* Send a message to $(D tid) but place it at the front of $(D tid)'s message
* queue instead of at the back. This function is typically used for
* queue instead of at the back. This function is typically used for
* out-of-band communication, to signal exceptional conditions, etc.
*/
void prioritySend(T...)( Tid tid, T vals )
Expand Down Expand Up @@ -501,10 +501,10 @@ private void _send(T...)( MsgType type, Tid tid, T vals )


/**
* Receive a message from another thread, or block if no messages of the
* Receive a message from another thread, or block if no messages of the
* specified types are available. This function works by pattern matching
* a message against a set of delegates and executing the first match found.
*
*
* If a delegate that accepts a $(XREF variant, Variant) is included as
* the last argument to $(D receive), it will match any message that was not
* matched by an earlier delegate. If more than one argument is sent,
Expand All @@ -515,7 +515,7 @@ private void _send(T...)( MsgType type, Tid tid, T vals )
* ---
* import std.stdio;
* import std.variant;
*
*
* void spawnedFunction()
* {
* receive(
Expand Down Expand Up @@ -594,8 +594,8 @@ private template receiveOnlyRet(T...)
* assert(msg[0] == 42);
* assert(msg[1] == "42");
* }
*
* void main()
*
* void main()
* {
* auto tid = spawn(&spawnedFunc);
* send(tid, 42, "42");
Expand Down Expand Up @@ -631,10 +631,10 @@ receiveOnlyRet!(T) receiveOnly(T...)()


/**
* $(RED Scheduled for deprecation in January 2012. Please use the version
* $(RED Deprecated. It will be removed in July 2012. Please use the version
* which takes a $(CXREF time, Duration) instead.)
*/
bool receiveTimeout(T...)( long ms, T ops )
deprecated bool receiveTimeout(T...)( long ms, T ops )
{
return receiveTimeout( dur!"msecs"( ms ), ops );
}
Expand Down
4 changes: 2 additions & 2 deletions std/conv.d
Expand Up @@ -361,7 +361,7 @@ unittest
}

/**
$(RED Scheduled for deprecation in January 2012. Please define $(D opCast)
$(RED Deprecated. It will be removed in July 2012. Please define $(D opCast)
for user-defined types instead of a $(D to) function.
$(LREF to) will now use $(D opCast).)
Expand All @@ -387,7 +387,7 @@ unittest
}
----
*/
T toImpl(T, S)(S value)
deprecated T toImpl(T, S)(S value)
if (is(S : Object) && !is(T : Object) && !isSomeString!T &&
hasMember!(S, "to") && is(typeof(S.init.to!T()) : T))
{
Expand Down
35 changes: 20 additions & 15 deletions std/ctype.d
@@ -1,7 +1,7 @@
// Written in the D programming language.

/**
* $(RED Scheduled for deprecation in January 2012. Please use
* $(RED Deprecated. It will be removed in July 2012. Please use
* $(LINK2 std_ascii.html, std.ascii) instead.)
*
* Simple ASCII character classification functions.
Expand All @@ -21,57 +21,62 @@ module std.ctype;

import std.ascii;

pragma(msg, "Notice: As of Phobos 2.058, std.ctype has been " ~
"deprecated. It will be removed in July 2012. " ~
"Please use std.ascii instead.");

deprecated:

/**
* $(RED Scheduled for deprecation in January 2012. Please use
* $(RED Deprecated. It will be removed in July 2012. Please use
* $(D std.ascii.isAlphaNum) instead.)
*
* Returns !=0 if c is a letter in the range (0..9, a..z, A..Z).
*/
pure int isalnum(dchar c) { return (c <= 0x7F) ? _ctype[c] & (_ALP|_DIG) : 0; }

/**
* $(RED Scheduled for deprecation in January 2012. Please use
* $(RED Deprecated. It will be removed in July 2012. Please use
* $(D std.ascii.isAlpha) instead.)
*
* Returns !=0 if c is an ascii upper or lower case letter.
*/
pure int isalpha(dchar c) { return (c <= 0x7F) ? _ctype[c] & (_ALP) : 0; }

/**
* $(RED Scheduled for deprecation in January 2012. Please use
* $(RED Deprecated. It will be removed in July 2012. Please use
* $(D std.ctype.ascii.isControl) instead.)
*
* Returns !=0 if c is a control character.
*/
pure int iscntrl(dchar c) { return (c <= 0x7F) ? _ctype[c] & (_CTL) : 0; }

/**
* $(RED Scheduled for deprecation in January 2012. Please use
* $(RED Deprecated. It will be removed in July 2012. Please use
* $(D std.ascii.isDigit) instead.)
*
* Returns !=0 if c is a digit.
*/
pure int isdigit(dchar c) { return (c <= 0x7F) ? _ctype[c] & (_DIG) : 0; }

/**
* $(RED Scheduled for deprecation in January 2012. Please use
* $(RED Deprecated. It will be removed in July 2012. Please use
* $(D std.ascii.isLower) instead.)
*
* Returns !=0 if c is lower case ascii letter.
*/
pure int islower(dchar c) { return (c <= 0x7F) ? _ctype[c] & (_LC) : 0; }

/**
* $(RED Scheduled for deprecation in January 2012. Please use
* $(RED Deprecated. It will be removed in July 2012. Please use
* $(D std.ascii.isPunctuation) instead.)
*
* Returns !=0 if c is a punctuation character.
*/
pure int ispunct(dchar c) { return (c <= 0x7F) ? _ctype[c] & (_PNC) : 0; }

/**
* $(RED Scheduled for deprecation in January 2012. Please use
* $(RED Deprecated. It will be removed in July 2012. Please use
* $(D std.ascii.isWhite) instead.)
*
* Returns !=0 if c is a space, tab, vertical tab, form feed,
Expand All @@ -80,39 +85,39 @@ pure int ispunct(dchar c) { return (c <= 0x7F) ? _ctype[c] & (_PNC) : 0; }
pure int isspace(dchar c) { return (c <= 0x7F) ? _ctype[c] & (_SPC) : 0; }

/**
* $(RED Scheduled for deprecation in January 2012. Please use
* $(RED Deprecated. It will be removed in July 2012. Please use
* $(D std.ascii.isUpper) instead.)
*
* Returns !=0 if c is an upper case ascii character.
*/
pure int isupper(dchar c) { return (c <= 0x7F) ? _ctype[c] & (_UC) : 0; }

/**
* $(RED Scheduled for deprecation in January 2012. Please use
* $(RED Deprecated. It will be removed in July 2012. Please use
* $(D std.ascii.isHexDigit) instead.)
*
* Returns !=0 if c is a hex digit (0..9, a..f, A..F).
*/
pure int isxdigit(dchar c) { return (c <= 0x7F) ? _ctype[c] & (_HEX) : 0; }

/**
* $(RED Scheduled for deprecation in January 2012. Please use
* $(RED Deprecated. It will be removed in July 2012. Please use
* $(D std.ascii.isGraphical) instead.)
*
* Returns !=0 if c is a printing character except for the space character.
*/
pure int isgraph(dchar c) { return (c <= 0x7F) ? _ctype[c] & (_ALP|_DIG|_PNC) : 0; }

/**
* $(RED Scheduled for deprecation in January 2012. Please use
* $(RED Deprecated. It will be removed in July 2012. Please use
* $(D std.ascii.isPrintable) instead.)
*
* Returns !=0 if c is a printing character including the space character.
*/
pure int isprint(dchar c) { return (c <= 0x7F) ? _ctype[c] & (_ALP|_DIG|_PNC|_BLK) : 0; }

/**
* $(RED Scheduled for deprecation in January 2012. Please use
* $(RED Deprecated. It will be removed in July 2012. Please use
* $(D std.ascii.isASCII) instead.)
*
* Returns !=0 if c is in the ascii character set, i.e. in the range 0..0x7F.
Expand All @@ -121,7 +126,7 @@ pure int isascii(dchar c) { return c <= 0x7F; }


/**
* $(RED Scheduled for deprecation in January 2012. Please use
* $(RED Deprecated. It will be removed in July 2012. Please use
* $(D std.ascii.toLower) instead.)
*
* If c is an upper case ascii character,
Expand All @@ -134,7 +139,7 @@ pure dchar tolower(dchar c)


/**
* $(RED Scheduled for deprecation in January 2012. Please use
* $(RED Deprecated. It will be removed in July 2012. Please use
* $(D std.ascii.toUpper) instead.)
*
* If c is a lower case ascii character,
Expand Down
21 changes: 15 additions & 6 deletions std/datetime.d
Expand Up @@ -7408,10 +7408,13 @@ assert(SysTime(DateTime(2000, 6, 4, 12, 22, 9)).daysInMonth == 30);
}

/++
$(RED Scheduled for deprecation in January 2012.
$(RED Deprecated. It will be removed in July 2012.
Please use daysInMonth instead.)
+/
alias daysInMonth endofMonthDay;
deprecated @property ubyte endOfMonthDay() const nothrow
{
return Date(dayOfGregorianCal).daysInMonth;
}

unittest
{
Expand Down Expand Up @@ -12437,10 +12440,13 @@ assert(Date(2000, 6, 4).daysInMonth == 30);
}

/++
$(RED Scheduled for deprecation in January 2012.
$(RED Deprecated. It will be removed in July 2012.
Please use daysInMonth instead.)
+/
alias daysInMonth endofMonthDay;
deprecated @property ubyte endOfMonthDay() const pure nothrow
{
return maxDay(_year, _month);
}

unittest
{
Expand Down Expand Up @@ -17365,10 +17371,13 @@ assert(DateTime(Date(2000, 6, 4), TimeOfDay(12, 22, 9)).daysInMonth == 30);
}

/++
$(RED Scheduled for deprecation in January 2012.
$(RED Deprecated. It will be removed in July 2012.
Please use daysInMonth instead.)
+/
alias daysInMonth endofMonthDay;
deprecated @property ubyte endOfMonthDay() const pure nothrow
{
return _date.daysInMonth;
}

unittest
{
Expand Down

3 comments on commit e815ad2

@braddr
Copy link
Member

@braddr braddr commented on e815ad2 Jan 14, 2012

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why was this merged? It never passed a single test run of the pull tester. Now it's breaking the master builds. Please fix or revert, asap.

@dsimcha
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I looked in more detail at the pull tester and it was passing the Phobos unittests. It was only failing the DMD tests, because they were using deprecated functionality, not because any bugs were introduced. I merged it because I thought it would be trivial for someone the infrastructure already set up to fix these tests. Since I appear to have ticked some people off, I'll take responsibility and make a pull request to fix the DMD tests myself.

@jmdavis
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I didn't even think of checking dmd's testsuite. Obviously I should have. If I had, I would have fixed them and create a dmd pull request to go with the Phobos pull request. Sorry about that.

Please sign in to comment.