const(Object)ref is here!

Steven Schveighoffer schveiguy at yahoo.com
Mon Dec 6 11:34:36 PST 2010


On Mon, 06 Dec 2010 14:00:17 -0500, Jonathan M Davis <jmdavisProg at gmx.com>  
wrote:

> On Monday, December 06, 2010 05:41:42 Steven Schveighoffer wrote:
>> On Mon, 06 Dec 2010 04:44:07 -0500, spir <denis.spir at gmail.com> wrote:
>> > On Mon, 6 Dec 2010 00:31:41 -0800
>> >
>> > Jonathan M Davis <jmdavisProg at gmx.com> wrote:
>> >> toString() (or writeFrom() or whatever
>> >> it's going to become)
>> >
>> > guess it was writeTo() ;-) but "writeFrom" is nice as well, we should
>> > find some useful use for it
>>
>> It was proposed as writeTo, but I'm not opposed to a different name.
>
> I have no problem with writeTo(). I just couldn't remember what it was  
> and
> didn't want to take the time to look it up, and the name isn't as  
> obvious as
> toString(), since it's not a standard name which exists in other  
> languages, and
> it isn't actually returning anything. Whether it's to or from would  
> depend on
> how you look at it - to the given delegate or from the object. But  
> writeTo() is
> fine. Once it's used, it'll be remembered.

I think writeTo sounds good because it will be called like this:

object.writeTo(sink);

BTW, writeTo was spir's idea:  
http://www.digitalmars.com/webnews/newsgroups.php?art_group=digitalmars.D&article_id=122335

But again, the name isn't critical to me (well, it is important but  
writeTo is not the be-all end-all of good names :).

>
>> BTW, the proposal does properly mark writeTo as const.
>
> Good. It figures that you'd remember given your general take on const.

:)

-Steve


More information about the Digitalmars-d mailing list