Proposal for scoped const contracts

Jason House jason.james.house at gmail.com
Mon Mar 24 13:36:32 PDT 2008


Steven Schveighoffer Wrote:

> So, how do we specify this?

I'm not a D 2.x user yet, but wouldn't it simply be the following?

char[] strchr(return char[] source, const char[] pattern);

Note that pattern can always be const by the very nature of the function.  Only the source argument needs to be coupled with the return type.  I think this compactly reduces the various const forms into a simple and easy to define function.  Having the return type be naked kind of bugs me a bit, but it if I can get away with writing just one function like that, I'm all for it.



More information about the Digitalmars-d mailing list