On Wednesday, May 08, 2013 18:43:01 =?UTF-8?B?Ikx1w61z?=.Marques <[email protected]>@puremagic.com wrote: > Hi, > > Regarding this article about Voldemort types: > > > http://www.drdobbs.com/cpp/voldemort-types-in-d/232901591?pgno=2 > > There's something I didn't understand. I general I understand the > benefit of hiding the type of the "struct RandomNumberGenerator" > so it doesn't leak out of the generator() function. But why not > just document the generator() function as returning a Range? > Indeed, as it is with auto it seems it might not be very friendly > to documentation, not documenting the actual return type (a > Range).
It probably _should_ document that it's returning a range. Voldemort types just make it so that the exact type is unknown. You still need to know what kind of API it has in order to use it. It's just that at that point, it's _only_ the API that matters and not its exact type. Functions returning auto do need to give enough information about what they're returning for programmers to actually use the return value. Feel free to create pull requests to fix the documentation on any function you find which isn't clear enough. - Jonathan M Davis
