Re: Idea for @annotations

2011-08-13 Thread soywiz
I really like the idea of annotations to use in traits (compile-time-pseudoreflection). I have the following code: http://code.google.com/p/pspemu/source/browse/trunk/src/pspemu/hle/kd/rtc/sceRtc.d Each function has associated a NID. And I have to specify the NID outside, repeating the name

Re: Idea for @annotations

2011-08-01 Thread KennyTM~
On Aug 1, 11 13:42, %u wrote: An idea for a potential use of annotations: How about being able to annotate _anything_ with a template? It would be the equivalent of Python's annotations: the template's first parameter would be an alias to the thing being annotated, and its return value would

Re: Idea for @annotations

2011-08-01 Thread Peter Alexander
On 1/08/11 6:42 AM, %u wrote: An idea for a potential use of annotations: How about being able to annotate _anything_ with a template? What problem does this solve? Is it just syntax sugar? If so, is it worth complicating the language even more for this convenience?

Re: Idea for @annotations

2011-08-01 Thread Jacob Carlborg
On 2011-08-01 07:42, %u wrote: An idea for a potential use of annotations: How about being able to annotate _anything_ with a template? It would be the equivalent of Python's annotations: the template's first parameter would be an alias to the thing being annotated, and its return value would

Re: Idea for @annotations

2011-08-01 Thread Jacob Carlborg
On 2011-08-01 09:00, KennyTM~ wrote: On Aug 1, 11 13:42, %u wrote: An idea for a potential use of annotations: How about being able to annotate _anything_ with a template? It would be the equivalent of Python's annotations: the template's first parameter would be an alias to the thing being

Re: Idea for @annotations

2011-08-01 Thread Mehrdad
On 8/1/2011 12:00 AM, KennyTM~ wrote: On Aug 1, 11 13:42, %u wrote: mixin memoize!(function int(int n) { ... }); I believe you mean alias memoize!(that function) fib; Yeah, same difference. :) Also, self-reference should be handled: @memoize ulong fib(ulong n) { return

Re: Idea for @annotations

2011-08-01 Thread bearophile
%u: An idea for a potential use of annotations: In my mind the main purpose of user-defined annotations is to allow the user to write small (scoped) extensions to the type system. But Python-style annotations too are useful. Bye, bearophile

Idea for @annotations

2011-07-31 Thread %u
An idea for a potential use of annotations: How about being able to annotate _anything_ with a template? It would be the equivalent of Python's annotations: the template's first parameter would be an alias to the thing being annotated, and its return value would be the code generated for that