DIP 1009--Improve Contract Usability--Preliminary Review Round 1
Moritz Maxeiner via Digitalmars-d
digitalmars-d at puremagic.com
Wed Jun 21 10:12:48 PDT 2017
On Wednesday, 21 June 2017 at 16:23:53 UTC, MysticZach wrote:
> void foo()
> {
> int bar(Args...)(Args args)
> if (Args.length > 2)
> in (args[0] != 0)
> in (args[1] > 1)
> out /*whoops, forgot `( )`*/(result) { ... }
>
> do { ... }
> while (true); // Error: while statement cannot contain just
> `;`
> }
>
> Honestly this doesn't seem like a big deal, as I'd imagine it'd
> be hard not to notice that code like this wasn't working as
> expected. And also extremely rare. So I'm still in favor.
I see. Well, I would only see that as an issue if it would
compile and then generate code that differs from what one
intended. But since it errors out, I don't see a problem, either,
though it would be best to enhance that error message to give a
hint that the programmer may have triggered that ambiguous case
by accident. Something like "Did you mean `out() (result)`?"
More information about the Digitalmars-d
mailing list