June 24, 2021

On Thursday, 24 June 2021 at 01:36:47 UTC, Ali Çehreli wrote:

>
  import std.algorithm;
  lnumRange.sort!(r"a > b"c);
  return lnumRange;

The above works OK. Funny thing indeed, at least to me, totally unexpected.

return lnumRange.sort!(r"a > b"c); /// does not work

return lnumRange.sort!(r"a > b"c).release(); /// works

Intuitive ? Not a bit LoL ! (not complaining at all, just making fun of it)

June 24, 2021

On Thursday, 24 June 2021 at 02:33:42 UTC, someone wrote:

>

On Thursday, 24 June 2021 at 01:36:47 UTC, Ali Çehreli wrote:

>
  import std.algorithm;
  lnumRange.sort!(r"a > b"c);
  return lnumRange;

The above works OK. Funny thing indeed, at least to me, totally unexpected.

return lnumRange.sort!(r"a > b"c); /// does not work

return lnumRange.sort!(r"a > b"c).release(); /// works

Intuitive ? Not a bit LoL ! (not complaining at all, just making fun of it)

Most languages have either a void sort that mutates, or a non-mutating
sort that returns the new array. This is true also of similar
languages: C++, Nim, and Rust all void mutate.

So the more experience you have with other languages, probably the
more surprised you'll be by D's sort. This comes up in a few places
with D, like the rest of range support in phobos, or dynamic arrays.

  • a thing seems to be a familiar feature
  • surprise! it's different in an important way
  • (period of grumbling)
  • ok, it's useful that it's like this
June 24, 2021

On Thursday, 24 June 2021 at 05:39:22 UTC, jfondren wrote:

>
  • ok, it's useful that it's like this

Albeit (the grumbling and) the weirdness of it, this is exactly the reason why I am not complaining on such behavior -time will show me.

1 2
Next ›   Last »