Passing dynamic arrays
Bruno Medeiros
brunodomedeiros+spam at com.gmail
Fri Nov 26 14:17:59 PST 2010
On 26/11/2010 19:50, Bruno Medeiros wrote:
> Well, saying _dynamic arrays_ are a hybrid, like you mentioned, is
> perhaps the best way to describe them, with less misunderstanding.
>
> However, if I had to say whether dynamic arrays are value types or
> reference types, I would agree with Jesse and call them reference types,
> and I would not feel this is inaccurate.
ARRGHH, actually this is not entirely true, I forgot about something:
null vs. empty arrays.
Indeed on assignment (and parameter passing) dynamic arrays work just
like reference types. The reallocation operations also don't go against
that either. However, in D's dynamic arrays, null is the same as an
empty array! Which in practice means there is no proper null "value" for
dynamic arrays, like there is for other reference types, and I think
that is kinda of an essential characteristic for a reference type.
So actually I would not call D's dynamic arrays "reference types" and
feel this is really accurate.
--
Bruno Medeiros - Software Engineer
More information about the Digitalmars-d
mailing list