Re: [Siop-development] Passing by value and by reference
Status: Pre-Alpha
Brought to you by:
slobberchops
From: Kevin S. <wx...@qu...> - 2006-07-03 14:31:11
|
On Thu, 2006-06-29 at 00:43 -0700, Rapheal Kaplan wrote: > I've added a "ref" and "val"... err... modifier? Not sure what to call > them. Seems ok. > Remember, scalar values are passed by value by default while collections are > passed by reference by default. Still sounds irritating to me, as one who is constantly fuming about the scalar/object distinction in Java. Maybe this wouldn't be so bad, since as I mentioned Ruby passes ints by reference but they appear to be passed by value since they are immutable. > Now it's a little easier: > > > # Helper method to define Python class > # In the future, may provide helper library to do this > def pyclass( name, *parents, &definition ) > klass = $types.ClassType( name.to_s, > Siop::val( Siop::Tuple( *parents ) ), > Siop::val( {} ) > ) > klass.instance_eval &definition unless definition.nil? > klass > end I would hope that code like this would be part of the siop framework, at least at some point. You're not going to expect a siop user like me to write or maintain code like that, are you? I had a similar reaction to the wxRython snippets...they seemed to be a mix of generic and specific code. I don't want to see the sausage-making generic code. It's all about encapsulating the icky parts into the framework so clients like us can just use remote classes and objects as if they were local. Something like this would be cool: class MyApp < siop.remote_class(:wx, :App) def on_init # blah blah blah end end Kevin |