Why D doesn't have constant function arguments?

Aarti_pl aarti at interia.pl
Tue Apr 3 02:12:49 PDT 2007


Artyom Shalkhakov napisał(a):
> Hello everyone.
> 
> Could anyone answer my question?
> 
> And there's another one: why there are no 'constant references' when passing arguments in D (like those in C++: const Type &), I suppose they would be quite useful for various applications (like, parameter passing for some maths functions).

It is work in progress. There was lot of discussion recently on d.D NG 
about it recently (please read Extended Type Design - first article from 
2007-03-14). D will have constants which hopefully will be much better 
than C++/Java.

> 
> I think that 'inout' could be used in place of C++'s const references, but how does it work? Is this a masked pointer or something?

AFAIK 'inout' is similar to C++ passing by reference.

> 
> Or maybe this is done the other way? The D Way?
> Thanks in advance.

Best Regards
Marcin Kuszczak
(aarti_pl)


More information about the Digitalmars-d-learn mailing list