On 8/5/09 00:22, Jacob Carlborg wrote:
On 8/4/09 18:55, Steven Schveighoffer wrote:
On Tue, 04 Aug 2009 12:23:41 -0400, Andrei Alexandrescu
<seewebsiteforem...@erdani.org> wrote:
Steven Schveighoffer wrote:
On Tue, 04 Aug 2009 09:45:51 -0400, grauzone <n...@example.net> wrote:
Steven Schveighoffer wrote:
don't think it's worth adding them until we can have full
reflection capabilities so we can get at elements of code and
therefore get the annotations associated with it. I see much more
usefulness for annotations as reflection hints than as a
replacement for keywords.
But we already have full reflection. It's called __traits. You can
build a serialization library or "proper" (user friendly?)
reflection on top of it.
I think you are the 1 millionth person to say it, and yet we still do
not have a "user friendly" reflection system. Why is that? You'd
think that if it could be done, somebody would have done it by now.
The reality is there's quite few of us. D is not in the stage where if
something could be done, somebody somewhere has done it or is working
on it.
That's understandable, nobody can expect a language as young as D to
have everything.
But in reality, I think the *theory* that everything is there to build a
reflection system is only proven when it actually happens. I'm sure when
the enterprising person or persons go to develop it, they will find
pieces missing from the static reflection system.
So my point is that adding annotations before reflection works and is
implemented makes little sense to me, because the usage of them will be
crippled by the fact that reflection isn't complete.
What I'd like to see is something like this possible:
void foo (int timeout, string bar, float f = 4.0);
void foo(int timeout);
call!(foo)("timeout=5,bar=\"hello\"");
Taking into account the default value of f, what the parameters are
named, and which overload to call. I could certainly do it with C#.
-Steve
You mean like this: http://tango.pastebin.com/m129241b0 ?
/Jacob Carlborg
Forgot to say: this works in D1 with dmd, gdc and ldc.
/Jacob Carlborg