Erik Naggum (erik@naggum.no) wrote:
|| strings are excellent for external representation, and that's where they
|| should be used. internal representation should be efficient for the
|| machine. when and if you need to read or print a value, use the external
|| representation, but as long as you work with it internally, use something
|| more efficient. where you define yourself relative to "external" is of
|| course an open issue.
This was the point. Now, perhaps I completely misunderstood
what Ousterhout did, but I was under the impression that he said
everything in Tcl (the external representation) is a string.
Why are we talking about internal representations at all? My
point is that if you had one external type you wanted to use
(and I don't even argue that this is a good idea), I would think
it would be a string. Internal representations aren't going to
be important because they are hidden from the user (mostly). Use
whatever representation is useful to get the thing done internally.
That's not what I was addressing. To repeat, my argument
has absolutely nothing to do with how the computer represents
the language internally. The point is that (almost) no one wants
to write a program whose *external* representation is numbers. Strings
are more flexible, if they're the only type you have, as external
representation.
The argument I've read is (1) numbers can be used to represent
any other (countable) type through Godel enumeration, and (2) computers
use numbers to represent things underneath. The challenge is this.
You are to write a language for users to use. I give you one type
that you will give to the user to use. Would your users prefer
strings or numbers? I'm not talking about internal representation.
Do I think everything should be strings in a language. Personally,
no, but given the above, how would you have answered it?
p.s. I understand internal representation vs. external. Computers
use two's complement signed notation to represent integers and
mostly IEEE 754 floating point representation to represent
floating point numbers with mantissa and exponent. Strings
are usually represent (in C/C++) as ASCII in consecutive bytes
in memory terminated by a null character. Each position is
a character in the ASCII character set.
--
Charles Lin
clin@cs.umd.edu
|