Re: UCFS, Reflection/Metadata, Overload Resolution, Templates, and other issues

2011-04-12 Thread %u
 Well, 5155 is fairly simple. The bug report details four one line
changes to Object.di and Object_.d. See
http://d.puremagic.com/issues/show_bug.cgi?id=5155
Also, If that doesn't do the trick, please e-mail me as I would like
to fix the root cause. (And let you test the library)

Oops sorry, I got a bit busier these couple of days and totally forgot
about this. I'll try to come back to it in the near future, and I'll
let you know if I have any success/failure.

Thanks for the info! :)


Re: UCFS, Reflection/Metadata, Overload Resolution, Templates, and other issues

2011-04-10 Thread Robert Jacques

On Sat, 09 Apr 2011 18:08:58 -0400, %u wfunct...@hotmail.com wrote:

Sorry. It was late and I forgot to mention some things. A) My code is  
dependent on patch 5155, and B) I forgot about
changes, etc, that I had to make to go from DMD 2.051 to DMD 2.052. I've  
uploaded my current working copy and remade the
docs. Let me know if you have any issues with this. (And please include  
a brief description of what/how you're building
it: i.e. dmd 2.052, debug mode, etc) Also, if you want to try my updated  
std.json, it requires a few more patches, each

listed at the top of the file.



Whoops my bad. I'm using DMD 2.052, the version on the website, to  
compile variant.d. I tried recompiling the file
(standalone) and got the same error again; I suspect it's because of the  
patch 5155 you mentioned, which I haven't

applied.
I'm actually not familiar with the patching system yet, so I'll try to  
use your file when I find a bit more time to

figure it out.

Thanks! :)


Well, 5155 is fairly simple. The bug report details four one line changes  
to Object.di and Object_.d. See  
http://d.puremagic.com/issues/show_bug.cgi?id=5155
Also, If that doesn't do the trick, please e-mail me as I would like to  
fix the root cause. (And let you test the library)


Re: UCFS, Reflection/Metadata, Overload Resolution, Templates, and other issues

2011-04-09 Thread %u
Thanks for the link!

I tried compiling the file, and I got these errors:

variant.d(454): Warning: statement is not reachable
variant.d(454): Warning: statement is not reachable
variant.d(454): Warning: statement is not reachable
variant.d(634): Warning: statement is not reachable
variant.d(660): Warning: statement is not reachable
variant.d(337): Error: template variant.Variant.Box.opAssign(A : Variant) does 
not match any function template declaration
variant.d(337): Error: template variant.Variant.Box.opAssign(A : Variant) 
cannot deduce template function from argument types !
()(char[])
variant.d(612): Error: template instance variant.Variant.Box.opAssign!(char[]) 
error instantiating
variant.d(1041): instantiated from here: __vtableOf!(char[])
variant.d(605): instantiated from here: opAssign!(char[])
variant.d(757): instantiated from here: SaveResult!(char[])
... (23 instantiations, -v to show) ...
variant.d(376): instantiated from here: SaveResult!(TypeInfo)
variant.d(351): instantiated from here: __vtableOf!(void)

Any ideas how I should fix them?


Re: UCFS, Reflection/Metadata, Overload Resolution, Templates, and other issues

2011-04-09 Thread Robert Jacques

On Sat, 09 Apr 2011 04:07:11 -0400, %u wfunct...@hotmail.com wrote:


Thanks for the link!

I tried compiling the file, and I got these errors:

variant.d(454): Warning: statement is not reachable
variant.d(454): Warning: statement is not reachable
variant.d(454): Warning: statement is not reachable
variant.d(634): Warning: statement is not reachable
variant.d(660): Warning: statement is not reachable
variant.d(337): Error: template variant.Variant.Box.opAssign(A :  
Variant) does not match any function template declaration
variant.d(337): Error: template variant.Variant.Box.opAssign(A :  
Variant) cannot deduce template function from argument types !

()(char[])
variant.d(612): Error: template instance  
variant.Variant.Box.opAssign!(char[]) error instantiating

variant.d(1041): instantiated from here: __vtableOf!(char[])
variant.d(605): instantiated from here: opAssign!(char[])
variant.d(757): instantiated from here: SaveResult!(char[])
... (23 instantiations, -v to show) ...
variant.d(376): instantiated from here: SaveResult!(TypeInfo)
variant.d(351): instantiated from here: __vtableOf!(void)

Any ideas how I should fix them?


