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!mx02.eternal-september.org!feeder.eternal-september.org!gandalf.srv.welterde.de!news.jacob-sparre.dk!loke.jacob-sparre.dk!pnx.dk!.POSTED!not-for-mail From: "Randy Brukardt" Newsgroups: comp.lang.ada Subject: Re: Textedit and txt Date: Wed, 6 May 2015 16:23:35 -0500 Organization: Jacob Sparre Andersen Research & Innovation Message-ID: References: <47c7df1e-17c1-44cb-a455-43431f0d39cd@googlegroups.com> <85zj5wb9et.fsf@stephe-leake.org> <4b14659e-8c26-4c0a-8945-a5289740e054@googlegroups.com> <51c639dd-a48c-4130-becd-750cb23094da@googlegroups.com> NNTP-Posting-Host: rrsoftware.com X-Trace: loke.gir.dk 1430947415 3381 24.196.82.226 (6 May 2015 21:23:35 GMT) X-Complaints-To: news@jacob-sparre.dk NNTP-Posting-Date: Wed, 6 May 2015 21:23:35 +0000 (UTC) X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2900.5931 X-RFC2646: Format=Flowed; Original X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.6157 Xref: news.eternal-september.org comp.lang.ada:25741 Date: 2015-05-06T16:23:35-05:00 List-Id: wrote in message news:51c639dd-a48c-4130-becd-750cb23094da@googlegroups.com... On Sunday, April 26, 2015 at 7:52:05 AM UTC-4, Laurent wrote: >> Thanks for the hint. Why hide that in the preferences? Apple has >> sometimes strange ideas. Terminal an pico works too. Not really a fan of >> emacs/aquamacs. Tried once to learn mozart oz as language and they used >> emacs as ide. Didn't really work for me so I gave up. >I'd suggest taking a look at the Reference Manual section on >the Bounded_Strings package. You can create a default Bounded_String >length in a package (say named Common_Defs.ads) using > > Std_Vstring_Length : constant := 256; > package VString is new > Ada.Strings.Bounded.Generic_Bounded_Length(Std_Vstring_Length); On top of this suggestion, I'd suggest defining the conversion operator (AKA unary plus) appropriately: function "+" (Right : VString.Bounded_String) return String renames VString.To_String; function "+" (Right : String) return VString.Bounded_String renames VString.To_Bounded_String; Then you can write: Ada.Text_IO.Put_Line ("read code: " & (+Temp_Record.Code_SIL)); instead of: Ada.Text_IO.Put_Line ("read code: " & Codes.To_String (Temp_Record.Code_SIL)); Note that some people hate using "+" this way, because they think it has something to do with numerics. We really should have something non-specific (say an operator "#"), but the ARG is always split between people that think we already have such an operator ("+") and thus we don't need another one and those that are repulsed by using "+" this way. (Getting these put into the packages themselves failed for similar reasons. Grumble.) In any case, I think Bounded_String and Unbounded_String are unusable without these definitions. So you either have to swallow "+" or forget the packages altogether. Neither is appealing. (I'd prefer a completely different design for both of these packages, so we could add some mechanism to allow direct conversions, but that's likely too radical.) Randy.