On Wednesday, 15 March 2017 at 15:39:38 UTC, Nick Sabalausky
(Abscissa) wrote:
On 03/15/2017 09:50 AM, Inquie wrote:
e.g.,
string s = "smile";
enum code1 = @#
void happyCode = "Makes me @@s@@";
#@
enum code2 = code1 ~ @#
int ImThisHappy = @@s.length@@;
#@
mixin(code);
import scriptlike; // https://github.com/Abscissa/scriptlike
string s = "smile";
// http://semitwist.com/scriptlike/scriptlike/core/interp.html
enum code1 = mixin(interp!q{
void happyCode = "Makes me ${s}";
});
enum code2 = code1 ~ mixin(interp!q{
int ImThisHappy = ${s.length};
});
mixin(code2);
Wish I could get rid of the need for "mixin(...)" in interp
though.
But you can.
in interp you can evoke the function you generate however for
that you need to pass s to it.