Re: determining whether an object is an immediate?



It is slow, but this is probably one of the better definitions
of what an immediate is - whether it exists in ObjectSpace or
not.

Here's another solution:

class Object; def immediate?;false;end;end
class Fixnum; def immediate?;true; end;end
class Symbol; def immediate?;true; end;end
class NilClass; def immediate?;true; end;end
class FalseClass;def immediate?;true; end;end
class TrueClass; def immediate?;true; end;end


--- Gene Tani <gene.tani@xxxxxxxxx> wrote:

> you think #clone is slow, try (you could test for adding
> singleton
> methods, that would be even slower!):
>
> + x.report("objSpace ") do
> + ITERATIONS.times do
> + OBJECTS.each do |obj|
> + begin
> + if ObjectSpace.include?(obj)
> + # nothin
> + end
> + rescue TypeError
> + # noting
> + end
> + end
> + end
> + end
>
> Timothy Hunter wrote:
> > Eric Mahurin wrote:
> > > This is be best I could come up with for determining
> whether an
> > > object is an immediate (Fixnum, Symbol, false, true, nil,
> > > others?):
> > >
>
>
>


__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com


.



Relevant Pages

  • Re: What will you be hunting with this Fall?
    ... > a rear sight and a slightly prouder front sight than ... > add a forward sling loop and a sling button toward the ... > Do You Yahoo!? ... Mail has the best spam protection around ...
    (rec.hunting)
  • Re: Duplicate disk in a volume group
    ... think this one would not be good because there is still an entry for a GOOD ... Duplicate disk in a volume group ... Do You Yahoo!? ... Mail has the best spam protection around ...
    (AIX-L)
  • RE: FreeBSD on Dell PE850
    ... When I install using the 6.1 disk one I get the error "Add of package ... Do You Yahoo!? ... Mail has the best spam protection around ... MailScanner thanks transtec Computers for their support. ...
    (freebsd-questions)
  • Re: [kde-linux] Cant login via kde - hangs when "initializing peripherals"
    ... failsafe term then startkde - no problems ... I can login in under gnome - no problem. ... Do You Yahoo!? ... Mail has the best spam protection around ...
    (KDE)
  • Re: fstab and LABEL=
    ... Plus I agree with Tim that it would be better if we could be left in ... new package is installed, either on it's own or at the whim of a package ... Do You Yahoo!? ... Mail has the best spam protection around ...
    (Fedora)