I like some short name on clear meaning. I googled "variable expansion" and "interpolation|interp" with some language names. There was no significant difference in result.
(I'm not a native English speaker. Please read follows with a grain of salt.) "interp" may remind us "interpolation(=variable expansion)", "interpolation(math)", and "interpreter". On the other hand, "expand" is more general word than "interp". So, I think that "interp" will be more better . Kenji 2010/11/2 Andrei Alexandrescu <[email protected]>: > Thanks, Kenji. All - ideas for a better name? "interp"? Full "interpolate"? > Leave it as "expand"? > > Andrei > > On 11/2/10 5:40 AM, kenji hara wrote: >> >> Thanks for your response, Andrei. >> >> I applied improvements that suggested from you. >> - Identifier expression currently does not require braces. >> - Interpolation expression is converted to string implicitly (with >> std.conv.to!string(...)). >> >> It is still not renamed to 'inter' in github, but I would to do it >> when committing to Phobos. >> >> Kenji Hara >> >> 2010/11/2 Andrei Alexandrescu<[email protected]>: >>> >>> This is great. It's funny I was thinking the same this morning before >>> having >>> looked over this message. >>> >>> As expansion using $xxx is called interpolation in Perl and probably >>> other >>> scripting languages I suggest we call the facility "inter". >>> >>> We can use it with writeln, which I think will be quite popular: >>> >>> int a = 2; >>> string b = "hello"; >>> writeln(mixin(inter!"I told you $a times: $str!")); >>> >>> As shown above, I also suggest that we don't require {} when the >>> expression >>> is an identifier. >>> >>> A debatable language change would allow us to eliminate "mixin", as it >>> has >>> been discussed in the newsgroup. A simpler and less dangerous change >>> would >>> be to make the paren optional: >>> >>> writeln(mixin inter!"I told you $a times: $str!"); >>> >>> >>> >>> Andrei >>> >>> On 10/31/10 10:50 AM, kenji hara wrote: >>>> >>>> I wrote a trivial utility template for generating code string. >>>> This provides some easiness and viewability of metaprogramming. >>>> (This is currently used in my adaptTo.) >>>> >>>> http://github.com/9rnsr/scrap/blob/master/expand/expand.d >>>> >>>> Sample: >>>> ---- >>>> template GenFunc(string name) >>>> { >>>> mixin( >>>> mixin(expand!q{ >>>> int ${name}(){ return 10; } >>>> })); >>>> // result of expand! is: >>>> // q{`int ` ~ name ~ `(){ return 10; }`} >>>> } >>>> mixin GenFunc!("test"); // generates function "test" returns int >>>> unittest{ >>>> assert(test() == 10); >>>> } >>>> ---- >>>> >>>> expand!q{ codes... } parses D code string, and expands ${ expr } for >>>> embedding expr that is expression evaluated as string in compile-time. >>>> >>>> do you think? >>>> >>>> Kenji >>>> _______________________________________________ >>>> phobos mailing list >>>> [email protected] >>>> http://lists.puremagic.com/mailman/listinfo/phobos >>> >>> _______________________________________________ >>> phobos mailing list >>> [email protected] >>> http://lists.puremagic.com/mailman/listinfo/phobos >>> >> _______________________________________________ >> phobos mailing list >> [email protected] >> http://lists.puremagic.com/mailman/listinfo/phobos > > _______________________________________________ > phobos mailing list > [email protected] > http://lists.puremagic.com/mailman/listinfo/phobos > _______________________________________________ phobos mailing list [email protected] http://lists.puremagic.com/mailman/listinfo/phobos
