Const sucks

Derek Parnell derek at nomail.afraid.org
Wed Sep 12 01:35:42 PDT 2007


On Tue, 11 Sep 2007 10:10:33 +0100, Janice Caron wrote:

> On 9/11/07, Derek Parnell <derek at nomail.afraid.org> wrote:
>>
>> In other words, if I have a struct with three members, each of a different
>> type, I need to code ...
>>
>> struct S3(T, U, V)
>> {
>>    T member1;
>>    U member2;
>>    V member3;
>> }
>>
>> S3!(const(int), const(float), const(bool));
>>
>> and so on for 4, 5, 6, .... 23 member structs.
>>
>> I'm sure I'm misunderstanding you, because this is really silly.
>>
> 
> I don't think you're misunderstanding. I think that's what Walter is saying.

But why templates?!?!?

How is that different from ...

 struct S3
 {
    const(int) member1;
    const(float) member2;
    const(bool) member3;
 }

No template involved.

I'm reading Walter as saying that if any struct definition involves any of
its members being const/invariant, then one must define that struct in
terms of templates. Is this what Walter is really saying?

-- 
Derek
(skype: derek.j.parnell)
Melbourne, Australia
12/09/2007 6:31:57 PM



More information about the Digitalmars-d mailing list