Re: is LISP the ultimate prgram language?
James Kanze <james.kanze@gmail.com> writes:
?2? is a literal and and expression denoting an r-value,
?"abc"? is a literal and expression denoting an r-value
of pointer type.
Agreed for the first (and it doesn't have an address). ?"abc"?,
however, is an lvalue, of type ?char const[4]?.
You are right, indeed:
?A string literal is an lvalue?
ISO/IEC 14882:2003(E), 5.1p2
I, however, do not understand why a string literal is an lvalue.
I would expect that an lvalue can be used on the left side
of an assignment operator, but I cannot see sense in
"abc" = ...
.
Array types do convert to pointers in a lot of circumstances,
If ?a? is an expression of array type, I surely understand
that ?a[ i ]? is an lvalue, I just do not understand, why
the bare ?a? should be an lvalue, too. After all, the
following statement is not allowed:
{ int x[ 5 ], y[ 5 ]; x = y; }
As for messages... That's really just a question of vocabulary.
To me, the notion of a message includes run-time
polymorphism, that is, dynamic dispatch. Any object can
receive any message and decides at run time what to do with
the message, depending on the message selector and the
message arguments.