"Bill Page" <[EMAIL PROTECTED]> writes: | On Thu, May 15, 2008 at 9:58 PM, Gabriel Dos Reis wrote: | > "Bill Page" <[EMAIL PROTECTED]> writes: | > | > | On Thu, May 15, 2008 at 5:57 AM, Gabriel Dos Reis wrote: | > | > Bill Page writes: | > | I agree with Waldek (in a different thread). I think the original | > | developers of Axiom explicitly decided against variable name | > | overloading. Do you know of any mainstream language where | > | this is a common programming paradigm? | > | > I mention the `real' overload solution to counter the assertion | > *must be a Union*. The `must' does not follow. | > | | Ok, granted. | | > As for a language that has overload on variable, well have a look | > at Perl. It certainly is more mainstream than Spad. | > | | I believe Perl uses name mangling (sigilia), doesn't it?
That is no more mangling than writing [EMAIL PROTECTED] or [EMAIL PROTECTED] in Spad. In Perl you can say \*x. The name of the variable is `x'. You use `$', `%', etc to indicate the type of the interpretation; just list in Spad you use `@' to indicate the type of the interpretation. | | http://en.wikipedia.org/wiki/Sigil_%28computer_programming%29 | | > ... | > On another tone, it appears odd to me that one would argue for | > overloaded constants (which OpenAxiom supports, as well as | > other Axioms in one form or another), and at the same time | > argue against overload of variables? What is the fundamental | > reason? | > | | One can guess or one can ask the original designers. :-) Well, I do hope that the proponents of that proposal have their own reasons they can articulate, without resorting to `original designers'. | It would be extraordinarily inconvenient if one had to invent | different names of common constants such as 0 and 1. Have you seen such a proposal? | These are members | of many different domains. Constants are really a form of nullary | operator and are treated uniformly with other exports. Do you agree? What does that have to do with this discussion? | | > | One of the design goals of a static strongly typed language is to | > | ensure type correctness by associating static types with variables. | > | Allowing variable overloading by type seems to defeat this purpose - | > | > How? I mean, constants are overloaded, why isn't that also defeating | > the purpose -- assuming that is the case for variables? | > | | Constants are, um well, constant. Their value does not/cannot depend | on the execution history of the program. As such they are inherently | "safe". If the type system is sound and you do static typing, then the variables are inherently safe too. That is the whole point of typing. | | > | especially when it is combined with implicit typing rules. | > | > How? Please be more specific. | | I mean that if I can write: | | y := x + 1 | | and expect the compiler to provide an implicit type for y based on | knowledge of x, + and 1 where all of these potentially overloaded, the | number of possibilities rises rapidly. The greater the number of | possibilites, the greater that chance of making a type error. what is the fundamental difference with y := x() + One() ? | | > | > | Overloading constants (including functions) however is obviously very | > | convenient and supported in all flavors plus Aldor. | > | > But, why isn't that also `defeating the purpose of static typing'? | > Just because `it is claimed to be convenient'? That cannot be the | > reason. | > | | No. It is because constants are already static. But the type of the variable is also known statically. -- Gaby ------------------------------------------------------------------------- This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2008. http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/ _______________________________________________ open-axiom-devel mailing list open-axiom-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/open-axiom-devel