Newbie initial comments on D language - scope
Edward Diener
eddielee_no_spam_here at tropicsoft.com
Sun Feb 3 05:34:25 PST 2008
Janice Caron wrote:
> On 2/3/08, Edward Diener <eddielee_no_spam_here at tropicsoft.com> wrote:
>> There is no equivalent of 'const' in
>> C++ which refers to the type.
>
> Of course there is. For example:
>
> typedef char const * PCSZ;
I think a simpler example for you to cite would have been:
typedef char const PCSZ;
But again that does not change the type of 'char'. It simply creates a
type alias.
In arguing for 'scope' at the type level, as in 'scope class C { ... }'
I was arguing that 'scope' applies some attribute to the type of C. The
class designer is making a conscious decision in designing his type in
order to tell the compiler that all objects of his type need
deterministic destruction in a system which normally implements
non-deterministic destruction via GC. That says something about the type
per se.
In specifying 'const char ch' the end user is making a conscious
decision in telling the compiler that a specific object must not change
after it has been initialized to some value. It has nothing to do with
the type of the object per se.
More information about the Digitalmars-d
mailing list