On 7 May, 17:05, AAsk <AA2e...@[EMAIL PROTECTED]
> wrote:
>
> APL has neither the requirement to declare variables nor strong
> typing. Typing is an integral programming concept.
>
> Any ideas on how to 'mimic' typing in APL?
Having spent many years programming in a very wide range of languages,
including assembler, APL, C, C++, C#, PowerBuilder, VB, Java, SQL, etc
etc, I'm unconvinced that 'strong typing' actually buys you all that
much in terms of reliability. Where it IS important is for languages
which have pointers - disallowing a pointer to a 64-bit float to be
used as a pointer to a 32-bit integer, for example. But for languages
such as APL which don't have pointers, it's much less important.
What's more, so-called 'strongly-typed' languages often enforce the
wrong things. In some cases, they'll give a warning or error on
innocuous things - so you have to add a 'cast', which makes code less
readable - whilst not preventing much more serious errors such as
adding an invoice number to a day of the month, or adding a weight in
kg to a weight in pounds, or not warning on arithmetic overflow. (I
appreciate that the exact details depend on the language you are
talking about, but you'll get my gist).
Maybe a different approach is needed - something based on rules or
constraints. So for example the default might be: "A is anything.
Let the programmer do what he likes." Or you could say "B is a double-
precision floating point. It must be between +1.0 and -1.0. It is not
legal to add another number to it." And so on. Such an approach could
be quite good in practice because you could get the advantages of
rapid prototyping by initially having no rules, then add them later if
you want to enforce high reliability. If you think about it, so-
called 'strong typing' is just a rather arbitrary sub-set of what I'm
proposing, without the convenience of being able to do what you like
at the prototyping stage.
(BTW don't expect any of this to appear in APLX anytime soon!)
Richard Nabavi
MicroAPL


|