View mode: basic / threaded / horizontal-split · Log in · Help
January 27, 2011
Re: const(Object)ref is here!
On 21/12/2010 18:19, Steven Schveighoffer wrote:
> On Tue, 21 Dec 2010 13:10:12 -0500, Bruno Medeiros
> <brunodomedeiros+spam@com.gmail> wrote:
>
>> On 06/12/2010 19:00, Jonathan M Davis wrote:
>>> On Monday, December 06, 2010 05:41:42 Steven Schveighoffer wrote:
>>>
>>> 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 don't think it's entirely fine. It should at least have
>> "string"/"String" somewhere in the name. (I mentioned this on the
>> other original thread, although late in time)
>
> First, I'll say that it's not as important to me as it seems to be to
> you, and I think others feel the same way. writeTo seems perfectly fine
> to me, and the 'string' part is implied by the char[] parameter for the
> delegate.
>
> Changing the name to contain 'string' is fine as long as:
>
> 1) it's not toString. This is already established as "returning a
> string" in both prior D and other languages. I think this would be too
> confusing.
> 2) it's short. I don't want writeAsStringTo or something similar.
>
> What did you have in mind?
>
> -Steve

Sorry for the long delay in replying..

I don't have any specific favorite name. Could be writeString, asString, 
stringWrite, ouputString, even toString (despite a different signature 
from other languages), etc.
Or a similar name with Text instead of String, as Andrei suggested 
(although I'm not 100% sure about that last one).
It's just that I would prefer the String connotation to be implied in 
the function name, not just implied in the parameter (makes the code 
clearer, in a somewhat subjective opinion). And also to not take up the 
"writeTo" overload in all Objects ever, as some might want to use that 
overload name for their own stuff.

-- 
Bruno Medeiros - Software Engineer
January 27, 2011
Re: const(Object)ref is here!
On 1/27/11 9:33 AM, Bruno Medeiros wrote:
> On 21/12/2010 19:17, Andrei Alexandrescu wrote:
>> On 12/21/10 12:19 PM, Steven Schveighoffer wrote:
>>> On Tue, 21 Dec 2010 13:10:12 -0500, Bruno Medeiros
>>> <brunodomedeiros+spam@com.gmail> wrote:
>>>
>>>> On 06/12/2010 19:00, Jonathan M Davis wrote:
>>>>> On Monday, December 06, 2010 05:41:42 Steven Schveighoffer wrote:
>>>>>> On Mon, 06 Dec 2010 04:44:07 -0500, spir<denis.spir@gmail.com> wrote:
>>>>>>> On Mon, 6 Dec 2010 00:31:41 -0800
>>>>>>>
>>>>>>> Jonathan M Davis<jmdavisProg@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 don't think it's entirely fine. It should at least have
>>>> "string"/"String" somewhere in the name. (I mentioned this on the
>>>> other original thread, although late in time)
>>>
>>> First, I'll say that it's not as important to me as it seems to be to
>>> you, and I think others feel the same way. writeTo seems perfectly fine
>>> to me, and the 'string' part is implied by the char[] parameter for the
>>> delegate.
>>>
>>> Changing the name to contain 'string' is fine as long as:
>>>
>>> 1) it's not toString. This is already established as "returning a
>>> string" in both prior D and other languages. I think this would be too
>>> confusing.
>>> 2) it's short. I don't want writeAsStringTo or something similar.
>>>
>>> What did you have in mind?
>>>
>>> -Steve
>>
>> Conversion to text should be called toText. That makes the essence of
>> the function visible (it emits characters) without tying the
>> representation of the text.
>>
>> Andrei
>
> I don't understand this point. The representation of the text is tied,
> it's going to be char[] ( aka UTF-8). Unless you were planning to have
> overloads of toText, but that sounds like an awful idea.

Could be wchar or dchar.

Andrei
January 28, 2011
Re: const(Object)ref is here!
On 27/01/2011 18:12, Andrei Alexandrescu wrote:
> On 1/27/11 9:33 AM, Bruno Medeiros wrote:
>> On 21/12/2010 19:17, Andrei Alexandrescu wrote:
>>> On 12/21/10 12:19 PM, Steven Schveighoffer wrote:
>>>> On Tue, 21 Dec 2010 13:10:12 -0500, Bruno Medeiros
>>>> <brunodomedeiros+spam@com.gmail> wrote:
>>>>
>>>>> On 06/12/2010 19:00, Jonathan M Davis wrote:
>>>>>> On Monday, December 06, 2010 05:41:42 Steven Schveighoffer wrote:
>>>>>>> On Mon, 06 Dec 2010 04:44:07 -0500, spir<denis.spir@gmail.com>
>>>>>>> wrote:
>>>>>>>> On Mon, 6 Dec 2010 00:31:41 -0800
>>>>>>>>
>>>>>>>> Jonathan M Davis<jmdavisProg@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 don't think it's entirely fine. It should at least have
>>>>> "string"/"String" somewhere in the name. (I mentioned this on the
>>>>> other original thread, although late in time)
>>>>
>>>> First, I'll say that it's not as important to me as it seems to be to
>>>> you, and I think others feel the same way. writeTo seems perfectly fine
>>>> to me, and the 'string' part is implied by the char[] parameter for the
>>>> delegate.
>>>>
>>>> Changing the name to contain 'string' is fine as long as:
>>>>
>>>> 1) it's not toString. This is already established as "returning a
>>>> string" in both prior D and other languages. I think this would be too
>>>> confusing.
>>>> 2) it's short. I don't want writeAsStringTo or something similar.
>>>>
>>>> What did you have in mind?
>>>>
>>>> -Steve
>>>
>>> Conversion to text should be called toText. That makes the essence of
>>> the function visible (it emits characters) without tying the
>>> representation of the text.
>>>
>>> Andrei
>>
>> I don't understand this point. The representation of the text is tied,
>> it's going to be char[] ( aka UTF-8). Unless you were planning to have
>> overloads of toText, but that sounds like an awful idea.
>
> Could be wchar or dchar.
>
> Andrei
>

You mean to say that there would be three possible signatures for toText 
(for char[], wchar[], dchar[]), that the class coder can choose?
But of course, the coder would only need to define one, right? 
(otherwise that would be the awful idea)


-- 
Bruno Medeiros - Software Engineer
January 28, 2011
Re: const(Object)ref is here!
On 1/28/11 5:37 AM, Bruno Medeiros wrote:
> You mean to say that there would be three possible signatures for toText
> (for char[], wchar[], dchar[]), that the class coder can choose?
> But of course, the coder would only need to define one, right?
> (otherwise that would be the awful idea)

Probably standardizing on one width is a good idea.

Andrei
February 01, 2011
Re: const(Object)ref is here!
On 28/01/2011 15:19, Andrei Alexandrescu wrote:
> On 1/28/11 5:37 AM, Bruno Medeiros wrote:
>> You mean to say that there would be three possible signatures for toText
>> (for char[], wchar[], dchar[]), that the class coder can choose?
>> But of course, the coder would only need to define one, right?
>> (otherwise that would be the awful idea)
>
> Probably standardizing on one width is a good idea.
>
> Andrei

Indeed.
-- 
Bruno Medeiros - Software Engineer
Next ›   Last »
3 4 5 6 7
Top | Discussion index | About this forum | D home