Why I love D: function parameter reification
H. S. Teoh
hsteoh at qfbox.info
Thu Jun 9 15:56:31 UTC 2022
On Thu, Jun 09, 2022 at 11:43:36AM +0000, bauss via Digitalmars-d wrote:
> On Thursday, 9 June 2022 at 11:39:35 UTC, Adam D Ruppe wrote:
> > On Thursday, 9 June 2022 at 08:19:05 UTC, Paolo Invernizzi wrote:
> > > I still think that being able to reflect ddoc comments will be a
> > > huge win ... a-la-python-"__doc__"
> >
> > Yes, indeed, I've requested this several times, it is useful for a
> > bunch of things like this. There were PRs adding
> > `__traits(docComment, symbol)` to get it too, but rejected by people
> > who don't use D in the real world. Alas.
>
> I really can't see any reason to reject it, it's not like it'll impact
> anything at all really.
In theory, you could insert code in your ddoc and use introspection to
mix it into the program and execute it at runtime.
> But it really would be useful for tooling, error messages, validation
> etc.
>
> Could in theory be used to create automated unittests by extracting
> code examples from the docs.
Yes, this would be an awesome application. Though, for the most part,
it has already been covered by ddoc'd unittest blocks.
T
--
Freedom: (n.) Man's self-given right to be enslaved by his own depravity.
More information about the Digitalmars-d
mailing list