пятница, 5 февраля 2016 г.

#1193. Ссылка. Обновление кодогенерации

вторник, 2 февраля 2016 г.

#1191. YAGNI


#1190. Ссылка. Is it "compile-time injection" possible?

https://plus.google.com/u/0/+DavidBerneda/posts/WhyNCmdtzbe?cfem=1

"Is it "compile-time injection" possible? I was thinking on the ability to attribute for example a class with members that are defined outside that class, and the compiler will just accept them.

ie: type [Extend(TFooExtender)] TFoo=class end;
TFooExtender=class(TBaseExtender).... end;
TBar=record Num:Integer end;

To allow this at compile-time:

var foo : TFoo; foo.Bar.num:=42;

TFooExtender will return 'Bar' of type TBar as a valid member of TFoo, and the compiler will just accept it.

At runtime, TFooExtender is the one that "glues" foo and bar, so it will run just fine."

Я знаю, как сделать подобное с примесями. Только зачем?