On Thu, 2016-07-07 at 15:45 +0100, Clive Page wrote:
> It might be possible to persuade me of the utility of a very much
> cut-down proposal, just to provide unit checking on arguments of
> procedures (and function return values). This would involve the
> provision by the programmer of a simple tag, a character string, for
> each actual and dummy argument. The sort of thing I have in mind is
> where a function call which at present looks like this:
> offset_angle = great_circle_distance (ra1, dec1, ra2, dec2)
> might have units tags added like this:
> offset_angle = great_circle_distance[arcsec] (ra1[rad], dec1[rad],
> ra2[rad], dec2[rad])
>
> Just to emphasise: the compiler would not try to understand the
> string
> at all, just check that actual and dummy arguments had strings that
> matched exactly.
This is almost exactly what's in the proposal, except the tag is on the
variable declaration instead of its appearance as an actual argument,
and the processor will probably represent and check it only at compile
time.
|