More D newb questions.

BCS ao at pathlink.com
Thu May 8 11:46:11 PDT 2008


Reply to Me,

> BCS wrote:
> 
>> Reply to Me,
>> 
>>> 3. Can type systems handle the 'natural' extension of
>>> T[] ~ T[] -> T[];
>>> T[] ~ T   -> T[];
>>> T   ~ T[] -> T[];
>>> T   ~ T   -> T[];
>>> Closed. (Yes).
>>> 4. Can D's type system handle this - Open.
>>> 
>> I think that one is closed: yes it can, but as you point out, it
>> wont. Because it causes inconstancies.
>> 
> Surely, if it causes inconsistancies, the D's type system *isn't*
> handling it?
> 

The inconsistency would be from the users perspective and comes from code 
like this:

T[] Foo(T) (T a, T b) {return a ~ b; }

This would work if and only if T is not an array type. 

Foo!(char)('c','b'); //works
Foo!(char[])("c","b"); // fails

The compiler is constant in how it does things but does not constantly produce 
what you would expect.





More information about the Digitalmars-d mailing list