Open Methods: From C++ to D
Jean-Louis Leroy via Digitalmars-d-announce
digitalmars-d-announce at puremagic.com
Wed Aug 30 06:35:22 PDT 2017
On Wednesday, 30 August 2017 at 04:48:11 UTC, Arun Chandrasekaran
wrote:
> On Tuesday, 29 August 2017 at 12:45:50 UTC, Jean-Louis Leroy
> wrote:
>> On Tuesday, 29 August 2017 at 12:09:01 UTC, Mark wrote:
>>> Nice. This does seem superior to the visitor pattern.
>>
>> Here is another example - AST traversal:
>> https://github.com/jll63/openmethods.d/blob/master/examples/acceptnovisitors/source/app.d
>
> Thanks for this library. Just a suggestion. Would it possible
> to use `@openmethod` instead of `@method`?
Ah, I think it's a little late for that. A while ago I asked if
anyone had suggestions regarding that sort of things...But now
that the article has been published I think it would be a very
bad idea to break all the exmaples in it.
What was your rationale for `openmethod` instead of just `method`?
I will push a commit tonight that will make this work:
import openmethods : virtual, openmethod = method, next,
registerMethods, updateMethods;
// ...
@openmethod // implement 'kick' for dogs
string _kick(Dog x) // note the underscore
{
return "bark";
}
More information about the Digitalmars-d-announce
mailing list