Why do characters get interpreted as algebraics?
|
05-21-2014, 07:44 PM
Post: #11
|
|||
|
|||
RE: Why do characters get interpreted as algebraics?
(05-21-2014 06:09 PM)HP67 Wrote: ...OTOH ->STR seems to produce strange results. A global name gets turned into a string but with single quotes inside the double quotes. It would be great if somebody can explain this. Short answer: because that's how it was designed to work. Longer answer: It's important to remember that, in RPL terms, there is a big difference between: "String" and 'String' The first is an object containing a string of characters, the second is an identifier for an object (not the object itself). They are entirely different object types, in the same sense that a real number: 1.234 is an entirely different kind of object from a string: "abc" Generally speaking, ->STR gives you a string whose contents represent the way something would look on the stack (without the quote marks, of course). Furthermore, there's a reciprocal function to ->STR: OBJ->. OBJ-> works by attempting to evaluate the contents of the string. This is why the single quotes are important; they are needed to make sure that you get the object identifier back, not its contents. |
|||
« Next Oldest | Next Newest »
|
User(s) browsing this thread: 1 Guest(s)