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=unavailable 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!feeder.eternal-september.org!aioe.org!.POSTED!not-for-mail From: "Dmitry A. Kazakov" Newsgroups: comp.lang.ada Subject: Re: Community Input for the Maintenance and Revision of the Ada Programming Language Date: Sat, 19 Aug 2017 19:09:04 +0200 Organization: Aioe.org NNTP Server Message-ID: References: <79e06550-67d7-45b3-88f8-b7b3980ecb20@googlegroups.com> <9d4bc8aa-cc44-4c30-8385-af0d29d49b36@googlegroups.com> <1395655516.524005222.638450.laguest-archeia.com@nntp.aioe.org> <4527d955-a6fe-4782-beea-e59c3bb69f21@googlegroups.com> <22c5d2f4-6b96-4474-936c-024fdbed6ac7@googlegroups.com> <3f04ecdc-2672-4051-948f-37ce5446dbac@googlegroups.com> NNTP-Posting-Host: MajGvm9MbNtGBKE7r8NgYA.user.gioia.aioe.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit X-Complaints-To: abuse@aioe.org User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.3.0 X-Notice: Filtered by postfilter v. 0.8.2 Content-Language: en-US Xref: news.eternal-september.org comp.lang.ada:47752 Date: 2017-08-19T19:09:04+02:00 List-Id: On 2017-08-19 18:38, Shark8 wrote: > On Saturday, August 19, 2017 at 2:55:10 AM UTC-6, Dmitry A. Kazakov wrote: >> On 2017-08-19 03:24, Shark8 wrote: >> >>> Moreover, thinking of directories in terms of strings leads to >>> string manipulation for referring and it is *easy* to make errors there. >> >> Exactly, but the problem is the file type system. The file path type >> must be a subtype of a universal string type in order to be able to write: >> >> Open ("my_file.txt") >> > > But the file path should NOT be inherently a string, of any type, it > should be a "directory-type" File path type, not {absolute|relative} directory type. > -- and any to/from string conversions (say > from external sources) should be done properly -- that's the whole point > I'm making: a directory is NOT a string, nor should we use strings > [natively] to represent them. File name encoded in a string is the normal use case most of the time. I agree that using strings makes it non-portable since string representations vary from OS to OS. Yet it is how things are. >> instead of something like: >> >> Open >> ( Current_Node + >> Current_Directory + >> To_File_Name ("my_file") + >> To_MIME_Type ("txt") >> ) > > Why would we need something like the above? You need literal or aggregates or any other form to specify a value of the file path in Open. I used an expression. BTW, it would be portable too. > Besides, the Open function having the implicit parameter of Location > defaulting to the "current location" would take care of half of that. This works only with type conversions or massive overloading. Which was my point. In order to have this mess typed, and you correctly said that it must be, you will need *separate* types for: - Node / device - Absolute directory - Relative directory - Simple name - MIME type (extension) - File version / change number (e.g. for VMS or source control systems) - File name (simple name, MIME type, version number) - Directory name (node, directory) - File path (node, directory, name, MIME type, version number) If Open were defined on file path, then a partial name would not match, unless converted implicitly, e.g. by adding directory name. -- Regards, Dmitry A. Kazakov http://www.dmitry-kazakov.de