"body" can be a symbol and "do" has another use

Ali Çehreli acehreli at yahoo.com
Mon Nov 27 20:55:05 UTC 2017


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



More information about the Digitalmars-d mailing list