From: trans Date: 2012-03-11T05:38:45+09:00 Subject: [ruby-core:43165] Re: Help w/ some C to create NullClass ------=_Part_3100_11719592.1331411922919 Content-Type: multipart/alternative; boundary="----=_Part_3101_6682489.1331411922919" ------=_Part_3101_6682489.1331411922919 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable On Saturday, March 10, 2012 3:14:33 PM UTC-5, =D0=AE=D1=80=D0=B8=D0=B9 =D0= =A1=D0=BE=D0=BA=D0=BE=D0=BB=D0=BE=D0=B2 wrote: > > class Object; def self; self; end; end > Null =3D Class.new{ > def self; nil; end > def present?; false; end > def presence; nil; end > def empty?; true; end > def blank?; true; end > def new; self; end > def method_missing(*args); self; end > }.new > if Null.a.b.s.self > # this will not be executed > end > Not bad, but having to use `.self` at the end is the show stopper --and why= =20 I've endeavoured to write it in C.=20 ------=_Part_3101_6682489.1331411922919 Content-Type: text/html; charset=utf-8 Content-Transfer-Encoding: quoted-printable On Saturday, March 10, 2012 3:14:33 PM UTC-5, =D0=AE=D1=80=D0=B8=D0=B9 =D0= =A1=D0=BE=D0=BA=D0=BE=D0=BB=D0=BE=D0=B2 wrote:
class Object; def self; self; end; end
Null =3D Class.new{
  def self; nil; end=
  def present?; false; end
  def presence; nil;= end
  def empty?; true; end
  def blank?; true; = end
  def new; self; end
  def method_missing= (*args); self; end
}.new
if Null.a.b.s.self=
  # this will not be executed
end

Not bad, but h= aving to use `.self` at the end is the show stopper --and why I've endeavou= red to write it in C.

------=_Part_3101_6682489.1331411922919-- ------=_Part_3100_11719592.1331411922919--