Short list with things to finish for D2
Don
nospam at nospam.com
Mon Nov 23 07:02:30 PST 2009
Lars T. Kyllingstad wrote:
> Bill Baxter wrote:
>> On Mon, Nov 23, 2009 at 3:12 AM, Don <nospam at nospam.com> wrote:
>>
>>>> This sounds like a job for better mixin syntax.
>>>> .
>>>> So let "template#(args)" be equivalent to "mixin(template!(args))".
>>>>
>>>> Then you can do
>>>>
>>>> auto statement = db.execute#(`select $visitcars.name from table where
>>>> $visitcars.id > 100 && $visitcars.surname Like "A*"`);
>>> Yeah, something like that. Or it could mixin automatically. eg if
>>> macro foo(args...)
>>> foo(args) meant mixin(foo(args)).
>>
>> This is what I've been thinking too.
>> But we might want there to be more to a macro than that. For instance
>> most macro parameters are strings and the '(string this, string that,
>> string theOther)', list of parameters doesn't look so great. And
>> requiring the strings to be quoted on the calling side, also makes the
>> call side rather ugly. It may be better to have arguments
>> automatically convert to some sort of AST type which supports some
>> introspection, and can be converted back to a string of code easily.
>>
>> So I think jumping on just making macro mean "mixin automatically"
>> right now may limit our future choices too much.
>
> I think the community has come to expect a lot more from the macro
> keyword. I, at least, would be disappointed if this is what comes out of
> it. :)
Oh, me too. But, this establishes a minimum. We've got a very long time
to get macros right.
>
> How about
>
> auto template MixMeInAutomatically(T) { ... }
>
> void main()
> {
> MixMeInAutomatically!int;
> ...
> }
>
> Would this be ambiguous? It would be using auto for something completely
> new, but it would at least make sense. (More so than macro, in my opinion.)
>
> -Lars
More information about the Digitalmars-d
mailing list