Какой я тёмный.
13/2/06 13:23Вы знали? Я не знал.
В C# 2.0 есть closures (у Джо Уолнса). Прочитано у классика. У него достаточно немного коротких статей и их все стоит прочесть.
Обратите внимание на область видимости переменных:
выпить й учить матчасть.
upd: интересная цитата об аргументах против closures в Java - о выделении памяти. По ссылке от Фаулера же, в архиве Guy Steele:
upd2: Зато в .NET нет unordered container (set-а), и такие клёвые Find()/FindAll() не существуют в IList. Отстой!
В C# 2.0 есть closures (у Джо Уолнса). Прочитано у классика. У него достаточно немного коротких статей и их все стоит прочесть.
Обратите внимание на область видимости переменных:
public List<Employee> HighPaid(List<Employee> emps) {
int threshold = 150;
return emps.FindAll(delegate(Employee e) {
return e.Salary > threshold;
});
}
Ушёл upd: интересная цитата об аргументах против closures в Java - о выделении памяти. По ссылке от Фаулера же, в архиве Guy Steele:
One of the early design principles of Java was that heap allocation occurrs if and only if a construct involving the "new" keyword is executed. Adding full-blown closures violated this design principle. (Dynamic class loading also violated the principle, but users seemed to be comfortable with that, perhaps because they believed that "once the computation got going" no more heap allocation would occur.)
Other features for Java release 1.5 will perform certain kinds of autoboxing, which also violates the design principle. This fact will make it easier to argue for restoring full-blown support for closures in the future.upd2: Зато в .NET нет unordered container (set-а), и такие клёвые Find()/FindAll() не существуют в IList. Отстой!
Tags:
(no subject)
6/9/06 15:01 (UTC)А предложение могучая кучка написала 18-го августа, так что знать о нём как таковом я не мог.