3 ms·
As a language design point it's also saying that (this simple modification to C++) void add(const this, int x) Is more readable than (IMO) void add(i
by mhh__ 4y ago
As a language design point it's also saying that (this simple modification to C++)
void add(const this, int x)
Is more readable than (IMO)
void add(int x) const
- kccqzy 4y agoYou may like the "deducing this" proposal: http://wg21.link/P0847 http://wg21.link/P0847 (Scroll down to the "proposed syntax" section.)
- TeMPOraL 4y agoMight as well just always spell out the hidden "this" argument. Then all methods would look just like regular functions, allowing to simplify the language syntax and the standard, making it more concise and consistent, without sacrificing any functionality.
- pronlover723 4y agoThat can go both ways? I agree that I like when functions are not special so instance.add(10) Is just sugar for add(instance, 10) and you pass anything that fits as the first argument. But, following the "syntactic sugar" is okay rule class Foo { add(int v); } Is just syntactic sugar for void Foo.add(Foo this, int v); ... or something along those lines... ?