[phobos] [dlang/phobos] 1a8cfa: Require that popFront and popBack be callable with...

GitHub via phobos phobos at puremagic.com
Fri Nov 25 13:44:56 PST 2016


  Branch: refs/heads/master
  Home:   https://github.com/dlang/phobos
  Commit: 1a8cfa7029bf7165ad1b741da7689a69b89ac9dd
      https://github.com/dlang/phobos/commit/1a8cfa7029bf7165ad1b741da7689a69b89ac9dd
  Author: Jonathan M Davis <jmdavis at jmdavisprog.com>
  Date:   2016-11-25 (Fri, 25 Nov 2016)

  Changed paths:
    M std/range/primitives.d

  Log Message:
  -----------
  Require that popFront and popBack be callable without parens.

Technically, prior to this change, it was possible to define popFront
and popBack to be callables that required parens - such as member
variable with an overloaded opCall or a delegate. It's unlikely that
anyone has actually declared popFront or popBack in this manner, but
it's possible. Because of that, calling popFront or popBack without
parens would technically not work with some valid ranges (even if such
ranges are unlikely to exist) and thus without this change, it's
arguably not valid to call popFront or popBack without parens in generic
code - especially in the standard library.

Andrei wants to be able to call popFront without parens in generic code,
and when I pointed out the existing problem with that, he wanted me to
change it so that it's no longer legal to have a range where popFront or
popBack is a callable that requires parens. So, this PR fixes that.

Now, technically, this is a breaking change, but it's highly unlikely
that it actually breaks any code, and I don't know of any way to do this
change in a way which would allow for any kind of deprecation message
for anyone trying to declare a range with a popFront or popBack that
would not work without parens. So, as far as I can tell, if we want to
make this change, we're stuck making a breaking change, but the odds of
it actually mattering seem low.


  Commit: f6b4e89d64eb998b80a70f23426e0e509e1933d8
      https://github.com/dlang/phobos/commit/f6b4e89d64eb998b80a70f23426e0e509e1933d8
  Author: Andrei Alexandrescu <andrei at erdani.com>
  Date:   2016-11-25 (Fri, 25 Nov 2016)

  Changed paths:
    M std/range/primitives.d

  Log Message:
  -----------
  Merge pull request #4925 from jmdavis/popFront

Require that popFront and popBack be callable without parens.


Compare: https://github.com/dlang/phobos/compare/bad369cea4d8...f6b4e89d64eb


More information about the phobos mailing list