Next in Review Queue: The New std.path
Lars T. Kyllingstad
public at kyllingen.NOSPAMnet
Fri Jul 15 13:16:16 PDT 2011
On Sat, 16 Jul 2011 00:17:03 +0800, KennyTM~ wrote:
> On Jul 16, 11 00:05, Jonathan M Davis wrote:
>> On Friday 15 July 2011 23:48:39 KennyTM~ wrote:
>>> On Jul 15, 11 23:26, Lars T. Kyllingstad wrote:
>>>>>> So here you have had to use Unqual
>>>>>> immutable(Unqual!C1)[] setExtension(C1, C2)(in C1[] path, in C2[]
>>>>>> ext) immutable(Unqual!C1)[] defaultExtension(C1, C2)(in C1[]
>>>>>> path, in C2[] ext)
>>>>>>
>>>>>> Instead of Unqual isn't it nicer to use a Deconst!() template?
>>>>
>>>> Hmm, I guess you're right. "shared" shouldn't be stripped, for
>>>> instance.
>>>
>>> Given that immutable( const(char) ) == immutable(char), I think the
>>> Unqual! should simply be removed.
>>
>> I'd still put the Unqual in there. Perhaps it's due to compiler bugs,
>> but from what I've seen, it can get kind of funny when you try and have
>> an immutable const or a const immutable. Using Unqual makes it very
>> clear what you mean.
>>
>> - Jonathan M Davis
>
> OK. But I think you should file the compiler bug :) From what I see,
> it's that 'immutable' always win.
>
> --------------------------
> alias const(char) CC;
> alias immutable(char) IC;
> alias immutable(CC) ICC;
> alias const(IC) CIC;
> pragma(msg, ICC);
> pragma(msg, CIC);
> --------------------------
> immutable(char)
> immutable(char)
> --------------------------
True, but this doesn't apply to the present case. Since the parameters
are marked with 'in', they become const(immutable(char)[]), not const
(immutable(char))[]. This isn't too hard to fix, but I prefer to use
Unqual, Deconst, Mutable, or whatever it ends up being called.
-Lars
More information about the Digitalmars-d
mailing list