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=-1.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Thread: 103376,21960280f1d61e84 X-Google-Attributes: gid103376,public X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news2.google.com!news2.google.com!news1.google.com!news4.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!local01.nntp.dca.giganews.com!nntp.scarlet.biz!news.scarlet.biz.POSTED!not-for-mail NNTP-Posting-Date: Wed, 24 Jan 2007 02:07:16 -0600 From: Ludovic Brenta Newsgroups: comp.lang.ada Subject: Re: How come Ada isn't more popular? References: <1169531612.200010.153120@38g2000cwa.googlegroups.com> <1169588206.234714.312650@k78g2000cwa.googlegroups.com> <1169624573.534128.172610@s48g2000cws.googlegroups.com> Date: Wed, 24 Jan 2007 09:07:15 +0100 Message-ID: <87sle0sv9o.fsf@ludovic-brenta.org> User-Agent: Gnus/5.110006 (No Gnus v0.6) Emacs/21.4 (gnu/linux) Cancel-Lock: sha1:s9FeqiYVtiVX98yvLDNfwUXPNn8= MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii NNTP-Posting-Host: 62.235.208.162 X-Trace: sv3-fVDvMgll7aL9geewQXGCj/Pe15IEO6WRtA4yYCZev6l1Wfo/HWXzkQGV8AjTGBF3dqiGnmFD6XqgCsC!HM9RqbywvRWqYzTFtsDlZ0hqKXBtfRzJ3S6gOAD0UY37kHP1G39sjxILzpRvOQrlkGy/JWUbyP8= X-Complaints-To: abuse@scarlet.be X-DMCA-Complaints-To: abuse@scarlet.biz X-Abuse-and-DMCA-Info: Please be sure to forward a copy of ALL headers X-Abuse-and-DMCA-Info: Otherwise we will be unable to process your complaint properly X-Postfilter: 1.3.32 Xref: g2news2.google.com comp.lang.ada:8465 Date: 2007-01-24T09:07:15+01:00 List-Id: kevin cline writes: > But the point was that expressiveness drives programmers to new > languages, and Ada isn't particularly expressive. On the contrary, I think that Ada is the most expressive language around. Consider: procedure Set_Bit_In_Register (At_Address : in System.Address) is type Register is array (1 .. 32) of Boolean; pragma Pack (Register); for Register'Bit_Order use System.High_Order_First; pragma Volatile (Register); R : Register; for R'Address use At_Address; begin Register (4) := True; end; versus void set_bit_in_register (volatile unsigned long * at_address) { *at_address |= 2 << 3; } The Ada version makes many more things explicit, that are assumed and implicit in C; for example, the size of the register, the fact that the parameter is an address and not a pointer (*), the endianness, and which bit is being set. As 64-bit architectures become prevalent, the hidden assumption that C's "unsigned long" is 32 bits wide is more and more likely to be incorrect. (*) consider that when we increment the address by one, it then references the next byte; whereas if we increment the pointer by one, it points to the next "unsigned long", i.e. 2, 4 or 8 bytes and not 1 byte further. C makes no distinction between addresses and pointers, lacking expressiveness in a crucial area. When calling the subprogram, we get: Set_Bit_In_Register (At_Address => To_Address (16#DEADBEEF#)); versus set_bit_in_register (0xDEADBEEF); Again, at the call site, the Ada version gives more information to the human programmer, i.e. is more expressive. Expressiveness is not to be confused with conciseness. -- Ludovic Brenta.