Am 06.11.2012 16:55, schrieb Jacob Carlborg: > On 2012-11-06 16:39, Walter Bright wrote: >> On 11/6/2012 5:04 AM, Jacob Carlborg wrote: >>> I agree, I a syntax like this would have been nicer: >>> >>> @mtype("key" : "value") int a; or @mtype(key : "value") int a; >>> @mtype("value") int b; >>> @mtype int c; >>> >> >> Part of what I was trying to do was minimizing inventing new syntaxes. >> The >> >> [ ArgumentList ] >> >> invents nothing new but the brackets. Your proposal is both a new >> syntax, and it can only do key/value pairs - nothing else. > > It depends on how you look at it. > > * @mtype - is the same syntax as the current syntax for attributes > * @mtype("key" : "value") - Uses the above in combination with the > syntax for associative array literals > > How about this then: > > @mtype("foo", 3, "bar") int a; > > And have the argument list be optional? I really like to have a short > nice looking syntax for the simple use cases, i.e. > > @mtype int b; >
+1 Also, if mtype is a template, it could naturally be @mtype!(1, 2, 3). Without the '!' it would be a function that is evaluated at CT. And just @mtype would yield an alias of mtype.