Sorry. It was late and I forgot to mention some things. A) My code is  
dependent on patch 5155, and B) I forgot about changes, etc, that I had to  
make to go from DMD 2.051 to DMD 2.052. I've uploaded my current working  
copy and remade the docs. Let me know if you have any issues with this.  
(And please include a brief description of what/how you're building it:  
i.e. dmd 2.052, debug mode, etc) Also, if you want to try my updated  
std.json, it requires a few more patches, each listed at the top of the  
file.


Re: UCFS, Reflection/Metadata, Overload Resolution, Templates, and other issues

2011-04-09 Thread %u
 Sorry. It was late and I forgot to mention some things. A) My code is 
 dependent on patch 5155, and B) I forgot about
changes, etc, that I had to make to go from DMD 2.051 to DMD 2.052. I've 
uploaded my current working copy and remade the
docs. Let me know if you have any issues with this. (And please include a brief 
description of what/how you're building
it: i.e. dmd 2.052, debug mode, etc) Also, if you want to try my updated 
std.json, it requires a few more patches, each
listed at the top of the file.



Whoops my bad. I'm using DMD 2.052, the version on the website, to compile 
variant.d. I tried recompiling the file
(standalone) and got the same error again; I suspect it's because of the patch 
5155 you mentioned, which I haven't
applied.
I'm actually not familiar with the patching system yet, so I'll try to use your 
file when I find a bit more time to
figure it out.

Thanks! :)


Re: UCFS, Reflection/Metadata, Overload Resolution, Templates, and other issues

2011-04-08 Thread %u
 I've added reflection capabilities to an update to std.variant I'm working 
 on. Overloads work.
General functions work. (Although a few bugs with opCall and opDispatch 
prevents the ideal syntax:
var.x(5) vs var.x = 5 and var.call(5) vs var(5), but I assume those will be 
eventually fixed). I've
also added an internal type database, so you can auto-magically build a 
Variant(TypeInfo, void*) or
Variant(Object) and then call methods on the real, underlying type.

Whoa nice. I'm eagerly waiting to see it. :)


 Templates, I think, will out of the range of dynamic D capabilities for some 
 time to come.

Yeah, 'cause I just realized they basically need you to implement the entire 
compiler.


UCFS, Reflection/Metadata, Overload Resolution, Templates, and other issues

2011-04-07 Thread %u
I was trying to write a Dynamic class for D, which uses opDispatch
to allow for late binding, but I ran into a problem:

While my class works well for regular methods inside a class, it
fails to work for:
(1) Template methods inside a class
(2) Methods with overloads
(3) Global methods that have nothing to do with a class, like
writeln
Furthermore, it would also fail to work for (4) UCFS if/when it's
implemented.

It seems like templates by design *don't* allow for anything to
happen dynamically, and at the same time, it seems like _everything_
is becoming a template nowadays.

So my question is, is there anything we can do about it (either now
or later)? Or is a dynamic extension simply beyond the reach of D?


Re: UCFS, Reflection/Metadata, Overload Resolution, Templates, and other issues

2011-04-07 Thread Steven Schveighoffer

On Thu, 07 Apr 2011 14:20:53 -0400, %u wfunct...@hotmail.com wrote:


I was trying to write a Dynamic class for D, which uses opDispatch
to allow for late binding, but I ran into a problem:

While my class works well for regular methods inside a class, it
fails to work for:
(1) Template methods inside a class
(2) Methods with overloads
(3) Global methods that have nothing to do with a class, like
writeln
Furthermore, it would also fail to work for (4) UCFS if/when it's
implemented.

It seems like templates by design *don't* allow for anything to
happen dynamically, and at the same time, it seems like _everything_
is becoming a template nowadays.

So my question is, is there anything we can do about it (either now
or later)? Or is a dynamic extension simply beyond the reach of D?


I tried a wrapper type using opDispatch in dcollections, but what I ran  
into is, opDispatch uses its called parameter types to decide the function  
parameter types, you have very little control over that.  I basically  
ended up abandoning the use of opDispatch and implemented each covered  
function by hand.


I filed an enhancement request for it, which probably doesn't cover  
everything you listed, but it might help:


http://d.puremagic.com/issues/show_bug.cgi?id=4998

-Steve


Re: UCFS, Reflection/Metadata, Overload Resolution, Templates, and other issues

2011-04-07 Thread %u
 I tried a wrapper type using opDispatch in dcollections, but what
