May 16, 2014 Re: initialization immutable array | ||||
---|---|---|---|---|
| ||||
Posted in reply to bearophile | On Friday, 16 May 2014 at 08:43:31 UTC, bearophile wrote:
> monarch_dodra:
>
>> UFCS iota :puke:
>
> I think UFCS iota is acceptable when it has only one argument:
>
> myArray.length.iota...
>
> Bye,
> bearophile
My gripe is how "incompatible" 1-arg and 2-arg iota is w.r.t. UFCS:
0.iota(4);
4.iota();
That's also why I've stopped using "writeln()" as UFCS: It "looks" convenient at first, but then you want to turn those "writeln" into "writefln", and that's when things don't go according to plan...
|
May 16, 2014 Re: initialization immutable array | ||||
---|---|---|---|---|
| ||||
Posted in reply to monarch_dodra | monarch_dodra: > That's also why I've stopped using "writeln()" as UFCS: It "looks" convenient at first, but then you want to turn those "writeln" into "writefln", and that's when things don't go according to plan... Yes, I understand. If you want some ugly code you can use std.functional.binaryReverseArgs: alias flip = binaryReverseArgs; myRange.flip!writefln("%s") bye, bearophile |
Copyright © 1999-2021 by the D Language Foundation