ruby-concurrency / ruby-concurrency/concurrent-ruby

CAtomicFixnum should probably be a private constant

Open
#981 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Ruby
Stars
5.8k
Forks
420
Avg merge
20h 45m
Merged PRs (30d)
4

Description

Otherwise we get misleading suggestions from did-you-mean in case concurrent/atomic/atomic_fixnum is not required but the extension is loaded like:

     NameError:
       uninitialized constant Concurrent::AtomicFixnum
     
                 counter = AtomicFixnum.new
                           ^^^^^^^^^^^^
       Did you mean?  Concurrent::CAtomicFixnum
     # ./spec/concurrent/atomic/cyclic_barrier_spec.rb:106:in `block (4 levels) in <module:Concurrent>'

Note that even if it's private, did-you-mean is still kind of misleading:

     NameError:
       uninitialized constant Concurrent::AtomicFixnum
     
                   counter = AtomicFixnum.new
                             ^^^^^^^^^^^^
       Did you mean?  Concurrent::AtomicReference
     # ./spec/concurrent/atomic/cyclic_barrier_spec.rb:191:in `block (5 levels) in <module:Concurrent>'

And there are various specs checking defined? Concurrent::CAtomicFixnum and even a benchmark referencing Concurrent::CAtomicFixnum, so it's not so easy to make it private unfortunately.

Unclear if worth fixing. WIP at https://github.com/ruby-concurrency/concurrent-ruby/compare/master...eregon:concurrent-ruby:private-AtomicFixnum

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reviewing the constant definitions and the specs mentioned in the issue, especially spec/concurrent/atomic/cyclic_barrier_spec.rb, then inspect the WIP comparison branch. Search for specs and benchmark references to Concurrent::CAtomicFixnum. Done means resolving whether the constant can be private without leaving those references inconsistent or retaining the misleading suggestion.

Written by the indexing model from the issue text.

Assessment

Tech stack
ruby
Domain
backend
Issue type
Refactor
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.