Hi guys,
Can anyone give me some pointers on how to create traits dynamically? I have tried something like: model := RBNamespace new. model defineClass: ('Trait named: #TMyTrait
uses: {} category: ''My-Tests'''). and I get a DNU: RBAddTraitChange>>superclassName
Cheers, -- Dr. Ciprian TEODOROV Ingénieur Développement CAO tél : 06 08 54 73 48 mail : [hidden email] www.teodorov.ro |
On Mar 8, 2013, at 7:57 PM, Ciprian Teodorov <[hidden email]> wrote: Hi guys, I know that one argentinian student added support for traits in RB but I never got the time to have a look and integrate it.
|
On Fri, Mar 8, 2013 at 10:32 PM, stephane ducasse <[hidden email]> wrote:
Yes something like it, I am little confused with all ring, rb stuff. But I know that I can build classes, add methods, and see changes (and apply them) using RBNamespace api... it does not seem to work with traits. Some time ago I have spend some time patching the RB thingy to accept trait also... but then I have run into other problems (i don't remember exactly what)... Moreover, it was just hacks to make it work... so I've lost them over time... and I don't like patching every new image that I download with my changes to make It work...
So maybe, I don't use them right... or there are things that should be done... I'm willing to contribute, if it helps.
cool, maybe we should have a look...
Then again, it is not clear in my head what is the politics of traits and pharo... I know that there were some discussions about them being bad because their methods are copied to classes, not being well integrated.... how exactly do they fit in the big picture (next pharo versions). Can we use them as they are now, or the implementation is likely to change in the near future? -- stateful traits, or something else?
cheers, ciprian
Dr. Ciprian TEODOROV Ingénieur Développement CAO tél : 06 08 54 73 48 mail : [hidden email] www.teodorov.ro |
On Mar 8, 2013, at 11:50 PM, Ciprian Teodorov <[hidden email]> wrote:
ring is simple: imagine that all the tools can manipulate objects that represent objects that get executed. for RB you have an engine to transform code. Now to programmatically create traits you do not need RB nor ring
No stateful traits in the horizon. For now traits will stay but we should have a look at the internal implementation to simplify it. Second the internal change should not impact external users and will be transparent.
|
In reply to this post by Ciprian Teodorov-3
how to create trait programmatically?
Here you go: trait := Trait named: #MyProgrammaticallyCreatedTrait. You can also do the same trick with classes, btw: newclass := Object subclass: #MyNewClass. ;) -- Best regards, Igor Stasenko. |
On Sat, Mar 9, 2013 at 4:00 PM, Igor Stasenko <[hidden email]> wrote: how to create trait programmatically? cool... ;) +igor but then why do we need changes and change classes ? but yeah I asked a stupid question ... the DNU is still there though
-- Dr. Ciprian TEODOROV Ingénieur Développement CAO tél : 06 08 54 73 48 mail : [hidden email] www.teodorov.ro |
On 9 March 2013 18:58, Ciprian Teodorov <[hidden email]> wrote:
that belongs to RB.. not Trait's problems. file a bug entry :)
-- Best regards, Igor Stasenko. |
Free forum by Nabble | Edit this page |