atom
| Definition: | 
          atom identifier
           -- or -- bool b = atom(object x) -- or -- number identifier -- or -- bool b = number(object x)  | 
        
| Description: | 
            This serves to define the atom type.  You can also call it like an ordinary function to determine if an object is an atom. The type "number", introduced in version 0.8.3, is a simple alias of "atom" and as such behaves identically. (Almost) all subsequent entries in the help files and (almost) all examples use the legacy "atom" in preference, as it is compatible with Euphoria (number isn’t), plus it is also easier to type.  | 
        
| pwa/p2js: | 
          Supported, however JavaScript is a typeless language, with "atom a" being 
          mapped to "let /*atom*/ a;" and there are no run-time typechecks, or at least they are very 
          rare (see implementation notes below). An explicit hll/Phix "if atom(x)" and similar expressions all work under pwa/p2js exactly as expected.
          | 
        
| Comments: | 
            An atom can hold a single numeric value, ie a floating point or an integer. It can also hold a raw pointer, such as allocated memory
            or a call_back address, but that is typically only used when interfacing to external code in a .dll or .so file.
             An atom can hold all integer values, but the reverse is not true. When invoked as a function, returns true (1) if x is an atom otherwise false (0). Note that atom(x) and not sequence(x) are effectively identical.
            The type "number" is a simple alias of "atom" (0.8.3+).  | 
        
| Example 1: | 
atom a = 5.99  | 
        
| Example 2: | 
object line = gets(0)
if atom(line) then
    puts(SCREEN, "end of file\n")
end if
          | 
        
| Implementation: | 
            There are generic versions of the atom function implemented as :%opAtom in builtins\VM\pType.e and :%opAtom0 in builtins\VM\pJcc.e that 
            the compiler only invokes as a last resort, preferring instead to inline that functionality if the argument is known to be assigned or the
            result variable, if any, is known to be an integer, ie does not require decref/dealloc. The compiler may also completely omit the test 
            and/or any related code, if type inference/propagation determines that the result will always be true or always false. The file pwa/p2js.js defines atom() with an optional name parameter, which if not "" triggers unassigned or type check errors, but that (parameter) is not intended for or available from hll/Phix code, and only meant for use in manually hand-crafted replacements elsewhere in p2js.js, and in practice it ended up being invoked (that way) rather more sparingly than first predicted.  | 
        
| See Also: | integer, sequence, string, object, Atoms, Core Language, JavaScript.Number |