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

Document use of method invocant to distinguish between class and object methods #1121

Closed
ronaldxs opened this issue Jan 5, 2017 · 6 comments
Labels
docs Documentation issue (primary issue type)

Comments

@ronaldxs
Copy link
Contributor

ronaldxs commented Jan 5, 2017

See also perl6/roast #217 and IRC.

The technique is sometimes used by examples in the docs but not really described in either of Classes and Objects or Object Orientation. It would seem helpful to have it discussed directly someplace where someone might look for it.

class C {
    multi method f(::?CLASS:U:){say "class method"}
    multi method f(::?CLASS:D:){say "object method"}
}
C.f;       # says class method
C.new.f;   # says object method
@coke coke added the docs Documentation issue (primary issue type) label Jan 9, 2017
@zakame
Copy link
Member

zakame commented Sep 2, 2017

Hi, I think I can help out on this. I suppose this would be elaborated more on Object Orientation, to keep the class tutorial simple?

@zoffixznet
Copy link
Contributor

I suppose this would be elaborated more on Object Orientation, to keep the class tutorial simple?

Sounds good. Perhaps in the Methods section?

@zakame
Copy link
Member

zakame commented Sep 2, 2017

Yep, that section sounds good. And since multi is shown here, I suppose linking to declarator multi might be needed (since there's no example of multi-methods prior to this yet...)

zakame added a commit to zakame/perl6-doc that referenced this issue Sep 2, 2017
Add documentation on setting invocant in method signatures, using type
constraints to define class and object methods, and using multi
declarator for defining same-name class and object methods.

Fixes Raku#1121.
moritz pushed a commit that referenced this issue Sep 2, 2017
Add documentation on setting invocant in method signatures, using type
constraints to define class and object methods, and using multi
declarator for defining same-name class and object methods.

Fixes #1121.
@ronaldxs
Copy link
Contributor Author

ronaldxs commented Sep 2, 2017

Move to "Class and Instance Methods" section after Classes/self.

PR discussion: #1495 (comment)

@ronaldxs ronaldxs reopened this Sep 2, 2017
@zakame
Copy link
Member

zakame commented Sep 2, 2017

@ronaldxs I have the change to add header (after Methods and before self,) is that fine? If so, I can commit it directly.

EDIT: mixup 😹

zakame added a commit to zakame/perl6-doc that referenced this issue Sep 2, 2017
- Make discussion on class/instance methods into its own Section
- Add example code for `self` especially to illustrate its behavior with
  different invocants

Thanks to @ronaldxs for further comments 👍

References Raku#1121 (hopefully fixes too 😹)
moritz pushed a commit that referenced this issue Sep 2, 2017
- Make discussion on class/instance methods into its own Section
- Add example code for `self` especially to illustrate its behavior with
  different invocants

Thanks to @ronaldxs for further comments 👍

References #1121 (hopefully fixes too 😹)
@ronaldxs
Copy link
Contributor Author

ronaldxs commented Sep 2, 2017

planning to close soon if no objection ...

@ronaldxs ronaldxs closed this as completed Sep 3, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
docs Documentation issue (primary issue type)
Projects
None yet
Development

No branches or pull requests

4 participants