[#70252] Re: [ruby-cvs:58640] nobu:r51492 (trunk): node.c: NODE_ALLOCA for ALLOCV — Eric Wong <normalperson@...>
Besides possible backwards compatibility, can we drop volatile
3 messages
2015/08/05
[#70257] [Ruby trunk - Feature #11420] [Open] Introduce ID key table into MRI — ko1@...
Issue #11420 has been reported by Koichi Sasada.
11 messages
2015/08/06
[#70337] Re: [Ruby trunk - Feature #11420] [Open] Introduce ID key table into MRI
— Eric Wong <normalperson@...>
2015/08/11
Nice. Thank you guys for looking into this.
[#70349] Re: [Ruby trunk - Feature #11420] [Open] Introduce ID key table into MRI
— Eric Wong <normalperson@...>
2015/08/12
Btw, did you consider using flexible array to avoid extra malloc
[#70355] Re: [Ruby trunk - Feature #11420] [Open] Introduce ID key table into MRI
— Юрий Соколов <funny.falcon@...>
2015/08/12
I thought to suggest to embed hash_id_table directly into places when it is
[#70356] Re: [Ruby trunk - Feature #11420] [Open] Introduce ID key table into MRI
— SASADA Koichi <ko1@...>
2015/08/12
On 2015/08/13 4:29, Юрий Соколов wrote:
[#70358] Re: [Ruby trunk - Feature #11420] [Open] Introduce ID key table into MRI
— Eric Wong <normalperson@...>
2015/08/12
SASADA Koichi <ko1@atdot.net> wrote:
[#70509] [Ruby trunk - Misc #11276] [RFC] compile.c: convert to use ccan/list — ko1@...
Issue #11276 has been updated by Koichi Sasada.
3 messages
2015/08/21
[#70639] the undefined behavior of an iterator if it is modified inside of the block to which it yields — Daniel Doubrovkine <dblock@...>
(this is my first time e-mailing list list, so apologies for any misstep :)
4 messages
2015/08/31
[ruby-core:70388] [Ruby trunk - Feature #11297] Allow private method of self to be called
From:
Ruby-Lang@...
Date:
2015-08-14 11:01:49 UTC
List:
ruby-core #70388
Issue #11297 has been updated by J=C3=B6rg W Mittag.
Yukihiro Matsumoto wrote:
> It changes the concept of private methods a little. It's OK to merge the=
patch if the document is updated at the same time..
It does change it, but it makes it much simpler in my opinion. It is basica=
lly "the receiver is statically the explicit literal special variable `self=
` or implicit." This gets rid of the current exception for private writer m=
ethods (`self.foo =3D bar`).
It also resolves the problems with private operator methods (`self + bar`) =
and compound assignments with private writers and/or private operators (`se=
lf +=3D bar`, `self.foo +=3D bar`, where either `+` or `foo=3D` or both are=
private). It removes pretty much all edge cases in one blow.
See also #9907 which would be simplified by this proposal. In particular, i=
mplementing the simple rule would make Charles Oliver Nutter's confusion go=
away (#9907-6, #9907-8), be consistent with Nobuyoshi Nakada's expectation=
s (#9907-7) and alleviate Benoit Daloze's concerns about being decidable st=
atically at parse time (#9907-9).
In fact, I believe that with this feature all of these should work:
~~~ruby
#!/usr/bin/env ruby
class Private
def doit
self.foo =3D self
self.foo **=3D self
self.foo *=3D self
self.foo /=3D self
self.foo %=3D self
self.foo +=3D self
self.foo -=3D self
self.foo <<=3D self
self.foo >>=3D self
self.foo &=3D self
self.foo |=3D self
self.foo ^=3D self
self.foo &&=3D self
self.foo ||=3D self
!self
~self
+self
self ** self
-self
self * self
self / self
self % self
self + self
self - self
self << self
self >> self
self & self
self | self
self ^ self
self < self
self <=3D self
self >=3D self
self > self
self =3D=3D self
self =3D=3D=3D self
self !=3D self
self =3D~ self
self !~ self
self <=3D> self
self[self, self]
self[self, self] =3D self, self
self.(self, self)
end
private
attr_accessor :foo
def !(*args) p __method__, *args end
def ~(*args) p __method__, *args end
def +@(*args) p __method__, *args end
def **(*args) p __method__, *args end
def -@(*args) p __method__, *args end
def *(*args) p __method__, *args end
def /(*args) p __method__, *args end
def %(*args) p __method__, *args end
def +(*args) p __method__, *args end
def -(*args) p __method__, *args end
def <<(*args) p __method__, *args end
def >>(*args) p __method__, *args end
def &(*args) p __method__, *args end
def |(*args) p __method__, *args end
def ^(*args) p __method__, *args end
def <(*args) p __method__, *args end
def <=3D(*args) p __method__, *args end
def >=3D(*args) p __method__, *args end
def >(*args) p __method__, *args end
def =3D=3D(*args) p __method__, *args end
def =3D=3D=3D(*args) p __method__, *args end
def !=3D(*args) p __method__, *args end
def =3D~(*args) p __method__, *args end
def !~(*args) p __method__, *args end
def <=3D>(*args) p __method__, *args end
def [](*args) p __method__, *args end
def []=3D(*args) p __method__, *args end
def call(*args) p __method__, *args end
end
Private.new.doit
~~~
----------------------------------------
Feature #11297: Allow private method of self to be called
https://bugs.ruby-lang.org/issues/11297#change-53791
* Author: Soutaro Matsumoto
* Status: Open
* Priority: Normal
* Assignee:=20
----------------------------------------
Ruby does not allow private method to be called if receiver is given. Calli=
ng private method with receiver is prohibited even if it is written as self=
, though the fact that the receiver is self is still clear.
This ticket is to propose to allow the private method to be called if its r=
eceiver is written as self.
The following Ruby program is to explain my idea.
~~~ruby
class A
private def f
end
end
A.new.instance_eval do=20
f() # Okay, without receiver
self.f # Currently NoMethodError, but should be okay in my opin=
ion
self.itself.f # NoMethodError anyway; the receiver is not written as s=
elf
end
~~~
This change will allow to call private accessor method like `self.title=3D`.
It also will make refactoring to make a public method private easier. Curre=
ntly, such kind of refactoring may require to rename duplicated local varia=
bles or add `()` to method calls.
---Files--------------------------------
private_with_self.diff (916 Bytes)
--=20
https://bugs.ruby-lang.org/