On Thursday, 8 November 2018 at 06:01:57 UTC, Jonathan M Davis
wrote:
On Wednesday, November 7, 2018 10:45:07 PM MST Jonathan M Davis
via Digitalmars-d-learn wrote:
[...]
Rereading what you wrote, are you asking whether it's
reasonable to return a value instead of a reference?
Personally, I don't think that that's good design at all, but I
also don't see any reason for the compiler to prevent it.
Personally, I think that the default design should be to return
by ref. Returning void is less than ideal but isn't necessarily
bad, depending on the situation (especially if we're not
talking about a general purpose library). However, I expect
that returning non-void by value rather than by ref is rarely
-if ever - going to be a good design choice. It's just going to
be confusing and not particularly useful.
- Jonathan M Davis
NB its not returning a ref to the list, its returning the newly
created node when you use the operator you add a type to the
list, so it possibly wouldn't be that much use for chaining?