3 ms·
Should probably clarify if this is allowed - func void Point.add(Abc * p, int x) ... i.e. a method with the first argument of a non-matching type. If it's
by eps 5y ago
Should probably clarify if this is allowed -
func void Point.add(Abc * p, int x)
...
i.e. a method with the first argument of a non-matching type. If it's not allowed, then why not use this ?
- lerno 5y agoI deliberately removed the "static" methods, so that above would not be allowed. Why I found that to be a good idea is a longer discussion. The main motivation why it is nice to have it this way is that it's straightforward to understand what the type is when doing `&Point.add`. I have considered a `this` but it's not felt super important to have. Also, note that this is allowed: `Point *x = null; x.doSomething();` - this is made more obvious by taking the reference as an explicit parameter.