@property with opCall
Simen Kjærås
simen.kjaras at gmail.com
Mon Mar 9 09:44:40 UTC 2020
On Monday, 9 March 2020 at 09:25:31 UTC, Calvin P wrote:
> Is this a bugs ?
>
> ==============
> struct A {
> ref auto opCall(string tmp) scope return {
> return this;
> }
> }
>
> struct B {
> A _a;
>
> @property ref auto a() scope return {
> return _a;
> }
> }
>
> extern(C) int main(){
> A a;
> a("a")("b");
> B b;
> b.a("a")("b"); // Error: function test_opCall.B.a() is
> not callable using argument types (string)
> return 0;
> }
> ==========
>
>
> I has to use b.a()("a")("b") to avoid the compiler error. I
> think it should work to avoid the unnecessary ()
>
> Should I submit a bugs ?
As written on
https://dlang.org/spec/function.html#property-functions:
> WARNING: The definition and usefulness of property functions is
> being reviewed, and the implementation is currently incomplete.
> Using property functions is not recommended until the
> definition is more certain and implementation more mature.
So no, I don't think it's necessary to file a bug - we're aware
they're somewhat wonky, and until a resolution has been agreed
on, I don't think filing bugs on what's undecided behavior is
worth it.
--
Simen
More information about the Digitalmars-d-learn
mailing list