[ruby-core:88423] [Ruby trunk Bug#13598][Assigned] mutex_m: Missing info in the doc

From: hsbt@...
Date: 2018-08-10 06:28:14 UTC
List: ruby-core #88423
Issue #13598 has been updated by hsbt (Hiroshi SHIBATA).

Status changed from Open to Assigned
Assignee set to docs

----------------------------------------
Bug #13598: mutex_m: Missing info in the doc
https://bugs.ruby-lang.org/issues/13598#change-73477

* Author: mala (stefano frabetti)
* Status: Assigned
* Priority: Normal
* Assignee: docs
* Target version: 
* ruby -v: ruby 2.4.1p111 (2017-03-22 revision 58053) [x86_64-linux]
* Backport: 2.2: UNKNOWN, 2.3: UNKNOWN, 2.4: UNKNOWN
----------------------------------------
The doc for Mutex_m should remind the user of the necessity of calling super() in *each* class that includes Mutex_m.

The average user will do:

~~~
require 'mutex_m'

class A
  include Mutex_m
  def initialize myval
    @myval = myval
    # error: no super()
  end
  def method
    @myval
  end
end

a = A.new 'abc'
a.mu_synchronize{a.method}
~~~

He will get:

~~~
NoMethodError: undefined method `synchronize' for nil:NilClass
	from /usr/lib64/ruby/2.4.0/mutex_m.rb:74:in `mu_synchronize'
~~~

and will lose the rest of the evening trying to understand what went wrong ;-)

---Files--------------------------------
mutex_m.doc.patch (460 Bytes)


-- 
https://bugs.ruby-lang.org/

Unsubscribe: <mailto:[email protected]?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-core>

In This Thread

Prev Next