November 21, 2017 Re: "body" keyword is unnecessary | ||||
---|---|---|---|---|
| ||||
Posted in reply to Tony | On Sunday, 19 November 2017 at 11:54:04 UTC, Tony wrote: > dmd --version > DMD64 D Compiler v2.077.0 > Copyright (c) 1999-2017 by Digital Mars written by Walter Bright > > dmd test_contracts.d > test_contracts.d(13): Error: missing `body { ... }` after `in` or `out` Just made a pull to fix this: https://github.com/dlang/dmd/pull/7347 |
November 27, 2017 "body" can be a symbol and "do" has another use | ||||
---|---|---|---|---|
| ||||
Posted in reply to Basile B. | On 11/19/2017 04:54 AM, Basile B. wrote: > After testing some code with i've indeed observed that the transition > period for `do` had started... > > "since when ?" i've wondered. > > Good question, it's even not in the changelog: Same here! I learned about this in a D snippet in an article on contract programming that I saw on Reddit: https://www.reddit.com/r/programming/comments/7fxz1v/introduction_to_contract_programming/ void foo() in { // ... } out { // ... } do { // <-- Looks good // ... } void main() { auto body = "repair"; // <-- WOO HOO! :) } Ali |
Copyright © 1999-2021 by the D Language Foundation