Re: An alternative to possreps
Date: Sat, 11 Jun 2011 07:04:20 -0700 (PDT)
Message-ID: <6eff3eab-39d7-4b75-96fe-0e0e9f0e7c16_at_s9g2000yqm.googlegroups.com>
On 9 jun, 08:28, David BL <davi..._at_iinet.net.au> wrote:
>
> I agree that update operators are an important consideration.
>
> Nevertheless I don't think type systems per se should have anything to
> do with specifying what update operators are available on variables.
> I consider a type to be a set of values plus operators on *values* (or
> what Date calls read-only operators).
> Update operators can be modelled at the logical level of discourse
> using a language allowing variables to be passed by reference in some
> sense. E.g.
>
> setmagnitude(Complex& c, Real m)
> {
> c := polar(m,phase(c));
> }
If the c argument is a reference, then your assignment to this reference is invalid.
No pointers, no pass-by-reference, no variables containing variables, ... in TTM.
The TTM way is :
TYPE COMPLEX (IMAG REAL, REAL REAL);
VAR COMPLEX MYVAR=COMPLEX(0.0, 0.0);
THE_IMAG(MYVAR) := new imag value;
But note that there is no such thing as a "setter" operator "inside" the type, so to speak. Received on Sat Jun 11 2011 - 16:04:20 CEST