https://issues.dlang.org/show_bug.cgi?id=14544
Jacob Carlborg <[email protected]> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |[email protected] --- Comment #5 from Jacob Carlborg <[email protected]> --- (In reply to Jonathan M Davis from comment #3) > The problem is though that once > it's required to be a property, changing it later risks breaking code. Given > how poorly properties are checked by the compiler, we _might_ be able to > make the change, but we'd have to be careful about it. Regardless, the fact > that isForwardRange is the way it is and requires that save be a property is > very much on purpose. I'm not exactly sure how "is(typeof())" is working in this case but for a getter, @property doesn't make a difference, regardless if compiled with the -property flag. Take this code for example: @property int foo () { return 1; } @property void bar (int a) { } void main () { auto a = foo(); auto b = foo; bar = 3; bar(4); } This code compiles both with and without the -property flag. The only thing that will not compile is "bar = 3" if "bar" is _not_ marked with @property and it's compiled with the -property flag. What we can do what looks to be completely backwards compatible is modify the "isForwardRange" constraint to look like this instead: static assert (is(typeof(r1.save()) == R)); Or to make it more clear: static assert (is(ReturnType!(save) == R)); These two will work regardless if @property is used on "save" or if the code is compiled with -property. --
