toHash => pure, nothrow, const, @safe

Steven Schveighoffer schveiguy at yahoo.com
Wed Mar 14 05:13:57 PDT 2012


On Tue, 13 Mar 2012 19:23:25 -0400, Walter Bright  
<newshound2 at digitalmars.com> wrote:

> On 3/13/2012 4:15 AM, Don Clugston wrote:
>> On 13/03/12 03:05, Walter Bright wrote:
>>> On 3/12/2012 6:15 PM, Stewart Gordon wrote:
>>>> And what about toString?
>>>
>>> Good question. What do you suggest?
>>
>> Why can't we just kill that abomination?
>
> Break a lot of existing code?

I'm unaware of much code that uses TypeInfo.xtostring to print anything.   
write[f][ln] doesn't, and I don't think std.conv.to does either.

In other words, killing the "specialness" of toString doesn't mean killing  
toString methods in all structs.  What this does is allow us to not worry  
about what you annotate your toString methods with, it just becomes a  
regular method.

-Steve


More information about the Digitalmars-d mailing list