What is the 'Result' type even for?

Ruby The Roobster rubytheroobster at yandex.com
Fri Jan 20 12:49:54 UTC 2023


On Friday, 20 January 2023 at 03:39:48 UTC, H. S. Teoh wrote:
> On Fri, Jan 20, 2023 at 03:34:43AM +0000, Ruby The Roobster via 
> Digitalmars-d-learn wrote:
>> On Friday, 20 January 2023 at 03:30:56 UTC, Steven 
>> Schveighoffer wrote:
>> > On 1/19/23 10:11 PM, Ruby The Roobster wrote:
>> > ...
>> > 
>> > The point is to be a range over the original input, 
>> > evaluated lazily. Using this building block, you can create 
>> > an array, or use some other algorithm, or whatever you want. 
>> > All without allocating more space to hold an array.
> [...]
>> I get the point that it is supposed to be lazy.  But why are 
>> these basic cases not implemented?  I shouldn't have to go 
>> write a wrapper for something as simple as casting this type 
>> to the original type. This is one of the things that one 
>> expects the standard library to do for you.
>
> There's no need to write any wrappers.  Just tack `.array` to 
> the end of your pipeline, and you're good to go.
>
>
> T

Thank you.  I didn't know that there was such a property `.array`.


More information about the Digitalmars-d-learn mailing list