You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Our inplace idiom occurs warning like warning: possibly useless use of + in void context.
To avoid such warnings, how do you think defining inplace=?
With this method, we can write ary.inplace += 10, which don't occur such warnings.
$ cat -n inplace.rb
1 require 'numo/narray'
2
3 class Numo::NArray
4 # Dummy definition for PoC
5 def inplace=(other)
6 self
7 end
8 end
9
10 a = Numo::DFloat[1, 2, 3, 4, 5]
11 a.inplace + 10 # this involves a warning
12 a.inplace += 20 # this doesn't involve a warning
$ ruby -w inplace.rb
inplace.rb:11: warning: possibly useless use of + in void context
The text was updated successfully, but these errors were encountered:
Our
inplace
idiom occurs warning likewarning: possibly useless use of + in void context
.To avoid such warnings, how do you think defining
inplace=
?With this method, we can write
ary.inplace += 10
, which don't occur such warnings.The text was updated successfully, but these errors were encountered: