Skip to content

Experimental macro require v2#1102

Draft
Frityet wants to merge 8 commits into
teal-language:mainfrom
Frityet:macmods
Draft

Experimental macro require v2#1102
Frityet wants to merge 8 commits into
teal-language:mainfrom
Frityet:macmods

Conversation

@Frityet

@Frityet Frityet commented Mar 12, 2026

Copy link
Copy Markdown
Collaborator

An update to #1096 with new semantics:

-- macros.tl
local record macros end
macro macros.double!(x: Statement)
   return ```
      $x
      $x
   ```
end

return macros
-- main.tl
local m = require("macros")
-- also supported: local type m = require("macros")
m.double!(print("hi"))

@Frityet

Frityet commented Mar 12, 2026

Copy link
Copy Markdown
Collaborator Author

@hishamhm I can also make it into local macro ... = require(...)

@github-actions

Copy link
Copy Markdown

Teal Playground URL: https://1102--teal-playground-preview.netlify.app

@hishamhm

Copy link
Copy Markdown
Member

@hishamhm I can also make it into local macro ... = require(...)

If you don't do that, how do you disambiguate which type of require it is?

Frityet added 3 commits March 23, 2026 18:23
# Conflicts:
#	teal/macro_eval.lua
#	teal/macro_eval.tl
#	teal/reader.lua
#	teal/reader.tl
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants