dynamic classes and duck typing
Andrei Alexandrescu
SeeWebsiteForEmail at erdani.org
Tue Dec 1 12:26:37 PST 2009
Leandro Lucarella wrote:
> Andrei Alexandrescu, el 1 de diciembre a las 11:07 me escribiste:
>> 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.
>
> Good arguments!
Yah, point taken :o). I probably haven't clarified enough that I'm
talking about a mere belief. Arguments have been discussed here in the
past (e.g. scalability of the language construct with multiple
transactions). Time will tell, but one indicating factor is that
programs don't deal well with exceptions and scope guards help that
massively, whereas "with" seems to help much less. Besides, anyone may
be a nut about something, and scope guard is something I'm a nut about.
Andrei
More information about the Digitalmars-d
mailing list