| Thread overview | ||||||
|---|---|---|---|---|---|---|
|
May 04, 2013 UFCS requires explicit this | ||||
|---|---|---|---|---|
| ||||
Attachments:
| Greetings
Consider the following code ...
class Foo { // 1
void foo() { // 2
bar(); // 3
this.bar(); // 4
} // 5
} // 6
void bar(Foo f) { // 7
import std.stdio; // 8
writeln("This bar"); // 9
} // 10
void main() { // 11
Foo test = new Foo; // 12
test.foo(); // 13
} // 14
DMD is fine with line 4 because of UCFS. But it gives an error for line 3 because it does not get this pointer to bind as argument.
I want to know if it is a DMD bug or whether line 3 would be compilable at some point in future.
Regards
- Puneet
| |||
May 04, 2013 Re: UFCS requires explicit this | ||||
|---|---|---|---|---|
| ||||
Posted in reply to d coder | This is to be expected. | |||
May 04, 2013 Re: UFCS requires explicit this | ||||
|---|---|---|---|---|
| ||||
Posted in reply to Timon Gehr Attachments:
| Timon, you mean such support is planned, or is the current behavior the expected behavior.
Regards
- Puneet
On Sat, May 4, 2013 at 4:57 PM, Timon Gehr <timon.gehr@gmx.ch> wrote:
> This is to be expected.
>
| |||
May 04, 2013 Re: UFCS requires explicit this | ||||
|---|---|---|---|---|
| ||||
Posted in reply to d coder | On 05/04/2013 01:57 PM, d coder wrote:
> Timon, you mean such support is planned, or is the current behavior the
> expected behavior.
> ...
The current behaviour is expected.
UFCS is a rewrite rule from a.b(args...) to b(a,args...).
| |||
Copyright © 1999-2021 by the D Language Foundation
Permalink
Reply