Whoop I rad wrong,.... forget the asClass thing,... this would
really not work with a following perform:
What you intend to do here is really the become: thing.... Am 29.10.2010 20:23, schrieb Alexandre BP: thanks for your time, _______________________________________________ seaside mailing list [hidden email] http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside |
In reply to this post by SebastianHC
Great!
I didn't see John's reply but it's definitely the best way :) Thanks a lot everyone! I'll surely come with new problems as I'm new with smalltalk Regards, Alex
Date: Fri, 29 Oct 2010 20:43:49 +0200 From: [hidden email] To: [hidden email] Subject: Re: [Seaside] Dynamic typing in smalltalk As far as I can see there's no need for your loop. John's solution already provides you with a class in selectedType. Eventhough it isn't quite the way to do it. You forgot something here. Symbol new returns a Symbol: dynamicTyping :=
('PaperBibli', selectedType) asSymbol asClass.
bibEntry := PaperBibli
perform: dynamicTyping new.
asClass isn't nice because it take some while and there are more OO-solutions available. Try to get away from casting. Delegation is the answer. If you might need to keep your original Object, or, how to say this right now, whish or need to keep on using the memory space you could also use become: or becomeWith: Now this is really not the nice way to do it, but it schould also work. yourmessage: aPaperBibli ^PaperArticle new become: aPaperBibli Just to be mentioned... I would use John's approch, it's the most common. Sebastian Am 29.10.2010 20:23, schrieb Alexandre BP: thanks for your time, _______________________________________________ seaside mailing list [hidden email] http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside _______________________________________________ seaside mailing list [hidden email] http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside |
In reply to this post by Alexandre BP
Alexandre BP wrote: thanks for your time,Here you get a classname. Try something like "dynamicTyping perform #new." May be you must convert dynamicTyping to a real class (e.g. in VW with class QualifiedName)
--
mit freundlichen Grüßen / best regards,
_______________________________________________ seaside mailing list [hidden email] http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside |
Free forum by Nabble | Edit this page |