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

Changed tutorial documentation referring to 'constant' to 'immutable' #8056

Merged
merged 2 commits into from
Jun 18, 2018

Conversation

mboratko
Copy link
Contributor

@mboratko mboratko commented Jun 17, 2018

In reading the tutorial, there were a couple places where the word 'constant' was used in a colloquial sense. Since Nim defines constants in a technical sense to be values which must be known at compile time, I believe it would be more accurate to use the term 'immutable' in these places.

@mboratko mboratko mentioned this pull request Jun 17, 2018
doc/tut1.rst Outdated
@@ -208,7 +208,7 @@ Note that declaring multiple variables with a single assignment which calls a
procedure can have unexpected results: the compiler will *unroll* the
assignments and end up calling the procedure several times. If the result of
the procedure depends on side effects, your variables may end up having
different values! For safety use only constant values.
different values! For safety use only immutable values.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

huh, this is a gotcha that I wasn't even aware of. To be honest I don't really understand this last sentence, if you want to avoid this gotcha then surely you should only call side effect free procedures.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, wouldn't this be better stated as "For safety use side-effect free procedures when using this technique"?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree, in fact changing it to 'immutable' doesn't really make sense here, the problem isn't mutability it is the side-effect dependency.

@Varriount Varriount merged commit 70664bd into nim-lang:devel Jun 18, 2018
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.

3 participants