dynamic classes and duck typing
Andrei Alexandrescu
SeeWebsiteForEmail at erdani.org
Tue Dec 1 11:07:34 PST 2009
Walter Bright wrote:
> Leandro Lucarella wrote:
>> with file(fname) as f:
>> x = f.read(10)
>> f.write(x)
>
> Looks like you're right, and it's a recently added new feature. I
> suggest it proves my point - Python had to add complexity to support
> another paradigm. Python's "with" doesn't look any simpler than scope
> guard.
Actually "with" is an awful abstraction as defined in Java (the new
version), C#, and Python. Scheme also has am unwind-protect function. I
strongly believe all of the above are hopelessly misguided. Scope guard
is the right thing, and I am convinced it will prevail.
Andrei
More information about the Digitalmars-d
mailing list