|
Re: adding methods to a class at runtime: msg#00112lang.smalltalk.squeak.beginners
Sure, but Smalltalkers wouldn't wait for the first run of the program to create the accessors. And, unlike Ruby, once you ran the create accessor code, the accessors would be part of the code that goes under version control. This is one of the big differences between Ruby and Smalltalk. In Smalltalk, there isn't much distinction between runtime and edit time. Technically, there isn't any distinction. Even when you are editing code, you are in some sense running the eventual application. In fact, Smalltalkers often keep their application running as they make changes. Take a look at: CreateAccessorsForVariableRefactoring Which you can invoke by right clicking on a class in the OmniBrowser and choosing "accessors for instvar". No reason you couldn't invoke such code at "runtime". On 8/13/07, Mark Volkmann <mark@xxxxxxxxxx> wrote: > Is it possible to write code that adds methods to a class at runtime. In > particular I'm thinking about something like attr_accessor in Ruby which > adds get and set methods for instance variables so you don't have to write > them. > > Thanks to everybody who has answered my questions so far! > > --- > Mark Volkmann > > > _______________________________________________ > Beginners mailing list > Beginners@xxxxxxxxxxxxxxxxxxxxxxxxxx > http://lists.squeakfoundation.org/mailman/listinfo/beginners > >
|
|
| <Prev in Thread] | Current Thread | [Next in Thread> |
|---|---|---|
| Previous by Date: | adding methods to a class at runtime, Mark Volkmann |
|---|---|
| Next by Date: | Re: Ubuntu Linux, Richard Eng |
| Previous by Thread: | adding methods to a class at runtime, Mark Volkmann |
| Next by Thread: | Re: adding methods to a class at runtime, Mark Volkmann |
| Indexes: | [Date] [Thread] [Top] [All Lists] |
| News | FAQ | advertise |