primitive vector types

Andrei Alexandrescu SeeWebsiteForEmail at erdani.org
Sat Feb 21 14:47:00 PST 2009


Bill Baxter wrote:
> On Sun, Feb 22, 2009 at 5:11 AM, Andrei Alexandrescu
> <SeeWebsiteForEmail at erdani.org> wrote:
>> Bill Baxter wrote:
>>> On Sun, Feb 22, 2009 at 4:00 AM, Andrei Alexandrescu
>>> <SeeWebsiteForEmail at erdani.org> wrote:
>>>> Jarrett Billingsley wrote:
>>>>> On Sat, Feb 21, 2009 at 12:32 PM, Andrei Alexandrescu
>>>>> <SeeWebsiteForEmail at erdani.org> wrote:
>>>>>
>>>>>> Yah. Walter agrees that that's the right thing to do. The only thing
>>>>>> that
>>>>>> worries us is passing by-value large statically-sized vectors to
>>>>>> template
>>>>>> functions. But then gaming code wants to do exactly that.
>>> I don't follow you.  Wouldn't they rather pass such huge chunks of
>>> data by reference?
>>>
>>> --bb
>> What I'm saying (sorry for being unclear) is:
>>
>> 1. If we choose T[N] as a value type, the downside is that people may pass
>> large arrays by values to e.g. template functions.
>>
>> 2. The upside is that gaming programmers DO want to pass short arrays of
>> type T[N] by value.
>>
>> The conundrum is that a type system can't say that T[N] has some semantics
>> for N <= Nmax and some other semantics for N > Nmax. So we need to pick one,
>> and probably picking the value semantics is the right thing to do.
>>
> 
> Ok.  And for large static arrays you can still explicitly use ref, right?

Yah, ref on the callee side, or the [] operator without any arguments on 
the caller side.

Andrei



More information about the Digitalmars-d mailing list