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

Make the last line of the file the export #1

Open
xaviervia opened this issue Sep 23, 2016 · 4 comments
Open

Make the last line of the file the export #1

xaviervia opened this issue Sep 23, 2016 · 4 comments

Comments

@xaviervia
Copy link

The idea is that the exported value in any module (file) is analogous to the return value of any function. The last expression of the file can be automatically exported. This allows for extremely terse modules such as:

// plusFive.js
+(5)

The main advantage I see, aside from incentivizing the use of expressions, is that there is no syntax to be learned, and makes the "1 file = 1 module" identity stronger (unlike imperative exports).

@joaomilho
Copy link

I don't remember any language that works like that. Do you have any example in mind?

@xaviervia
Copy link
Author

I didn’t, although I just found about http://sigil.place/prelude/annah/1.0/Eq

@joaomilho
Copy link

joaomilho commented Nov 4, 2017 via email

@danielo515
Copy link

As far as I know everything you declare inside a purescript file is exported. Not exactly this behavior but equally useful

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

No branches or pull requests

3 participants