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

Added construction chapter #191

Closed

Conversation

brandonpollack23
Copy link
Contributor

No description provided.


<details>

* In reality, all functions in rust are static. Receivers just add the "dot syntax" syntactic sugar by implicitly passing the struct by move, reference, or mutable reference.
Copy link
Collaborator

Choose a reason for hiding this comment

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

That's not really true, method calls on trait objects are dynamic.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Right, we should instead talk about the syntax, which allows you to call methods using the fully qualified syntax.

@mgeisler
Copy link
Collaborator

Hey @brandonpollack23 and @qwandor, since I plan on sqush-merging this, I've added a bunch of small formatting fixes.

Copy link
Collaborator

@mgeisler mgeisler left a comment

Choose a reason for hiding this comment

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

We just need to move the file and then fix the small part about dynamic calls.

@@ -0,0 +1,43 @@
# Construction

Unlike in C++ or Java, there is no "constructor" in Rust for structs, all
Copy link
Collaborator

Choose a reason for hiding this comment

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

I would like to add this content — it's great for the course participants if we can cover constructors.

Please move the file to methods/constructors.md instead since constructors are not strictly about structs (they apply to enums too).

Then we just need to fix the small problem pointed out by Andrew and we should be good to go!

Copy link
Collaborator

Choose a reason for hiding this comment

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

I would still like to see us cover this. Perhaps as part of @djmitche reorg in #1073.

Copy link
Collaborator

Choose a reason for hiding this comment

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

I think this will be in the methods slide?

Copy link
Collaborator

Choose a reason for hiding this comment

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

Yeah, I think so too.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Yeah, I see it's mentioned on the slide about methods now.

@mgeisler
Copy link
Collaborator

Hi @brandonpollack23, can you check if we still need this PR?

@mgeisler
Copy link
Collaborator

mgeisler commented Nov 2, 2023

This is covered (a tiny bit) by #1073.

@mgeisler mgeisler closed this Nov 2, 2023
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.

4 participants