Re: Motion 31 Suggestions - constants
Ian
On 8 Feb 2012, at 19:59, Ian McIntosh wrote:
> ...It makes more sense to me to treat constants differently from functions. We do in real life.
>
> Here's how I'd define it:
> Interval "operations" and "functions" deal with (consume and/or produce) interval "values". Some values are calculated; others are "constants". Some constants are "named constants" which represent specific interval values (eg, Entire defined by 1788 represents [-oo,+oo]); others are numeric and are converted from text to interval values by "constant conversion functions". Both named constants and constant conversion functions may be defined by 1788 and/or programming languages/environments/applications and/or users. The 1788 constraints on constant (and other) conversion functions are that (1) they must either produce a valid interval or in some way report an error and (2) they must not violate containment of the value represented by a reasonable interpretation of the text.
At a language level, I'ld entirely agree. In the context of Level 1 expressions, I would say this:
We treat integer-power pown(x,n), in an expression, as an instance of an infinite "schema", x^0, x^1, x^(-1), ... because the n is not treated as a continuous variable, by contrast with pow(x,y). In the same way, a real constant "1.23" or interval constant "[1.23,4.56]" is an instance of an infinite schema of text strings defined by some syntax. A "power conversion function" interprets pown, e.g. converting pown(x,0) to the constant 1 in all cases. Usually this is done inside the compiler, but in a fully interpreted, unoptimized, system it would happen at run time each time the statement containing the string was executed.
In the same way your "constant conversion function" is a machine for understanding instances of another infinite schema. It converts a text string to a value, which is in the first instance an exact real or interval value before it is forced into some finite-precision form. I see no contradiction. Level 1 sees 1.23 as a symbol representing the function 1.23() (that returns 1.23). You see an argument to a function call, say convertRealConstant("1.23") (that returns 1.23). Different viewpoints on the same events.
John