I ran into is, opDispatch uses its called parameter types to decide
the function parameter types, you have very little control over that.
I basically ended up abandoning the use of opDispatch and implemented
each covered function by hand.

I managed to get this far (my file attached), using D-style runtime
variadic functions... it seems to work well in most cases, with the
notable exceptions being:
(1) Things I already mentioned
(2) Possibly ref/out/lazy parameters (I haven't tested them yet)

Any thoughts?
begin 644 std.dynamic.core.d
M;6]D=6QE('-T9YD6YA;6EC+F-OF4[#0H-G!R:79A=4@W1A=EC(EM
M]R=!S=0N86QG;W)I=AM.PT*')I=F%T92!I;7!OG0@8V]R92YE-E
M'1I;VXL('-T9YE-E'1I;VXL('-T9YT7!E='5P;4L('-T9YM971A
MW1R:6YGRP@W1D+G1R86ETRP@8V]R92YV87)AFL('-T9YS=1I;SL-
M@T*86)S=')A8W0@8VQAW,@1'EN86UI8PT*PT*7!R;W1E8W1E9!A8G-T
MF%C=!$6YA;6EC(EN=F]K92AS=')I;F@;65M8F5R+`N+BXI.PT*7!R
M;W1E8W1E9!T:ES*D@R!AW-EG0H='EP96ED*'1H:7,I($]('1Y5I
M9AT7!E;V8H=AIRDI*3L@?0T*7!U8FQI8R!$6YA;6EC(]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T*0D)
M0E[#0H)0D)0DO+W!R86=M82AMVL()!91I;F@;65M8F5R.B`B+!M
M96UB97(I.PT*0D)0D)875T;R!F;B`](9U;F-T:6]N($1Y;F%M:6,H1'EN
M86UI8T]F(2A4*2!I;G-T86YC92P@5'EP94EN9F];72!?87)G=6UE;G1S+!R
M968@=F%?;ES=!AF=S*0T*0D)0D)PT*0D)0D)6UIEN*$9OFUA
M=$H7LEPT*0D)0D)0EA=71O(')EW5L=`](ENW1A;F-E+F]B:BXE
MR@ERD[#0H)0D)0D)6%SV5R=A?87)G=6UE;G1S+FQE;F=T:`]/2!0
M87)A;65T97)47!E5'5P;4A*%1;BDN;5N9W1H*3L-@D)0D)0D)9F]R
M96%C:`H:2P@='EP93L@4%R86UE=5R5'EP951UQE(2A41FXI*0T*0D)
M0D)0E[(%SV5R=AIT1Y;F%M:6,H7V%R9W5M96YTUMI72D@/R!TG5E
M(#H@:7-686QI9$%R9W5M96YT*%]AF=U;65N='-;:5TL('1Y5I9AT7!E
M*2DI.R!]#0H)0D)0D)7)E='5R;B!N97@1'EN86UI8T]F(2A2971UFY4

Re: UCFS, Reflection/Metadata, Overload Resolution, Templates, and other issues

2011-04-07 Thread Caligo
What's UCFS?


Re: UCFS, Reflection/Metadata, Overload Resolution, Templates, and other issues

2011-04-07 Thread Robert Jacques

On Thu, 07 Apr 2011 14:20:53 -0400, %u wfunct...@hotmail.com wrote:


I was trying to write a Dynamic class for D, which uses opDispatch
to allow for late binding, but I ran into a problem:

While my class works well for regular methods inside a class, it
fails to work for:
(1) Template methods inside a class
(2) Methods with overloads
(3) Global methods that have nothing to do with a class, like
writeln
Furthermore, it would also fail to work for (4) UCFS if/when it's
implemented.

It seems like templates by design *don't* allow for anything to
happen dynamically, and at the same time, it seems like _everything_
is becoming a template nowadays.

So my question is, is there anything we can do about it (either now
or later)? Or is a dynamic extension simply beyond the reach of D?


I've added reflection capabilities to an update to std.variant I'm working  
on. Overloads work. General functions work. (Although a few bugs with  
opCall and opDispatch prevents the ideal syntax: var.x(5) vs var.x = 5 and  
var.call(5) vs var(5), but I assume those will be eventually fixed). I've  
also added an internal type database, so you can auto-magically build a  
Variant(TypeInfo, void*) or Variant(Object) and then call methods on the  
real, underlying type.


Templates, I think, will out of the range of dynamic D capabilities for  
some time to come.


Also, because I'm wrapping / unwrapping all arguments, ref doesn't work.