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!feeder.eternal-september.org!aioe.org!.POSTED!not-for-mail From: "Dmitry A. Kazakov" Newsgroups: comp.lang.ada Subject: Re: Your wish list for Ada 202X Date: Wed, 23 Apr 2014 09:45:27 +0200 Organization: cbb software GmbH Message-ID: <1y4292c8reke$.10t8zilxfxjqf.dlg@40tude.net> References: <7f1c01c5-3563-4b94-9831-152dbbf2ecdc@googlegroups.com> <1w6eh0aiksmdh$.1h16p7y0b8c6h.dlg@40tude.net> <17twpp4p8u7o$.1idvzaaio4f3t$.dlg@40tude.net> <1wjmcbk375lzk.6o7dpqcp3va3.dlg@40tude.net> <11241mc0j3ewn.14ahwtra3l1i8.dlg@40tude.net> <10o6qo98dwzjs$.rdpzvq7w1lep.dlg@40tude.net> Reply-To: mailbox@dmitry-kazakov.de NNTP-Posting-Host: G+aXx1XI67D34t54ibhUPQ.user.speranza.aioe.org Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Complaints-To: abuse@aioe.org User-Agent: 40tude_Dialog/2.0.15.1 X-Notice: Filtered by postfilter v. 0.8.2 Xref: news.eternal-september.org comp.lang.ada:19513 Date: 2014-04-23T09:45:27+02:00 List-Id: On Tue, 22 Apr 2014 18:23:19 -0500, Randy Brukardt wrote: > "Dmitry A. Kazakov" wrote in message > news:10o6qo98dwzjs$.rdpzvq7w1lep.dlg@40tude.net... > ... >> Which is exactly the problem - this introduces erroneous states, where >> there should be none. From the SW design POV there shall be no way to >> create a closed file, an uninitialized widget, a float with the FPU turned >> off etc. > > I suspect that in the case of files, that would be too limiting to be of > much use. One could not have a container (or array) of files, for instance, > because there would be no way to provide the file names to each element > before it existed. Firstly, this is another language problem, e.g. lack of user-defined aggregates and user-defined array constructors. Secondly, there is a pattern for this. I am using a stock object to initialize such things. Another example where this is needed is a handle wrapping a non null pointer: type Safe_Handle (<>) is new Ada.Finalization.Controlled with private; ... private type Safe_Handle is new Ada.Finalization.Controlled with Object : non null access Object_Type'Class := Stock_Object'Access; end record; In the case of files there already is such stick object: /dev/null. -- Regards, Dmitry A. Kazakov http://www.dmitry-kazakov.de