Re: we need official libs : Swap

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

>include get.e
>atom num
>num = value ("7") [2]
>
>instead of:
>
>include get.e
>object num
>num = value ("7")
>num = num[2]

As mentioned in the reference manual, subscripting expressions is not
supported because that would wastefully discard some already calculated
values. There is a purpose for value() to return more than the result called
for: error-handling. The correct use of value() would be--

include get.e
sequence getval
atom num
getval = value("7")
if getval[1] = GET_SUCCESS
    then num = getval[2]
    else .... -- handle the invalid crap that obviously wasn't "7"
end if

Lionel Wong


______________________________________________________
Get Your Private, Free Email at http://www.hotmail.com

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

Search



Quick Links

User menu

Not signed in.

Misc Menu