This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import haxe.macro.Expr; | |
| class Macros { | |
| public static macro function map(expr:Expr) { | |
| return macro function(_) { | |
| return $expr; | |
| } | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var x = 1,y = 1; | |
| sure (x == y, x==1); | |
| //or | |
| sure({ | |
| x==1; | |
| y==2; //throw an error | |
| }); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var x = 1,y =1; | |
| asserTrue(x,y); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| return switch e { | |
| case macro [$a{lefts}] = [$a{rights}]: processArrays(lefts,rights); | |
| case macro [$a{lefts}] << ${right}: processObject(lefts,right); | |
| case _:e.map(processDestructuring); | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import haxe.macro.Expr; | |
| using haxe.macro.ExprTools; | |
| using haxe.macro.MacroStringTools; | |
| class Let { | |
| static function processDestructuring(e:Expr) { | |
| inline function processArrays(lefts:Array<Expr>,rights) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var x = 1; | |
| var y = 2; | |
| var z = 3; | |
| var person = { name : "mario", surname : "rossi", age : 25}; | |
| console.log(person); | |
| var name = person.name; | |
| var surname = person.surname; | |
| var a = x; | |
| var b = y; | |
| var c = z; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var x = 1; | |
| var y = 2; | |
| var z = 3; | |
| var list = [1,2,3]; | |
| var person = {name:'mario',surname:'rossi',age:25}; | |
| trace(person); | |
| let({ | |
| [name,surname] << person; | |
| [a,b,c] = [x,y,z]; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| let({ | |
| [name,surname] << person; | |
| [a,b,c] = [x,y,z]; | |
| }); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| [x,y,z] = [1,2,3] | |
| [name,surname] = person |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import Slambda.fn; | |
| fn(_ + 1); | |
| fn(x => x + 1); |