DIP 1009--Improve Contract Usability--Preliminary Review Round 1
MysticZach via Digitalmars-d
digitalmars-d at puremagic.com
Thu Jun 22 05:47:18 PDT 2017
On Thursday, 22 June 2017 at 12:21:29 UTC, MysticZach wrote:
> I start to get the nagging feeling that your point about the
> limitation in D's DbC implementation is actually the fatal flaw
> here. It's currently _illegal_ (outside of interface
> declarations) to expose the signature separately from the body,
> which, as you point out, is more or less the whole point of
> DbC. <shrug> The existing system is itself distinctly _worse_
> than just writing out asserts manually... and as far as I can
> tell, none of the alternative syntaxes is a decisive
> improvement over it. Yours looks the best, but implying
> `assert` in the grammar seems to be going too far, especially
> for a DbC system that is only half functional. If the `assert`
> system were made more user-definable, it would make more sense.
> Do you agree with me on this?
>
> Plans to improve `assert` are already in the air. Maybe we
> should wait on them before promoting your suggestion?
Conversely, as Moritz suggests, contracts could have their own
separate logic, with optional user-defined hooks. Do you have a
suggestion on how to implement this behind the scenes?
More information about the Digitalmars-d
mailing list