Text in D article
Max Samuha
maxter at i.com.ua
Sat Nov 18 09:10:46 PST 2006
On Sun, 19 Nov 2006 02:43:10 +1100, Daniel Keep
<daniel.keep.lists at gmail.com> wrote:
>
>
>Max Samuha wrote:
>> On Sat, 18 Nov 2006 15:59:33 +0100, Alexander Panek
>> <a.panek at brainsware.org> wrote:
>>
>>> PDF would be great, too.
>>>
>>> Tydr Schnubbis wrote:
>>>> Daniel Keep wrote:
>>>>> Here's a draft of an article which, hopefully, will explain some of the
>>>>> details of how text in D works. Any constructive criticism is welcomed,
>>>>> along with edits or corrections.
>>>>>
>>>> Any chance of an .rtf, .doc, or even .txt? :)
>> For those who is still on Windows :), thiere is a free and compact doc
>> viewer that supports the open office format
>> http://www.officeviewers.com/
>
>Hey, *I'm* still on Windows :P
>
> -- Daniel
Daniel, I didn't intend to offend you, really. Sorry, if I did.
The article is great and useful. I would add a note for those coming
from C# (and Java?) that D strings are mutable and doing the following
is a bad idea:
class BlackBox
{
private char[] _text;
this()
{
_text = "object state";
}
char[] text()
{
return _text; // should be 'return _text.dup' if you
don't want the user of the object to change the internal _text;
}
}
Or something like that.
More information about the Digitalmars-d
mailing list