As the title suggests, is there a way to escape the $ sign in macro context to prevent reification.
I have the following in Haxe which doesn’t work:
var searchable = searchableFields[0];
var searchBody = macro {
var items = manager.search($$$searchable.like(value));
};
The manager.search function is from record-macros which is a function which takes an macro Expr, so I need a way somehow to escape the $ character so that it’s used in place rather than reified with the following expression.
The value of searchable would be title, which I would expect to translate to $title.like(value).
I’m not sure if it’s possible with reification (maybe it should be), but you can always construct Expr instances directly and pass a string with $ to CIdent, EField and friends
If you want to generate an identifier $title, then your searchable should contain a string "$title" and then this should work: macro $i{searchable}. http://try-haxe.mrcdk.com/#83Bea