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

defn functions inside let bindings are still available outside #26

Merged
merged 1 commit into from
Jan 26, 2014

Conversation

DjebbZ
Copy link
Contributor

@DjebbZ DjebbZ commented Jan 26, 2014

I think this point is important, since in Javascript when you define a function inside a scope, this function is only available in this scope. Here ClojureScript allows a function defined in a let bindings (concept close to the scope) to be available outside the let. Not sure my change in the code nor this very comment is clear, but for a ClojureScript beginner like familiar with Javascript I felt this needed to be explained and explicit.

@swannodette
Copy link
Owner

This is an important point, thanks!

@swannodette
Copy link
Owner

It needs a little bit more clarification which I will add.

swannodette added a commit that referenced this pull request Jan 26, 2014
defn functions inside let bindings are still available outside
@swannodette swannodette merged commit c87711b into swannodette:master Jan 26, 2014
@DjebbZ
Copy link
Contributor Author

DjebbZ commented Jan 27, 2014

I also tried something else, maybe silly, of defining functions inside of a function definition, i.e. defn inside another defn. The compiler didn't like this, but the equivalent in javascript is perfectly legit. Maybe you could add a note about this ? Also I don't understand why it doesn't work in CLJS.

@swannodette
Copy link
Owner

I actually already added a note and explanation about that too.

@DjebbZ
Copy link
Contributor Author

DjebbZ commented Jan 28, 2014

Sorry, I should really read the whole tutorial and ask afterwards. By the way, this tutorial rocks !

@DjebbZ DjebbZ deleted the closures branch January 28, 2014 09:05
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