Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix up the semantics of IO #35

Open
jparoz opened this issue Feb 25, 2023 · 0 comments
Open

Fix up the semantics of IO #35

jparoz opened this issue Feb 25, 2023 · 0 comments
Labels
bug improvement Improves the way that an existing feature works, in a backwards-compatible way.
Milestone

Comments

@jparoz
Copy link
Owner

jparoz commented Feb 25, 2023

Conceptually, an IO Int represents an effectful action, which when executed, yields an Int.
The Lua function function() return 5 end seems like something which should have the type IO Int; but as currently implemented, the function has type () -> IO Int.

The probable fix for this is to change the representation of an IO Int from being "an Int which possibly comes with side-effects" into being "a Lua function which takes no arguments, and returns an Int, possibly also causing side-effects".

Basically, in Lua, to "execute an IO action", you do a function call.

@jparoz jparoz added bug improvement Improves the way that an existing feature works, in a backwards-compatible way. labels Feb 25, 2023
@jparoz jparoz added this to the 0.5.0 milestone Feb 25, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug improvement Improves the way that an existing feature works, in a backwards-compatible way.
Projects
Status: Todo
Development

No branches or pull requests

1 participant