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

Small correction - the constructor in Ruby is not called "init". #1028

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

olabiniV2
Copy link

Thus, change the text to specify that Ruby calls its constructor initialize

Thus, change the text to specify that Ruby calls its constructor `initialize`
@olabiniV2
Copy link
Author

This PR fixes #999, which I noticed after creating the PR.

@@ -1062,7 +1062,8 @@ new LoxInstance object.
We'll do the remaining part -- user-defined initialization -- now. Languages
have a variety of notations for the chunk of code that sets up a new object for
a class. C++, Java, and C# use a method whose name matches the class name. Ruby
and Python call it `init()`. The latter is nice and short, so we'll do that.
calls it `initialize()` and Python calls it `init()`. The latter is nice and

Choose a reason for hiding this comment

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

Technically python uses __init__

Looking at https://en.wikipedia.org/wiki/Comparison_of_programming_languages_(object-oriented_programming)#Constructors_and_destructors it seems like Swift uses init so that works

@olabiniV2
Copy link
Author

@icecream17 - you are absolutely correct. This PR is only about fixing the Ruby initializer name, and nothing else. I just wanted to avoid mixing issues, so I left all the other names as is.

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.

None yet

2 participants