[Aldor-l] exports and constants
Ralf Hemmecke
ralf at hemmecke.de
Tue Jul 25 04:01:07 EDT 2006
On 07/25/2006 02:31 AM, Bill Page wrote:
> On July 24, 2006 5:15 PM Ralf Hemmecke wrote:
>> ...
>> ---BEGIN aaa11.as
>> #include "aldor"
>> #include "aldorio"
>> a: Integer == 1;
>> a: String == "b";
> Strange.
Well. To be honest, I would not have believed that this was possible
until I tried it yesterday.
> It never occurred to me that one could "overload"
> all constants (overloaded function names are common practice).
Well I had deliberately written
foo: Integer -> Integer == (i: Integer): Integer +-> i;
instead of (the syntactic sugar)
foo(i: Integer): Integer == i;
in order to demonstrate that functions are nothing else than constants
(with a type that involves "->", though). So why should they be treated
differently to constants whose type does not involve "->"?
> But of course 0 and 1 are just such constants that are
> commonly overloaded in this way.
Right. And in order to make it clear: 0 and 1 are quite different from 2
and all the other integer-like looking literals. 0 and 1 are
*identifiers* in Aldor just like iAmAVariable, odd?, set!, etc. That are
the two exceptions where an identifier need not start with a letter or
an underscore. Otherwise you would not be able to write
0: %
into the signatures of a category.
Ralf
More information about the Aldor-l
mailing list