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

[basics] Introduce concepts for referencing methods in documentation #570

Open
kjcole opened this issue Dec 24, 2021 · 2 comments
Open

[basics] Introduce concepts for referencing methods in documentation #570

kjcole opened this issue Dec 24, 2021 · 2 comments

Comments

@kjcole
Copy link

kjcole commented Dec 24, 2021

Bug Report

The tutorial on strings at https://crystal-lang.org/reference/1.2/tutorials/basics/40_strings.html reads:

To determine if a string is empty, you can check if the size is zero, or just use the shorthand String#empty?:

and later

The method String#blank? returns true if the string is empty or if it only contains whitespace characters. A related method is String#presence which returns nil if the string is blank, otherwise the string itself.

The # should be replaced with a . in each case.

@kjcole
Copy link
Author

kjcole commented Dec 24, 2021

Actually, as I read further, I see consistent use of the # in the descriptions, and . in the interactive code examples... So, perhaps an explanation of why the text says "use ...#..." and then doesn't use "...#..." in the code examples.

(It's a beginners / basic tutorial, and stuff like that is confusing to beginners.)

@HertzDevil
Copy link
Contributor

HertzDevil commented Dec 24, 2021

String.empty? refers to a class method. The # is correct when used to refer to an instance method. This convention comes from Ruby; our docs should indeed be friendlier towards readers with no Ruby experience (crystal-lang/crystal#8377). The problem is, at this point the tutorial doesn't even introduce OOP concepts yet, so there isn't anything we can do here for now.

Also issues related to the reference / tutorial should go to crystal-lang/crystal-book.

@straight-shoota straight-shoota transferred this issue from crystal-lang/crystal Dec 24, 2021
@straight-shoota straight-shoota changed the title Bug: Small typo in basic tutorial on strings. (Easy fix.) [basics] Introduce concepts for referencing methods in documentation Dec 24, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants