On Mon, 06 Oct 2014 15:44:34 +0000 John Colvin via Digitalmars-d-learn <[email protected]> wrote:
> >> I disagree. It's simple and easy to understand.
> > and hackish.
> D is very amenable to slightly hackish code.
D allows to write hackish code, and it's good. but if we can provide a
way to write less hackish code, it's good and preferable, i think. ;-)
> > no hacks needed.
> I meant that without a language change, one does need hacks.
i see.
> That would be nice, although personally I'd prefer
>
> int A.bar() { return this.hiddenField; }
>
> as it's less verbose and would be familiar to c++ programmers.
i was trying to not change grammar, that's why i invented that
horribly-looking @implementation attribute. this way the code is still
marked as a hack, but "officially endorsed" hack. besides, attribute
allows to use code blocks:
@implementation(A) {
int foo () { ... }
void bar () { ... }
}
or even:
@implementation(A):
int foo () { ... }
void bar () { ... }
sure, it has it's own pack of problems:
@implementation(A) {
@implementation(B) {
// I'M LOST!
}
}
but we can have both! ;-)
signature.asc
Description: PGP signature
