Proposal: __traits(getComment, symbol)

Petar Petar
Thu Aug 29 11:24:09 UTC 2019


On Thursday, 29 August 2019 at 10:20:28 UTC, RazvanN wrote:
>
> Whatever you want to do with traits(getAST) would likely be a 
> job for dmd as a library.

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 ;)


More information about the Digitalmars-d mailing list