Re[17]: Не выпендриваюсь ли я?
От: BulatZiganshin  
Дата: 30.07.07 11:26
Оценка:
BZ>>а как выглядит этот код? как я понимаю, те же лямбды, только сахар не такой сладкий?

FR>Со сладким сахаром есть в D Programming Language смотри scope exit тут http://www.digitalmars.com/d/exception-safe.html


ну вот собственно он и говорит ровно о том же:

Both solutions work, but both have drawbacks. The RAII solution often requires the creation of an extra dummy class, which is both a lot of lines of code to write and a lot of clutter obscuring the control flow logic. This is worthwhile to manage resources that must be cleaned up and that appear more than once in a program, but it is clutter when it only needs to be done once. The try-finally solution separates the unwinding code from the setup, and it can often be a visually large separation. Closely related code should be grouped together.


хотя думаю, что слаще было бы это сделать на клозурах. в руби, например, такое возможно
Люди, я люблю вас! Будьте бдительны!!!
 
Подождите ...
Wait...
Пока на собственное сообщение не было ответов, его можно удалить.