Re: Dynamic alter-ego of D.

2011-10-26 Thread Steven Schveighoffer
dynamicity, which in turn means, that one needs to give up on lots of sweet stuff like templates, overloading and string mixins. Variant is the first step towards dynamic alter-ego of D, which is completely undeveloped currently. Although my benchmarks show, that variant is quite slow and I'd really like

Re: Dynamic alter-ego of D.

2011-10-26 Thread Gor Gyolchanyan
like templates, overloading and string mixins. Variant is the first step towards dynamic alter-ego of D, which is completely undeveloped currently. Although my benchmarks show, that variant is quite slow and I'd really like a version of variant, optimized for ultimate performance. Also

Re: Dynamic alter-ego of D.

2011-10-26 Thread deadalnix
Le 25/10/2011 17:39, Gor Gyolchanyan a écrit : That's the point. You don't always need to carry around your type. Also because you might do it in a specific and very efficient way. Imposing a single way of storing the type is a very inflexible decision. The type check may also be done at

Re: Dynamic alter-ego of D.

2011-10-26 Thread Adam Ruppe
You can use opDispatch to make runtime methods and properties by having it forward to a function to do the lookup. Something alone these lines: DynamicObject delegate(DynamicObject[] args) dynamicFunctions; DynamicObject opDispatch(string name, T...)(T t) { if(name !in dynamicFunctions)

Re: Dynamic alter-ego of D.

2011-10-26 Thread Steven Schveighoffer
On Wed, 26 Oct 2011 10:15:33 -0400, Gor Gyolchanyan gor.f.gyolchan...@gmail.com wrote: 1. opDispatch is no good for overloading when the set of methods are defined at run-time. For those cases, you must use the runtime interface that opDispatch will use directly. D does not have a way to

Re: Dynamic alter-ego of D.

2011-10-26 Thread Gor Gyolchanyan
I know how opDispatch works. opDispatch is purely a syntax sugar (a really neat one, IMO). What I'm talking about is a way to choose between a set of functions, based on the parameters. It's basically dynamic overloading, but with additional ability to overload, based on values (much like template

Dynamic alter-ego of D.

2011-10-25 Thread Gor Gyolchanyan
, overloading and string mixins. Variant is the first step towards dynamic alter-ego of D, which is completely undeveloped currently. Although my benchmarks show, that variant is quite slow and I'd really like a version of variant, optimized for ultimate performance. Also, there are lots of stuff

Re: Dynamic alter-ego of D.

2011-10-25 Thread Piotr Szturmaj
of sweet stuff like templates, overloading and string mixins. Variant is the first step towards dynamic alter-ego of D, which is completely undeveloped currently. If Algebraic/Variant could be recognized by the language it would give some interesting possibilities, like Variant array literals: auto

Re: Dynamic alter-ego of D.

2011-10-25 Thread Gor Gyolchanyan
dynamicity, which in turn means, that one needs to give up on lots of sweet stuff like templates, overloading and string mixins. Variant is the first step towards dynamic alter-ego of D, which is completely undeveloped currently. If Algebraic/Variant could be recognized by the language it would

Re: Dynamic alter-ego of D.

2011-10-25 Thread Robert Jacques
and modularity means dynamicity, which in turn means, that one needs to give up on lots of sweet stuff like templates, overloading and string mixins. Variant is the first step towards dynamic alter-ego of D, which is completely undeveloped currently. If Algebraic/Variant could be recognized by the language

Re: Dynamic alter-ego of D.

2011-10-25 Thread Gor Gyolchanyan
templates, overloading and string mixins. Variant is the first step towards dynamic alter-ego of D, which is completely undeveloped currently. If Algebraic/Variant could be recognized by the language it would give some interesting possibilities, like Variant array literals: auto array = [10, 2.0

Re: Dynamic alter-ego of D.

2011-10-25 Thread Gor Gyolchanyan
app development is a very good practice and modularity means dynamicity, which in turn means, that one needs to give up on lots of sweet stuff like templates, overloading and string mixins. Variant is the first step towards dynamic alter-ego of D, which is completely undeveloped currently

Re: Dynamic alter-ego of D.

2011-10-25 Thread Robert Jacques
On Tue, 25 Oct 2011 09:23:10 -0400, Gor Gyolchanyan gor.f.gyolchan...@gmail.com wrote: I need an extremely fast and small typeless container for a single object, which i can use to implement a fast and efficient dynamic callback mechanism, where the exact number and types of parameters are only

Re: Dynamic alter-ego of D.

2011-10-25 Thread Gor Gyolchanyan
That's the point. You don't always need to carry around your type. Also because you might do it in a specific and very efficient way. Imposing a single way of storing the type is a very inflexible decision. The type check may also be done at different points, after which it's not necessary to

Re: Dynamic alter-ego of D.

2011-10-25 Thread Gor Gyolchanyan
another example is dynamic callbacks. You may carry around typeid of the function signature and a struct, containing parameter values for it, which also contains the typeid of it's target function's signature. If you don't impose type information on the typeless values, i will be able to check the

Re: Dynamic alter-ego of D.

2011-10-25 Thread Robert Jacques
On Tue, 25 Oct 2011 11:45:48 -0400, Gor Gyolchanyan gor.f.gyolchan...@gmail.com wrote: another example is dynamic callbacks. You may carry around typeid of the function signature and a struct, containing parameter values for it, which also contains the typeid of it's target function's

Re: Dynamic alter-ego of D.

2011-10-25 Thread Gor Gyolchanyan
So delegate don't work because? Delegates won't work this way because the parameters aren't bound and are of unknown quantity and types. What about unions? Unions allow only a limited number of types. Or casting a ptr into an array of raw bytes? This won't always work, because static