Does D have any construct like Python's with keyword?

Daniel Kozak via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Sat Aug 27 01:36:07 PDT 2016


Dne 27.8.2016 v 02:04 pineapple via Digitalmars-d-learn napsal(a):

> I would just love if I could express this as something more like
>
>
>     context(auto file = File("some_file.txt")){
>         file.write();
>     }
>

void main(string[] args)
{
     with(File("some_file.txt"))
     {
         write();
     }
}


More information about the Digitalmars-d-learn mailing list