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

Clarify self?. method semantics #910

Merged
merged 4 commits into from
Feb 22, 2022
Merged

Clarify self?. method semantics #910

merged 4 commits into from
Feb 22, 2022

Conversation

soutaro
Copy link
Member

@soutaro soutaro commented Feb 21, 2022

It's a syntax for module function! 💡

This PR introduces two changes:

  1. Singleton methods ignore public and private members: Singleton methods always have public visibility. Will be changed in Add public/private per member modifier #911
  2. Instance methods defined with self? have private visibility, even with public

These changes will make self? methods closer to module function.

module Kernel
  def self?.puts: (*untyped) -> void     # Defines `Kernel.puts` public method and `Kernel#puts` private method.
end

@soutaro soutaro enabled auto-merge February 22, 2022 06:44
@soutaro soutaro merged commit 311ddd0 into master Feb 22, 2022
@soutaro soutaro deleted the module-function branch February 22, 2022 06:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

1 participant