On Monday, 14 January 2019 at 21:22:32 UTC, Andre Pany wrote:
On Monday, 14 January 2019 at 21:08:50 UTC, Ben Jones wrote:
On Saturday, 12 January 2019 at 15:51:03 UTC, Andrei Alexandrescu wrote:

If nothing else please watch the opening story, it's true and quite funny :o).

Now as to the talk, as you could imagine, it touches on another language as well...


A lot of the questions were about documenting the hook API and catching misspelling errors when defining a hook.

It seems like it would be nice if you could list the hook method names a static array or dictionary or struct containing a field for each method, etc. One each for the required and optional methods.

The hook author could grab the name/signature of the method they're intending to implement from that data structure and any misspellings would be caught immediately.

Is it possible to declare a function whose name is a CTFE computed string?

For ranges there are concepts like Input Range. A struct/class must have several methods to be compliant. You can check the compliance using function isInputRange https://dlang.org/library/std/range/primitives/is_input_range.html

Maybe something similiar can be done here. Not checking individual methods, but concepts...

Kind regards

I don't think that's quite sufficient because a hook may/may not have the optional methods, and could have extra stuff. What you want is to specify per method "this method is part of the hook interface," which as I type it kind of sounds like the job of an annotation...

Reply via email to