Hey wait a minute....

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

"123efghijk" is as valid an Euphoria object as any other.

The docs are profoundly inaccurate on this matter:


Quoted from 'Library.doc':

[START QUOTE]

<value>


 Syntax:      include get.e
              s = value(st)

 Description: Read the string representation of a
              Euphoria object, and compute
              the value of that object. A 2-element
              sequence, {error_status,value} is actually
              returned, where error_status can be one of:

                  GET_SUCCESS -- a valid object representation
                                 was found
                  GET_EOF     -- end of string reached too soon
                  GET_FAIL    -- syntax is wrong
              
 Comments:    This works the same as get(), but it reads
              from a string that you supply, rather than
              from a file or device.

              After reading one valid representation of a
              Euphoria object, value() will stop reading
              and ignore any additional characters in
              the string. For example, "36" and "36P" will
              both give you
              {GET_SUCCESS, 36}.

 Example 1:

              s = value("12345"}
              -- s is {GET_SUCCESS, 12345}
              
               
 Example 2:

              s = value("{0, 1, -99.9}")
              -- s is {GET_SUCCESS, {0, 1, -99.9}}
              
               
 Example 3:

              s = value("+++")
              -- s is {GET_FAIL, 0}
              
               
 See Also:    get, sprintf, print


[END QUOTE]

The discription should really read:

 Description: Read the string representation of a *valid*
              Euphoria *numerical* object, and compute
 	      the value of that object. .....

Also, the "comments" are radically beguiling, as

>>              After reading one valid representation of a
>>              Euphoria object, value() will stop reading
>>              and ignore any additional characters in
>>              the string. For example, "36" and "36P" will
>>              both give you
>>              {GET_SUCCESS, 36}.

needs to be deleted smile

and replaced with:

Dont use on strings of numbers mixed with characters such as:
    "36P"

<chuckles>

--Al

Any more ideas/comments on this?

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

Search



Quick Links

User menu

Not signed in.

Misc Menu