Skip to content
This repository has been archived by the owner on Oct 18, 2021. It is now read-only.

Returning a top-level export instead of as part of a table #299

Open
s5bug opened this issue Aug 30, 2021 · 1 comment
Open

Returning a top-level export instead of as part of a table #299

s5bug opened this issue Aug 30, 2021 · 1 comment
Labels

Comments

@s5bug
Copy link

s5bug commented Aug 30, 2021

How to emulate

return function(importantArgData)
  return { stuff = "stuff" }
end

in Amulet? The best that I can do is generating a table with --export:

let foo importantArgData = { stuff = "stuff" }
do
  return { foo = function(importantArgData) return { stuff = "stuff" } end }
end
@s5bug
Copy link
Author

s5bug commented Sep 3, 2021

What would be the best way to handle this? --export looking for an expression at the end of the file instead of exporting all top-level declarations? I.e.

let foo = ???
let bar = ???

function (x : int) -> foo (bar x)

is a valid Amulet file?

More likely there's a better way, but I haven't been able to think of it.

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

2 participants