Closed issuesbot closed 11 years ago
[comment from ncanna...@gmail.com, published at 11/11/2011, 19:44:54] This is similar to Scala proposal for quasiquotations right ? http://scalamacros.org/sips/quasiquotations.html
[comment from stephane...@gmail.com, published at 11/11/2011, 20:32:46] Yes, I think this is an instance of quasi quotation. And to be frank; I though about it and what I've proposed here is ugly (wanted to propose something I though would be easier to do).
Quasi quotation look similar on more an more languages. The last implementation of stagging I have done brings us there https://github.com/sledorze/haxeExtensionBuilder/blob/master/src/StaggedTestMacros.hx But I don't like all the computations they involve and think Quasi quotation should be part of standard haxe macros; it's elegant, intuitive and cover a lot of macros use cases.
@ :macro public static function forExample2(init : Expr, cond : Expr, inc : Expr, body : Expr, nb : Int = 5) : Expr return { var arr = []; for (ind in 0...5) { var localExpr = "{ trace('wow' + $ind); }".stagged(); arr.push( "{ trace('i ' + $ind); $localExpr; $init; function oneTime() { if ($cond) { $body; $inc; oneTime(); } } oneTime(); }".stagged() ); } return { expr : EBlock(arr), pos : Context.currentPos() }; }
[comment from shedok...@gmail.com, published at 26/11/2011, 15:11:35] Or use % instead of $.
[comment from ncanna...@gmail.com, published at 24/01/2012, 10:18:47]
[comment from ncanna...@gmail.com, published at 15/05/2012, 09:25:02] One of the thing I was thinking of would be to add "macro" as a keyword in Haxe 3.0 :
[comment from franco.p...@gmail.com, published at 15/05/2012, 13:06:33] macro are already so important that they really seem to deserve a keyword.
[comment from stephane...@gmail.com, published at 15/05/2012, 13:25:43]
@ nicolas macro
[comment from ncanna...@gmail.com, published at 17/06/2012, 13:40:36] I've added the following :
function foo() { var x = macro myVar; var block = macro { foo(); foo(); foo(); } var efor = macro for( $x in array ) $block; return efor; }
Some testing/feedback is required, thanks :)
[comment from ncanna...@gmail.com, published at 14/07/2012, 11:51:10]
[Google Issue #562 : https://code.google.com/p/haxe/issues/detail?id=562] by stephane...@gmail.com, at 01/11/2011, 21:53:14 What steps will reproduce the problem?
What is the expected output? What do you see instead?
This is a proposal to introduce another Context method to substitue some identifiers with existing expressions while parsing. The subsitution candidates would be passed by an anonymous object.
Please complete the following class with minimal code reproducing the problem :
Please provide any additional information below.