WARNING: THIS SITE IS A MIRROR OF GITHUB.COM / IT CANNOT LOGIN OR REGISTER ACCOUNTS / THE CONTENTS ARE PROVIDED AS-IS / THIS SITE ASSUMES NO RESPONSIBILITY FOR ANY DISPLAYED CONTENT OR LINKS / IF YOU FOUND SOMETHING MAY NOT GOOD FOR EVERYONE, CONTACT ADMIN AT ilovescratch@foxmail.com
Skip to content

Conversation

@noraj
Copy link

@noraj noraj commented Mar 30, 2023

@netlify
Copy link

netlify bot commented Mar 30, 2023

Deploy Preview for crystal-book ready!

Name Link
🔨 Latest commit df0b43d
🔍 Latest deploy log https://app.netlify.com/sites/crystal-book/deploys/6425ff59163051000845695f
😎 Deploy Preview https://deploy-preview-680--crystal-book.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site settings.

@straight-shoota
Copy link
Member

Thanks for this contribution.

I think we should put this in a different place. It's not really a specification of a language feature. That would just be the last sentence and that's already covered in https://crystal-lang.org/reference/1.7/syntax_and_semantics/the_program.html#top-level-scope

This piece feels more like a mini howto: If you need to deal with this, you can do that (this = naming conflict, that = top-level namespace reference). Maybe we can put it in the Guides section? But guides are typically larger about more complex topics.
Actually, the scope could be a good format for https://stackoverflow.com/ which we endorse as a knowledge base for these kind of problems.

Anyways, I would suggest to make the example fully self-contained. The reader should not need to know anything outside the presented code.

module Bar
  def self.bar
  end
end

module Foo
  def self.foo
    ::Bar.bar
  end

  module Bar
  end
end

Foo.foo

@noraj
Copy link
Author

noraj commented Mar 31, 2023

Maybe a "Common issues" section under https://crystal-lang.org/reference/1.7/guides/index.html?

@beta-ziliani beta-ziliani self-assigned this Apr 24, 2023
@beta-ziliani
Copy link
Member

I think it's better to have something like this in the tutorial, although at the moment the tutorial itself is rather poor

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants