Skip to content
This repository has been archived by the owner on Dec 9, 2022. It is now read-only.

syntax: macro #6

Closed
dannypsnl opened this issue Jul 5, 2022 · 0 comments
Closed

syntax: macro #6

dannypsnl opened this issue Jul 5, 2022 · 0 comments
Labels

Comments

@dannypsnl
Copy link
Owner

macro is somehow, required in Eikyo, to make sure the refinement system won't get misused.

import eikyo # import expr, block

macro when(test : expr, body : block)
  if @test
    @body

fun main() : ()
  @when true
    println("Hello, world")

Eikyo's macro is very limited

  1. block must be at the end of the macro
  2. @ points out it's a macro out of the macro but points out it's a macro variable in the macro
  3. compiler will try to figure out macro at very beginning
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

1 participant