food for thought - swift 5 released - bottom types, string interpolation, and stuff.

mate aiueo at aiueo.aiueo
Tue Apr 16 12:11:32 UTC 2019


On Sunday, 14 April 2019 at 02:20:22 UTC, Timon Gehr wrote:
> On 14.04.19 02:42, mate wrote:
>> [...]
>
> Probably not. What would be the trigger for that?

I would think that having an isOdd() is… odd. It seems so trivial 
and short that I would suspect something different.

>> [...]
>
> Maybe. However, often, the quickest way to make the thing I was 
> working on work with sufficient code quality is not actually to 
> implement the missing standard library functions, even though 
> it would have been easier with those functions there. (E.g., 
> compute the thing with a a few for loops instead of with a more 
> elegant and readable range-based solution.) I'll consider 
> writing some libraries in the future, but right now I don't 
> really get enough of my productive time to work on projects I 
> already started, such as getting better tuple support, and I'd 
> really prefer obvious omissions to be in the standard library. 
> I see that scan has finally been added, but I'm a bit 
> disappointed it was called cumulativeFold.

I understand. I did not mean to suggest you to start a new 
project. I am already grateful for the contributions you made to 
dlang, thank you.

> Here, I was mainly objecting to the general idea that functions 
> that are simple to implement in terms of a few other 
> functions/built-in operators have no business being in the 
> standard library. (This has come up before.) It's not even 
> consistently applied in Phobos. E.g., there is max and min even 
> though they are trivially implemented in terms of each other by 
> switching around the comparison predicate, but it would clearly 
> be ridiculous to require this by arbitrarily picking one over 
> the other. On the other hand, we have until, but not takeWhile, 
> even though it is more common to want to specify the kinds of 
> elements that you like instead of a condition on the first one 
> that you don't want.

I see. I was not arguing for the minimum set by removing 
reciprocal functions though. What would be your criteria for 
inclusion?


More information about the Digitalmars-d mailing list