February 02, 2019 [Issue 19638] Demos should not use auto | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=19638 Seb <greeenify@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |RESOLVED CC| |greeenify@gmail.com Resolution|--- |INVALID --- Comment #1 from Seb <greeenify@gmail.com> --- > so I will need to forward declare the variable however I cannot do this because I do not know the type I should be using to declare because it has been obscured by the use of auto in the demo. Are you aware of e.g. `typeof`? --- auto r = 10.iota; --- is equal to: --- typeof(10.iota) r; ... r = 10.iota; --- I will close this as invalid, because: - for many functions in Phobos one doesn't even now the type - `auto` is easier to read (less visible space) - `auto` is smarter as you don't need to change anything if you refactor code (also good for copy&paste examples) I encourage you to look up Voldemort types (https://wiki.dlang.org/Voldemort_types) and post to the Learn group for more questions -- |
Copyright © 1999-2021 by the D Language Foundation