Multiple return value as requirements for safety and performance

Stefan Koch via Digitalmars-d digitalmars-d at puremagic.com
Tue Dec 20 09:05:03 PST 2016


On Tuesday, 20 December 2016 at 16:57:34 UTC, Ilya Yaroshenko 
wrote:
> On Tuesday, 20 December 2016 at 16:34:04 UTC, Walter Bright 
> wrote:
>> On 12/20/2016 6:08 AM, Ilya Yaroshenko wrote:
>>> No, tuples stores either value or pointer. If it stores 
>>> pointer then it is not
>>> safe and it is not CTFE.
>>
>> You can make it safe by using an array rather than a pointer.
>
> Ranges a and b may not be arrays. They just have Range API and 
> return front by reference.How this can be handled for CTFE, 
> safe code? Would the solution be fast?

What are you even talking about ?
Making a Tuple is fine.
Pointers can also be perfectly safe and CTFEable if you do not 
try to mess with them.
For a Range you have to pass some form of context regardless so 
there will always be a quite small price to be payed.

--
Performance is not something you just get.
Work is required if you want good performance and no library or 
language is going to change that.


More information about the Digitalmars-d mailing list