Hi all, please forgive me if this betrays a terrible level of ignorance on my part, but I think there is benefit to be had in runtime traits injection, to coin a phrase. I am writing software to enable back testing of stock trading strategies. Each strategy makes use of a selection of technical indicators, and each strategies combination of stratgies is usually different. I am writing the technical indicators as traits, which layer over a simple Tick class that has open, high, low, close and volume accessors to represent the stock data. I would prefer to inject the relevant traits as required by the individual strategy, instead of rolling all the traits into one class.
I'd just like to know what others think of traits being a compile time thing. And whether there might be value in mixing them in at runtime. I am also dimly aware of the potential for there being little different between compile time and runtime in smalltalk.
Thanks for listening.
Mike.
Hi Mike,
The only (forgivable) ignorance on your behalf is in making the distinction between compile time and runtime. There is no such thing in the 21st century. It is perfectly possible, well-motivated, and indeed likely to be trivial to add traits at runtime. You might have to create a new class for making this work but then again, this can happen at runtime (the eToy system uses this extensively to give you a prototype-feel in the environment). If you dig around just a little you'll probably find the messages that are needed to add traits dynamically.
And yes, you should be a little concerned. You have all the means you need to shoot yourself in the foot in entirely new and unforeseen ways. But hey, you asked for it, didn't you? ;-)
Cheers, - Andreas
Mike wrote:
Hi all, please forgive me if this betrays a terrible level of ignorance on my part, but I think there is benefit to be had in runtime traits injection, to coin a phrase. I am writing software to enable back testing of stock trading strategies. Each strategy makes use of a selection of technical indicators, and each strategies combination of stratgies is usually different. I am writing the technical indicators as traits, which layer over a simple Tick class that has open, high, low, close and volume accessors to represent the stock data. I would prefer to inject the relevant traits as required by the individual strategy, instead of rolling all the traits into one class.
I'd just like to know what others think of traits being a compile time thing. And whether there might be value in mixing them in at runtime. I am also dimly aware of the potential for there being little different between compile time and runtime in smalltalk.
Thanks for listening.
Mike.
Hi mike
Hi all, please forgive me if this betrays a terrible level of ignorance on my part, but I think there is benefit to be had in runtime traits injection, to coin a phrase. I am writing software to enable back testing of stock trading strategies. Each strategy makes use of a selection of technical indicators, and each strategies combination of stratgies is usually different. I am writing the technical indicators as traits, which layer over a simple Tick class that has open, high, low, close and volume accessors to represent the stock data. I would prefer to inject the relevant traits as required by the individual strategy, instead of rolling all the traits into one class.
Which traits are you talking? Self traits or Nathanael's one?
This is interesting. Could you show us some code of your current implementation?
I'd just like to know what others think of traits being a compile time thing.
Since now we simply trying to improve reuse with compile time composition (hence traits do not have any semantics at run-time)
And whether there might be value in mixing them in at runtime. I am also dimly aware of the potential for there being little different between compile time and runtime in smalltalk.
Thanks for listening.
thanks for telling :)
Mike.
On May 30, 2005, at 1:07 PM, stéphane ducasse wrote:
Hi mike
Hi all, please forgive me if this betrays a terrible level of ignorance on my part, but I think there is benefit to be had in runtime traits injection, to coin a phrase. I am writing software to enable back testing of stock trading strategies. Each strategy makes use of a selection of technical indicators, and each strategies combination of stratgies is usually different. I am writing the technical indicators as traits, which layer over a simple Tick class that has open, high, low, close and volume accessors to represent the stock data. I would prefer to inject the relevant traits as required by the individual strategy, instead of rolling all the traits into one class.
Which traits are you talking? Self traits or Nathanael's one?
Slate right now implements a reasonable subset of the latter with the former, and so can shift things around at run-time or on a per-object basis, but that is a matter of necessity (and we are interested in wiping out the basis on the former while still having most of its power).
I am sure that mike means the latter, though, since the former aren't known here.
squeak-dev@lists.squeakfoundation.org