Replies: 4 comments 3 replies
-
(D) Explicit but with Go-style method syntax // D explicit but with Go-style method syntax:
fn int (Foo* foo) bar(int x) {
return foo.z * x;
} |
Beta Was this translation helpful? Give feedback.
1 reply
-
fn void Point.inc(int sx, int sy) {
with $self {
x += sx;
y += sy;
}
} |
Beta Was this translation helpful? Give feedback.
1 reply
-
What about option A, but allow dot calls on any value of the first argument type? fn void test(Foo* f) {
printf("%d", f.bar(123));
}
// A explicit "this" parameter; but can call it without first argument via dot notation
fn int bar(Foo* foo, int x) {
return foo.z * x;
} |
Beta Was this translation helpful? Give feedback.
1 reply
-
This is long since resolved. So closing it. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Possibly I would introduce an implicit
this
parameter for method functions, and I'd like to hear what you think about it. Below you see three possible versions: A (current), B (implicit), C (explicit but without the type). I'm still collecting opinions here, so nothing is decided yet.10 votes ·
Beta Was this translation helpful? Give feedback.
All reactions