[Prev][Next][Index][Thread]

# re: fromliteral()

- Date: Wed, 13 Mar 1996 16:17:44 PST
- From:
- Cc: moo-cows@parc.xerox.com
- Content-Type: text/plain; charset="us-ascii"

    At 03:42 PM 3/13/96 PST, you wrote:
    >>;$no_one:eval_d(toliteral(xxx))[2] == xxx
    >>
    >I tried that and got this:
    >;$no_one:eval_d(toliteral("{1,2,3}"))[2]
    >=> "{1,2,3}"
    >
    >I tried that on a couple of other MOOs ranging from 1.7.9p2 to 1.8.0p1 and
    >got the same thing. Apparently that eval just gives whatever you put in it,
    >so you might as well just ;xxx. What he wanted was something like
    >$string_utils:to_value, which was the opposite of toliteral(); you could put
    >a string representing a value and get that value.

    You gave toliteral a string, thus:

    ;toliteral("{1}")
    => "\"{1}\""

    and, as such:

    ;$no_one:eval_d("\"{1}\"")[2]
    => "{1}"

    It works as expected.  Watch your arguments to toliteral().

    Andy

- Prev: re: fromliteral()
- Next: re: fromliteral()
- Index: MOO-cows
- Thread: MOO-cows

Home | Subject Index | Thread Index