Re: Differences between type_checks(was RE: haha very funny)

new topic     » goto parent     » topic index » view thread      » older message » newer message

Chris Bensler writes:
> Would there be any difference in speed between 
> type checking an integer and an atom?

No. In both cases it just takes a single machine-level 
comparison between two 32-bit integers.
e.g. in C: 
if (a > b) ... it's an atom
or ...
if (a > c)  ... it's an integer

In many instances, the interpreter, and especially the
translator, will know at compile-time that something
must be an integer, or must be an atom, and a
run-time test will not be performed.

> How about type checking an object? I know it's redundant, 
> but you can do it. Does object() actually do any tests, 
> or does it just return TRUE every time?

It just returns TRUE every time.

Regards,
   Rob Craig
   Rapid Deployment Software
   http://www.RapidEuphoria.com

new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu