Giter Club home page Giter Club logo

Comments (4)

chriscz avatar chriscz commented on August 17, 2024 2

@solnic yes we're good :). @flash-gordon that's super interesting, I'll definitely be doing more reading into Ruby semantics since I'm quite interested in Ruby's meta-programming capabilities . Thanks guys!

from dry-types.

flash-gordon avatar flash-gordon commented on August 17, 2024

It has nothing to do with dry-types, it's how lexical scoping works in ruby.
This code

T1 = Module.new { include Dry.Types(); ID = Integer }

defines a global constant ID, not a constant in T1.
This is why rspec has workarounds: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/LeakyConstantDeclaration
We could have something similar in dry-types but that would be ugly and beyond the scope of the gem IMO.

from dry-types.

solnic avatar solnic commented on August 17, 2024

Oh my oh my, this is my bad. Right, so it looks like we're good @chriscz ? 🙂

from dry-types.

flash-gordon avatar flash-gordon commented on August 17, 2024

Np, I just wasn't around when it was discussed on zulip. But it's good to have this issue as a reference anyway, this corner of ruby is 💯 counterintuitive.

from dry-types.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.