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

Add docs to string methods in SymbolLiteral and MacroId #9298

Merged

Conversation

makenowjust
Copy link
Contributor

Because their methods delegates to StringLiteral. In fact, SymbolLiteral#underscore and MacroId#underscore are missing in document. It should be shared.

In details, it uses a file private macro named def_string_methods.

Thank you.

…oId`

Because their methods delegates to `StringLiteral`.
In fact, `SymbolLiteral#underscore` and `MacroId#underscore` are missing in document.
It should be shared.
@makenowjust
Copy link
Contributor Author

Follow #9269 changes. #titleize is added.

@makenowjust
Copy link
Contributor Author

ping

@j8r
Copy link
Contributor

j8r commented Jun 7, 2020

Any reasons against using a generic module instead of a macro?

@makenowjust
Copy link
Contributor Author

Because they don't include any
common module in fact.

@j8r
Copy link
Contributor

j8r commented Jun 7, 2020

I don't quite understand, I mean having something like include StringMethods(MacroId) instead of def_string_methods MacroId`. Do you say it won't make sense?

@asterite
Copy link
Member

asterite commented Jun 7, 2020

It won't make sense. Such hierarchy doesn't exist in the compiler. The type doesn't exist in macros.

@makenowjust
Copy link
Contributor Author

makenowjust commented Jun 9, 2020

Repeat from the above PR description, current documentation misses SymbolLiteral#underscore and MacroId#underscore, so this PR fixes this documentation bug. It is indirect, but I think it is more reasonable than adding each methods to their definitions.

Copy link

@0x000def42 0x000def42 left a comment

Choose a reason for hiding this comment

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

Would like to get it in the next version

Comment on lines 19 to 25
# Similar to `String#>`
def >(other : StringLiteral | MacroId) : BoolLiteral
end

# Similar to `String#<`
def <(other : StringLiteral | MacroId) : BoolLiteral
end
Copy link
Member

Choose a reason for hiding this comment

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

SymbolLiteral doesn't have < > methods.

The rest seems to be good.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sorry for my slow response. This is fixed.

@straight-shoota straight-shoota added this to the 1.2.0 milestone Aug 27, 2021
@straight-shoota straight-shoota changed the title Share StringLiteral methods document with SymbolLiteral and MacroId Add docs to string methods in SymbolLiteral and MacroId Aug 30, 2021
@straight-shoota straight-shoota merged commit edfd0fb into crystal-lang:master Aug 30, 2021
@makenowjust makenowjust deleted the string-literal-macro-doc branch August 30, 2021 13:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants