Re: Chances of D getting proper runtime reflection?

2011-08-25 Thread Jacob Carlborg
On 2011-08-25 05:31, Martin Nowak wrote: Not sure, I get what you mean. Let me try to clarify this: static Serializeable[TypeInfo] infos; void register(T)() { infos[typeid(T)] = new SerializableImpl!T(); } // Serializable binds static reflection to dynamic interface class SerializeableImpl!T

Re: Chances of D getting proper runtime reflection?

2011-08-25 Thread Jacob Carlborg
On 2011-08-25 06:30, Martin Nowak wrote: It is actually already possible to store meta data in classinfos. --- import std.stdio; class A { int a; float b; } mixin template register(T) if(is(T == class)) { static this() { T.classinfo.m_offTi = [OffsetTypeInfo(0, typeid(int)), OffsetTypeInfo(4,

Re: Chances of D getting proper runtime reflection?

2011-08-24 Thread Martin Nowak
It is actually already possible to store meta data in classinfos. --- import std.stdio; class A { int a; float b; } mixin template register(T) if(is(T == class)) { static this() { T.classinfo.m_offTi = [OffsetTypeInfo(0, typeid(int)), OffsetTypeInfo(4, typeid(float))]; } } mixin

Re: Chances of D getting proper runtime reflection?

2011-08-24 Thread Martin Nowak
On Wed, 24 Aug 2011 08:49:19 +0200, Jacob Carlborg wrote: On 2011-08-24 01:34, Martin Nowak wrote: On Tue, 23 Aug 2011 17:03:12 +0200, Jacob Carlborg wrote: On 2011-08-23 16:38, Andrei Alexandrescu wrote: On 8/23/11 12:55 AM, Jacob Carlborg wrote: On 2011-08-23 08:52, Andrei Alexandrescu

Re: Chances of D getting proper runtime reflection?

2011-08-24 Thread Jacob Carlborg
On 2011-08-24 10:10, Marco Leise wrote: Then I'll clearly use Orange when I have a need for serialization. Nice work! Thanks. I've taken a closer look at http://dsource.org/projects/orange/wiki/Features and I see that versioning is still missing. What are your plans there? What happens at the

Re: Chances of D getting proper runtime reflection?

2011-08-24 Thread Marco Leise
Am 24.08.2011, 08:58 Uhr, schrieb Jacob Carlborg : On 2011-08-24 08:41, Marco Leise wrote: Am 23.08.2011, 19:42 Uhr, schrieb jdrewsen : Den 23-08-2011 17:03, Jacob Carlborg skrev: On 2011-08-23 16:38, Andrei Alexandrescu wrote: On 8/23/11 12:55 AM, Jacob Carlborg wrote: On 2011-08-23 08:52

Re: Chances of D getting proper runtime reflection?

2011-08-24 Thread Jacob Carlborg
On 2011-08-24 08:41, Marco Leise wrote: Am 23.08.2011, 19:42 Uhr, schrieb jdrewsen : Den 23-08-2011 17:03, Jacob Carlborg skrev: On 2011-08-23 16:38, Andrei Alexandrescu wrote: On 8/23/11 12:55 AM, Jacob Carlborg wrote: On 2011-08-23 08:52, Andrei Alexandrescu wrote: On 8/22/11 11:30 PM, Ja

Re: Chances of D getting proper runtime reflection?

2011-08-23 Thread Jacob Carlborg
On 2011-08-24 01:34, Martin Nowak wrote: On Tue, 23 Aug 2011 17:03:12 +0200, Jacob Carlborg wrote: On 2011-08-23 16:38, Andrei Alexandrescu wrote: On 8/23/11 12:55 AM, Jacob Carlborg wrote: On 2011-08-23 08:52, Andrei Alexandrescu wrote: On 8/22/11 11:30 PM, Jacob Carlborg wrote: Ok, then

Re: Chances of D getting proper runtime reflection?

2011-08-23 Thread Jacob Carlborg
On 2011-08-23 19:42, jdrewsen wrote: Den 23-08-2011 17:03, Jacob Carlborg skrev: On 2011-08-23 16:38, Andrei Alexandrescu wrote: On 8/23/11 12:55 AM, Jacob Carlborg wrote: On 2011-08-23 08:52, Andrei Alexandrescu wrote: On 8/22/11 11:30 PM, Jacob Carlborg wrote: Ok, then I just change "regis

Re: Chances of D getting proper runtime reflection?

2011-08-23 Thread Marco Leise
Am 23.08.2011, 19:42 Uhr, schrieb jdrewsen : Den 23-08-2011 17:03, Jacob Carlborg skrev: On 2011-08-23 16:38, Andrei Alexandrescu wrote: On 8/23/11 12:55 AM, Jacob Carlborg wrote: On 2011-08-23 08:52, Andrei Alexandrescu wrote: On 8/22/11 11:30 PM, Jacob Carlborg wrote: Ok, then I just chan

Re: Chances of D getting proper runtime reflection?

2011-08-23 Thread Martin Nowak
On Tue, 23 Aug 2011 17:03:12 +0200, Jacob Carlborg wrote: On 2011-08-23 16:38, Andrei Alexandrescu wrote: On 8/23/11 12:55 AM, Jacob Carlborg wrote: On 2011-08-23 08:52, Andrei Alexandrescu wrote: On 8/22/11 11:30 PM, Jacob Carlborg wrote: Ok, then I just change "register" to a static metho

Re: Chances of D getting proper runtime reflection?

2011-08-23 Thread jdrewsen
Den 23-08-2011 17:03, Jacob Carlborg skrev: On 2011-08-23 16:38, Andrei Alexandrescu wrote: On 8/23/11 12:55 AM, Jacob Carlborg wrote: On 2011-08-23 08:52, Andrei Alexandrescu wrote: On 8/22/11 11:30 PM, Jacob Carlborg wrote: Ok, then I just change "register" to a static method. A static me

Re: Chances of D getting proper runtime reflection?

2011-08-23 Thread Jacob Carlborg
On 2011-08-23 16:38, Andrei Alexandrescu wrote: On 8/23/11 12:55 AM, Jacob Carlborg wrote: On 2011-08-23 08:52, Andrei Alexandrescu wrote: On 8/22/11 11:30 PM, Jacob Carlborg wrote: Ok, then I just change "register" to a static method. A static method of whom? Andrei Well, "register" curr

Re: Chances of D getting proper runtime reflection?

2011-08-23 Thread Andrei Alexandrescu
On 8/23/11 12:55 AM, Jacob Carlborg wrote: On 2011-08-23 08:52, Andrei Alexandrescu wrote: On 8/22/11 11:30 PM, Jacob Carlborg wrote: Ok, then I just change "register" to a static method. A static method of whom? Andrei Well, "register" currently an instance method of Serializer so I would

Re: Chances of D getting proper runtime reflection?

2011-08-23 Thread Jacob Carlborg
On 2011-08-23 08:52, Andrei Alexandrescu wrote: On 8/22/11 11:30 PM, Jacob Carlborg wrote: On 2011-08-22 22:26, Andrei Alexandrescu wrote: Yes. Better yet: class Derived : Base { ... } mixin(serializable!Derived()); i.e. so you can add serialization to classes you can't edit. Yeah, of cou

Re: Chances of D getting proper runtime reflection?

2011-08-22 Thread Andrei Alexandrescu
On 8/22/11 11:30 PM, Jacob Carlborg wrote: On 2011-08-22 22:26, Andrei Alexandrescu wrote: Yes. Better yet: class Derived : Base { ... } mixin(serializable!Derived()); i.e. so you can add serialization to classes you can't edit. Yeah, of course. So "The line of code needs to be declarative

Re: Chances of D getting proper runtime reflection?

2011-08-22 Thread Jacob Carlborg
On 2011-08-22 22:00, Timon Gehr wrote: On 08/22/2011 09:19 PM, Jacob Carlborg wrote: On 2011-08-22 21:08, Andrei Alexandrescu wrote: On 8/21/11 6:03 PM, dsimcha wrote: On 8/21/2011 6:35 PM, Andrei Alexandrescu wrote: On 8/21/11 1:19 PM, Jacob Carlborg wrote: On 2011-08-21 17:30, Robert Clips

Re: Chances of D getting proper runtime reflection?

2011-08-22 Thread Jacob Carlborg
On 2011-08-22 22:27, Andrei Alexandrescu wrote: On 8/22/11 2:22 PM, Jacob Carlborg wrote: On 2011-08-22 21:16, Andrei Alexandrescu wrote: FWIW I don't think D should pay the cost of reflection up-front and compulsively for all types. So ClassInfo.getMembers is there because? At this point t

Re: Chances of D getting proper runtime reflection?

2011-08-22 Thread Jacob Carlborg
On 2011-08-22 22:26, Andrei Alexandrescu wrote: Yes. Better yet: class Derived : Base { ... } mixin(serializable!Derived()); i.e. so you can add serialization to classes you can't edit. Yeah, of course. So "The line of code needs to be declarative, not imperative" was just a fancy way of sa

Re: Chances of D getting proper runtime reflection?

2011-08-22 Thread Andrei Alexandrescu
On 8/22/11 2:22 PM, Jacob Carlborg wrote: On 2011-08-22 21:16, Andrei Alexandrescu wrote: FWIW I don't think D should pay the cost of reflection up-front and compulsively for all types. So ClassInfo.getMembers is there because? At this point the implementation is unclear on what should and w

Re: Chances of D getting proper runtime reflection?

2011-08-22 Thread Andrei Alexandrescu
On 8/22/11 2:19 PM, Jacob Carlborg wrote: On 2011-08-22 21:08, Andrei Alexandrescu wrote: On 8/21/11 6:03 PM, dsimcha wrote: On 8/21/2011 6:35 PM, Andrei Alexandrescu wrote: On 8/21/11 1:19 PM, Jacob Carlborg wrote: On 2011-08-21 17:30, Robert Clipsham wrote: On 21/08/2011 16:05, Jacob Carlb

Re: Chances of D getting proper runtime reflection?

2011-08-22 Thread Timon Gehr
On 08/22/2011 09:19 PM, Jacob Carlborg wrote: On 2011-08-22 21:08, Andrei Alexandrescu wrote: On 8/21/11 6:03 PM, dsimcha wrote: On 8/21/2011 6:35 PM, Andrei Alexandrescu wrote: On 8/21/11 1:19 PM, Jacob Carlborg wrote: On 2011-08-21 17:30, Robert Clipsham wrote: On 21/08/2011 16:05, Jacob C

Re: Chances of D getting proper runtime reflection?

2011-08-22 Thread Jacob Carlborg
On 2011-08-22 21:16, Andrei Alexandrescu wrote: FWIW I don't think D should pay the cost of reflection up-front and compulsively for all types. So ClassInfo.getMembers is there because? If David's code example is what you have, I don't think Orange got "making a class serializable" properly y

Re: Chances of D getting proper runtime reflection?

2011-08-22 Thread Jacob Carlborg
On 2011-08-22 21:08, Andrei Alexandrescu wrote: On 8/21/11 6:03 PM, dsimcha wrote: On 8/21/2011 6:35 PM, Andrei Alexandrescu wrote: On 8/21/11 1:19 PM, Jacob Carlborg wrote: On 2011-08-21 17:30, Robert Clipsham wrote: On 21/08/2011 16:05, Jacob Carlborg wrote: This is for a serialization lib

Re: Chances of D getting proper runtime reflection?

2011-08-22 Thread Andrei Alexandrescu
On 8/22/11 1:41 AM, Jacob Carlborg wrote: On 2011-08-22 00:35, Andrei Alexandrescu wrote: On 8/21/11 1:19 PM, Jacob Carlborg wrote: On 2011-08-21 17:30, Robert Clipsham wrote: On 21/08/2011 16:05, Jacob Carlborg wrote: This is for a serialization library where third party types need to be ser

Re: Chances of D getting proper runtime reflection?

2011-08-22 Thread Andrei Alexandrescu
On 8/21/11 6:03 PM, dsimcha wrote: On 8/21/2011 6:35 PM, Andrei Alexandrescu wrote: On 8/21/11 1:19 PM, Jacob Carlborg wrote: On 2011-08-21 17:30, Robert Clipsham wrote: On 21/08/2011 16:05, Jacob Carlborg wrote: This is for a serialization library where third party types need to be serializa

Re: Chances of D getting proper runtime reflection?

2011-08-22 Thread Jacob Carlborg
On 2011-08-22 13:27, Kagamin wrote: Jacob Carlborg Wrote: I already have a fully working serialization library. I'm hoping to make it better. The problem is when (de)serializing through a base class reference. Currently you need to register the subclass with the serializer. If T is Base and the

Re: Chances of D getting proper runtime reflection?

2011-08-22 Thread Jacob Carlborg
On 2011-08-22 13:37, Kagamin wrote: Jacob Carlborg Wrote: This is for a serialization library where third party types need to be serializable. I don't like the idea of annotate everything that should be serializable. I believe Adam Ruppe wrote serialization that works automatically. My libr

Re: Chances of D getting proper runtime reflection?

2011-08-22 Thread Kagamin
Jacob Carlborg Wrote: > This is for a serialization library where third party types need to be > serializable. I don't like the idea of annotate everything that should > be serializable. I believe Adam Ruppe wrote serialization that works automatically.

Re: Chances of D getting proper runtime reflection?

2011-08-22 Thread Kagamin
Jacob Carlborg Wrote: > I already have a fully working serialization library. I'm hoping to make > it better. The problem is when (de)serializing through a base class > reference. Currently you need to register the subclass with the > serializer. If T is Base and the actually runtime type is Su

Re: Chances of D getting proper runtime reflection?

2011-08-21 Thread Jacob Carlborg
On 2011-08-22 02:43, Robert Jacques wrote: On Sun, 21 Aug 2011 11:20:14 -0400, Jacob Carlborg wrote: On 2011-08-21 15:20, Robert Jacques wrote: On Sun, 21 Aug 2011 06:55:52 -0400, Jacob Carlborg wrote: What are the chances of D getting proper runtime reflection? Something like this: class

Re: Chances of D getting proper runtime reflection?

2011-08-21 Thread Jacob Carlborg
On 2011-08-22 00:35, Andrei Alexandrescu wrote: On 8/21/11 1:19 PM, Jacob Carlborg wrote: On 2011-08-21 17:30, Robert Clipsham wrote: On 21/08/2011 16:05, Jacob Carlborg wrote: This is for a serialization library where third party types need to be serializable. I don't like the idea of annotat

Re: Chances of D getting proper runtime reflection?

2011-08-21 Thread Jacob Carlborg
On 2011-08-21 21:43, Vladimir Panteleev wrote: On Sun, 21 Aug 2011 21:21:05 +0300, Jacob Carlborg wrote: Would that be possible to do for third party types available in a pre-compiled library? If said types are in the .di files, sure, why not? Otherwise, the answer is obvious... but as some

Re: Chances of D getting proper runtime reflection?

2011-08-21 Thread Jacob Carlborg
On 2011-08-21 21:07, Mehrdad wrote: On 8/21/2011 3:55 AM, Jacob Carlborg wrote: What are the chances of D getting proper runtime reflection? Something like this: class Foo { private int a; private void bar (int i) { a = i; } } auto foo = new Foo; Object o = foo; o.setInstanceVariable("

Re: Chances of D getting proper runtime reflection?

2011-08-21 Thread Robert Jacques
On Sun, 21 Aug 2011 11:20:14 -0400, Jacob Carlborg wrote: On 2011-08-21 15:20, Robert Jacques wrote: On Sun, 21 Aug 2011 06:55:52 -0400, Jacob Carlborg wrote: What are the chances of D getting proper runtime reflection? Something like this: class Foo { private int a; private void bar (int

Re: Chances of D getting proper runtime reflection?

2011-08-21 Thread dsimcha
On 8/21/2011 6:35 PM, Andrei Alexandrescu wrote: On 8/21/11 1:19 PM, Jacob Carlborg wrote: On 2011-08-21 17:30, Robert Clipsham wrote: On 21/08/2011 16:05, Jacob Carlborg wrote: This is for a serialization library where third party types need to be serializable. I don't like the idea of annota

Re: Chances of D getting proper runtime reflection?

2011-08-21 Thread Andrei Alexandrescu
On 8/21/11 1:19 PM, Jacob Carlborg wrote: On 2011-08-21 17:30, Robert Clipsham wrote: On 21/08/2011 16:05, Jacob Carlborg wrote: This is for a serialization library where third party types need to be serializable. I don't like the idea of annotate everything that should be serializable. You d

Re: Chances of D getting proper runtime reflection?

2011-08-21 Thread Vladimir Panteleev
On Sun, 21 Aug 2011 21:21:05 +0300, Jacob Carlborg wrote: Would that be possible to do for third party types available in a pre-compiled library? If said types are in the .di files, sure, why not? Otherwise, the answer is obvious... but as someone else mentioned in this thread, if the aut

Re: Chances of D getting proper runtime reflection?

2011-08-21 Thread Adam D. Ruppe
On Sun, Aug 21, 2011 at 12:07:17PM -0700, Mehrdad wrote: > http://stackoverflow.com/questions/7102648/using-dynamic-typing-in-d-a-statically-typed-language There's an easy "fix" for that question: blah opDispatch(string name)(blah) if ( name != "popFront" ) { }

Re: Chances of D getting proper runtime reflection?

2011-08-21 Thread Mehrdad
On 8/21/2011 3:55 AM, Jacob Carlborg wrote: What are the chances of D getting proper runtime reflection? Something like this: class Foo { private int a; private void bar (int i) { a = i; } } auto foo = new Foo; Object o = foo; o.setInstanceVariable("a",

Re: Chances of D getting proper runtime reflection?

2011-08-21 Thread Jacob Carlborg
On 2011-08-21 18:18, Jakob Ovrum wrote: On 2011/08/21 22:13, Vladimir Panteleev wrote: On Sun, 21 Aug 2011 15:16:11 +0300, Jacob Carlborg wrote: Yes, I know. But the point is to be able to do it without the use of mixins. It needs to work with third party types, otherwise there no use. It als

Re: Chances of D getting proper runtime reflection?

2011-08-21 Thread Jacob Carlborg
On 2011-08-21 17:30, Vladimir Panteleev wrote: On Sun, 21 Aug 2011 18:05:20 +0300, Jacob Carlborg wrote: This is for a serialization library where third party types need to be serializable. I don't like the idea of annotate everything that should be serializable. I think you misunderstood wh

Re: Chances of D getting proper runtime reflection?

2011-08-21 Thread Jacob Carlborg
On 2011-08-21 17:30, Robert Clipsham wrote: On 21/08/2011 16:05, Jacob Carlborg wrote: This is for a serialization library where third party types need to be serializable. I don't like the idea of annotate everything that should be serializable. You don't need to annotate it: void serialize(T

Re: Chances of D getting proper runtime reflection?

2011-08-21 Thread Jakob Ovrum
On 2011/08/21 22:13, Vladimir Panteleev wrote: On Sun, 21 Aug 2011 15:16:11 +0300, Jacob Carlborg wrote: Yes, I know. But the point is to be able to do it without the use of mixins. It needs to work with third party types, otherwise there no use. It also needs to work when the static type is O

Re: Chances of D getting proper runtime reflection?

2011-08-21 Thread Robert Clipsham
On 21/08/2011 14:13, Vladimir Panteleev wrote: On Sun, 21 Aug 2011 15:16:11 +0300, Jacob Carlborg wrote: Yes, I know. But the point is to be able to do it without the use of mixins. It needs to work with third party types, otherwise there no use. It also needs to work when the static type is O

Re: Chances of D getting proper runtime reflection?

2011-08-21 Thread Robert Clipsham
On 21/08/2011 16:05, Jacob Carlborg wrote: This is for a serialization library where third party types need to be serializable. I don't like the idea of annotate everything that should be serializable. You don't need to annotate it: void serialize(T)(T something); You have access to all the C

Re: Chances of D getting proper runtime reflection?

2011-08-21 Thread Vladimir Panteleev
On Sun, 21 Aug 2011 18:05:20 +0300, Jacob Carlborg wrote: This is for a serialization library where third party types need to be serializable. I don't like the idea of annotate everything that should be serializable. I think you misunderstood what I meant. I did not imply that one would

Re: Chances of D getting proper runtime reflection?

2011-08-21 Thread Jacob Carlborg
On 2011-08-21 15:20, Robert Jacques wrote: On Sun, 21 Aug 2011 06:55:52 -0400, Jacob Carlborg wrote: What are the chances of D getting proper runtime reflection? Something like this: class Foo { private int a; private void bar (int i) { a = i; } } auto foo = new Foo; Object o = foo

Re: Chances of D getting proper runtime reflection?

2011-08-21 Thread Jacob Carlborg
On 2011-08-21 15:13, Vladimir Panteleev wrote: On Sun, 21 Aug 2011 15:16:11 +0300, Jacob Carlborg wrote: Yes, I know. But the point is to be able to do it without the use of mixins. It needs to work with third party types, otherwise there no use. It also needs to work when the static type is O

Re: Chances of D getting proper runtime reflection?

2011-08-21 Thread Jacob Carlborg
On 2011-08-21 14:55, Marco Leise wrote: Am 21.08.2011, 14:11 Uhr, schrieb Jacob Carlborg : BTW, you're already paying for the class info. That could be a necessity of D's OOP implementation to fulfill the specification and while it is there that data was exported. Delphi used to have a compil

Re: Chances of D getting proper runtime reflection?

2011-08-21 Thread Vladimir Panteleev
On Sun, 21 Aug 2011 16:31:14 +0300, Alex Rønne Petersen wrote: I really don't think this is a valid cause of concern in this day and age. Perhaps not for you. Look at Java and .NET. They're doing just fine even with all metadata being available. And that's why obfuscators exist. Plen

Re: Chances of D getting proper runtime reflection?

2011-08-21 Thread Alex Rønne Petersen
On 21-08-2011 15:13, Vladimir Panteleev wrote: On Sun, 21 Aug 2011 15:16:11 +0300, Jacob Carlborg wrote: Yes, I know. But the point is to be able to do it without the use of mixins. It needs to work with third party types, otherwise there no use. It also needs to work when the static type is O

Re: Chances of D getting proper runtime reflection?

2011-08-21 Thread Robert Jacques
On Sun, 21 Aug 2011 06:55:52 -0400, Jacob Carlborg wrote: What are the chances of D getting proper runtime reflection? Something like this: class Foo { private int a; private void bar (int i) { a = i; } } auto foo = new Foo; Object o = foo; o.setInstanceVariable

Re: Chances of D getting proper runtime reflection?

2011-08-21 Thread Vladimir Panteleev
On Sun, 21 Aug 2011 15:16:11 +0300, Jacob Carlborg wrote: Yes, I know. But the point is to be able to do it without the use of mixins. It needs to work with third party types, otherwise there no use. It also needs to work when the static type is Object. You're already paying for the class

Re: Chances of D getting proper runtime reflection?

2011-08-21 Thread Marco Leise
Am 21.08.2011, 14:11 Uhr, schrieb Jacob Carlborg : BTW, you're already paying for the class info. That could be a necessity of D's OOP implementation to fulfill the specification and while it is there that data was exported. Delphi used to have a compiler switch to include RTTI. (If I reme

Re: Chances of D getting proper runtime reflection?

2011-08-21 Thread Jacob Carlborg
On 2011-08-21 13:42, Robert Clipsham wrote: On 21/08/2011 11:55, Jacob Carlborg wrote: What are the chances of D getting proper runtime reflection? Something like this: class Foo { private int a; private void bar (int i) { a = i; } } auto foo = new Foo; Object o = foo; o.setInstanceVariable

Re: Chances of D getting proper runtime reflection?

2011-08-21 Thread Jacob Carlborg
On 2011-08-21 13:41, bearophile wrote: Jacob Carlborg: class Foo { private int a; private void bar (int i) { a = i; } } auto foo = new Foo; Object o = foo; o.setInstanceVariable("a", 3); assert(foo.a == 3); Is this related to the Delphi feature I've recentl

Re: Chances of D getting proper runtime reflection?

2011-08-21 Thread Robert Clipsham
On 21/08/2011 11:55, Jacob Carlborg wrote: What are the chances of D getting proper runtime reflection? Something like this: class Foo { private int a; private void bar (int i) { a = i; } } auto foo = new Foo; Object o = foo; o.setInstanceVariable("a", 3); assert(foo.a == 3); Thi

Re: Chances of D getting proper runtime reflection?

2011-08-21 Thread bearophile
Jacob Carlborg: > class Foo > { > private int a; > > private void bar (int i) > { > a = i; > } > } > > auto foo = new Foo; > Object o = foo; > o.setInstanceVariable("a", 3); > assert(foo.a == 3); Is this related to the Delphi feature I've recently shown? http://blog

Chances of D getting proper runtime reflection?

2011-08-21 Thread Jacob Carlborg
What are the chances of D getting proper runtime reflection? Something like this: class Foo { private int a; private void bar (int i) { a = i; } } auto foo = new Foo; Object o = foo; o.setInstanceVariable("a", 3); assert(foo.a == 3); This would be usef