Syntax sugar for {} with structs

H. S. Teoh hsteoh at qfbox.info
Wed Jul 6 16:23:58 UTC 2022


On Wed, Jul 06, 2022 at 03:51:56PM +0000, ryuukk_ via Digitalmars-d wrote:
[...]
> D likes to steal common words that i can't use in my APIs
> 
> `debug`, `version`, `init`, `destroy`
> 
> It forces me to come up with annoying alternatives
> 
> `dbg`, `versionn`, `create`, `dispose` (but i really need `destroy`)
> 
> This is poor design in my opinion

https://dlang.org/dstyle.html

Quote from section "Keywords":

	If a name would conflict with a keyword, and it is desirable to
	use the keyword rather than pick a different name, a single
	underscore ‘_’ should be appended to it.

This is just a recommendation, of course. But at least you wouldn't have
to invent new words for your identifiers.


T

-- 
A program should be written to model the concepts of the task it performs rather than the physical world or a process because this maximizes the potential for it to be applied to tasks that are conceptually similar and, more important, to tasks that have not yet been conceived. -- Michael B. Allen


More information about the Digitalmars-d mailing list