From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-0.3 required=5.0 tests=BAYES_00, REPLYTO_WITHOUT_TO_CC autolearn=no autolearn_force=no version=3.4.4 Path: eternal-september.org!reader01.eternal-september.org!reader02.eternal-september.org!news.eternal-september.org!news.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail From: "G.B." Newsgroups: comp.lang.ada Subject: Re: why Ada type casting is different from other languages? newType(value) vs. (newType)value Date: Tue, 15 Jul 2014 20:42:03 +0200 Organization: A noiseless patient Spider Message-ID: References: <1cqb2iccfzox2$.f74qor2zqcub.dlg@40tude.net> <53c25e58$0$6665$9b4e6d93@newsspool3.arcor-online.net> Reply-To: nonlegitur@futureapps.de Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Injection-Date: Tue, 15 Jul 2014 18:42:02 +0000 (UTC) Injection-Info: mx05.eternal-september.org; posting-host="b96887e80893c84a90c3007226ca0d1c"; logging-data="23781"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19WBFifHIQNYaUWSCQHDdsgqX4CDk8HpGY=" User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.9; rv:24.0) Gecko/20100101 Thunderbird/24.6.0 In-Reply-To: Cancel-Lock: sha1:fYLZGcsyeVv5A86AupygZk61ZgU= Xref: news.eternal-september.org comp.lang.ada:20948 Date: 2014-07-15T20:42:03+02:00 List-Id: 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..."