Skip to content

Latest commit

 

History

History
24 lines (15 loc) · 470 Bytes

builtin-macros.md

File metadata and controls

24 lines (15 loc) · 470 Bytes

✨ Builtin macros

@pkg(e: expr)

When macros are called, they mutate the context from where they are called. By using the @pkg macro, the expression given in is executed INSIDE where the macro has been declared.

// two.sn
class Hello {}

macro example1() = new Hello();  
macro example2() = @pkg(new Hello());

// one.sn

class Hello {}

...

@example1() // Calls one::Hello
@example2() // Calls two::Hello

TODO: finish other builtin macros