On 2008-Dec-2, at 12:33 pm, Geoffrey Broadwell wrote:
On Tue, 2008-12-02 at 08:50 +0100, Carl Mäsak wrote:
Darren (>):
How does one write anonymous value literals of those types?
Why is the latter method [conversion] insufficient for your needs?
Efficiency reasons, among others.
Surely the optimizer will perform conversions of constants at compile
time. In fact, numbers and strings have to be converted anyway (from
a series of characters in the code to a binary int, or whatever). It
matters only to the programmer, insofar as we'd like special types to
get a special syntax -- I'd like that too, but there's a limit to how
much syntax can be unique or special-looking. Numbers have a special
syntax in most languages because they use special characters (Arabic
numerals), and strings use special quoting characters. (I think
Visual Basic uses #1/2/3004# for date-literals.) Cf.
Lingua::Romana::Perligata for how Perl might look without special
symbols.
I can't think of anything significantly better than "Set (1,2,3)" and
so on; we could use Unicode symbols, but I don't think that makes it
any easier or clearer (except for symbols that are already established
with the required meaning, and the only ones that come to mind are
braces to indicate sets -- and of course Perl already uses braces for
something else).
-David