DIP 50 - AST macros

Walter Bright newshound2 at digitalmars.com
Sun Nov 17 12:48:15 PST 2013


On 11/17/2013 10:47 AM, deadalnix wrote:
> On Sunday, 17 November 2013 at 13:36:32 UTC, Simen Kjærås wrote:
>> On 2013-11-17 11:37, Jacob Carlborg wrote:
>>> On 2013-11-17 09:58, Walter Bright wrote:
>>>
>>>> Think about the desired feature mentioned earlier in this thread of
>>>> being able to insert a "return;" statement, causing what looks like a
>>>> function call to return from the caller.
>>>
>>> I'm not entirely sure what you're saying. Could you please post a link
>>> to the post mentioning this or show an example.
>>
>> I believe it is basically this:
>>
>> int bar() {
>>     foo(return 3);
>>     return 5;
>> }
>>
>>
>> If that program is allowed to compile, and to return 3.
>
> That never was in the DIP.

It was this by Timon Gehr essentially posting why lazy parameters weren't good 
enough:

> On 11/13/2013 08:25 PM, Walter Bright wrote:
>>>
>>
>> Ah, found the code:
>>
>> void ifthen(bool cond, lazy void dg)
>> {
>>      if (cond)
>>          dg();
>> }
>
> int foo(int x){
>     ifthen(!x, return 2); // uh oh
>     return 3;
> }




More information about the Digitalmars-d mailing list