You've already forked comprehensive-rust
mirror of
https://github.com/google/comprehensive-rust.git
synced 2025-12-20 22:29:12 +02:00
Remove macro hygiene from hello world slide (#2908)
This commit is contained in:
@@ -19,7 +19,7 @@ What you see:
|
|||||||
- The `main` function is the entry point of the program.
|
- The `main` function is the entry point of the program.
|
||||||
- Blocks are delimited by curly braces like in C and C++.
|
- Blocks are delimited by curly braces like in C and C++.
|
||||||
- Statements end with `;`.
|
- Statements end with `;`.
|
||||||
- Rust has hygienic macros, `println!` is an example of this.
|
- `println` is a macro, indicated by the `!` in the invocation.
|
||||||
- Rust strings are UTF-8 encoded and can contain any Unicode character.
|
- Rust strings are UTF-8 encoded and can contain any Unicode character.
|
||||||
|
|
||||||
<details>
|
<details>
|
||||||
@@ -37,9 +37,9 @@ Key points:
|
|||||||
- Rust uses macros for situations where you want to have a variable number of
|
- Rust uses macros for situations where you want to have a variable number of
|
||||||
arguments (no function [overloading](../control-flow-basics/functions.md)).
|
arguments (no function [overloading](../control-flow-basics/functions.md)).
|
||||||
|
|
||||||
- Macros being 'hygienic' means they don't accidentally capture identifiers from
|
- `println!` is a macro because it needs to handle an arbitrary number of
|
||||||
the scope they are used in. Rust macros are actually only
|
arguments based on the format string, which can't be done with a regular
|
||||||
[partially hygienic](https://veykril.github.io/tlborm/decl-macros/minutiae/hygiene.html).
|
function. Otherwise it can be treated like a regular function.
|
||||||
|
|
||||||
- Rust is multi-paradigm. For example, it has powerful
|
- Rust is multi-paradigm. For example, it has powerful
|
||||||
[object-oriented programming features](https://doc.rust-lang.org/book/ch17-00-oop.html),
|
[object-oriented programming features](https://doc.rust-lang.org/book/ch17-00-oop.html),
|
||||||
|
|||||||
Reference in New Issue
Block a user