On 15.07.14 01:36, Randy Brukardt wrote:
> My point being, that knowing that something is a type conversion or an array
> indexing only helps a little. And they're really ways of looking at the same
> thing (a mapping) -- something that Dmitry likes to call an interface.
The authors seem to think that, for newcomers at least, it is better
to have different syntax for different things, irrespective of
experienced linguists' abstract views. Should we learn abstraction
first in order to be able to understand that different things have a
common interface warranting the same syntax for using the different
things?
What's a enough syntax, though?
I think the typical cases of language use can be put to
the test. For example, there is iteration as one use case
and Ada provides syntax (though not just one).
for ... loop
iterated_statements;
end loop;
Another example is placing data in some containing object.
For arrays, again, Ada does have syntax,
a(x) := 9;
which is, however, partially the same, considering context,
as for functions and type conversions.
Now, for testing, if I go to some high school and ask those who
have had some introduction to programming, about the meaning of
foo(x) := 9;
and then go to another high school for asking a similar question,
foo[x] := 9;
what answers will I get in each case? Will () vs [] be an issue?
Maybe less so if 'a' is substituted for 'foo', assuming that 'a'
suggests arrays, but do we know this? "f(x) := y" is at odds with
what I have learned at school. The notation f(x) invariably meant
function. I guess that explaining to students that you can think
of *defining* array-as-function f(x) by use of assignment might
be a surprise.
So, style as a guiding principle of language design could be
contrasted with such test results.
And later, is it really good or bad if it takes years or not
to be competent enough to understand
ptrdiff_t x = *(ptrdiff_t*)main;
vs
X : Integer_Address := To_Integer (Main'Address);
if they are comparable?
__
(*) "Every terminating algorithm computes a function after all,
so why think in terms of procedures at all and not just declare..."