On Fri, 09 Jan 2015 11:57:50 +0000 Daniel Kozak via Digitalmars-d <[email protected]> wrote:
> I often have code like this:
>
> class A {
> final:
> nothrow:
> ...
> some methods
> ...
> }
>
> Problem comes when I need add methods which for eg.: throws or
> need to be virtual.
>
> I can put them before final: but this is not perfect, because I
> prefer when methods are place in specific order (method abc call
> method asd so asd is bellow abc and so on).
>
> So today I download dmd source and make some small modification
> (only few lines) and this is the result:
>
> http://dpaste.dzfl.pl/472afc938397
i've dreamt about similar feature for a long time! i was thinking about
"negative attributes" though (@canthrow, @virtual, etc), but your
solution seems to be better as it's not poluting language with new
attrs.
can it be used like this:
final:
nothrow:
...
default void foo () { ... }
...
so only `foo` becomes default, but all other methods after `foo` are
`final nothrow`?
and can it be used like this:
default void foo () nothrow { ... }
so `default` resets all attrs and then i can specify another set of
attrs inline?
signature.asc
Description: PGP signature
