WithStatement

KennyTM~ kennytm at gmail.com
Sun Jul 24 13:01:00 PDT 2011


On Jul 25, 11 03:51, bearophile wrote:
> Shahid:
>
>> I'm wondering what others think about extending the WithStatement to take
>> a colon, which would create an implicit scope similar to how Attributes
>> work. eg:
>>
>> T func( ... )
>> {
>> 	with ( Struct ):
>> 	
>> 	bar( Enum1.A );
>> 	...
>
> If you extend this idea to if/while/for statements too, the end result is a Python-D:
> http://delight.sourceforge.net/
>
> Bye,
> bearophile

Not exactly. The ':' scope isn't terminated with de-dent, e.g. the 
language have to choose one of the two meanings in the following:

     foreach (i; a1):
       do_something_with(i);
      foreach (j; a2):
        do_something_with(j);

(Actually this applies to this 'with' statement too. In

     with (A):
      with (B):

should 'B' be nested in or replacing 'A'?)


More information about the Digitalmars-d mailing list