Proposal: __traits(getComment, symbol)
Jacob Carlborg
doob at me.com
Thu Aug 29 12:27:33 UTC 2019
On 2019-08-29 13:24, Petar Kirov [ZombineDev] wrote:
> BTW, the argument "<..> is a job for the compiler as a library" is what
> languages like Go use as an excuse for why they don't have neither
> templates, nor even generics. And if you want type-safety, you would use
> build-time (not compile-time) code-generation tools like this:
>
> https://godoc.org/github.com/searKing/golang/tools/cmd/go-syncmap
> https://godoc.org/github.com/searKing/golang/tools/cmd/go-syncpool
> https://github.com/ChimeraCoder/gojson
>
> In D such tools are completely replaces by templates (modulo compilation
> time trade off). If you have experience with languages that have some
> sort of AST macros, you start to think of languages that don't, just as
> we think of languages without templates or generics, like Go.
>
> See also
> https://web.archive.org/web/20190622093122/http://wiki.c2.com/?BlubParadox
> ;)
True, although I think there are use cases for both AST
macros/`__traits(getAST)` and using the compiler as a library.
Something like inspecting the AST of all source files of a project and
do something seems a bit difficult to do with AST macros/`__traits(getAST)`.
--
/Jacob Carlborg
More information about the Digitalmars-d
mailing list