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-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,2afae4a128914036 X-Google-Attributes: gid103376,public Path: g2news1.google.com!news2.google.com!fu-berlin.de!uni-berlin.de!not-for-mail From: "Nick Roberts" Newsgroups: comp.lang.ada Subject: Re: wide_string and assertions Date: Fri, 4 Jun 2004 21:42:45 +0100 Message-ID: <2ic566Flqdi5U1@uni-berlin.de> References: <47SdnXI-D-3icyLdRVn-uQ@megapath.net> X-Trace: news.uni-berlin.de ONuk4a3p6cGtzhJeycKCag70H96zTVSaVFuwpKCDb+1MHXi/Q= X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2800.1409 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1409 Xref: g2news1.google.com comp.lang.ada:1108 Date: 2004-06-04T21:42:45+01:00 List-Id: "Randy Brukardt" wrote in message news:47SdnXI-D-3icyLdRVn-uQ@megapath.net... > "Georg Bauhaus" wrote in > message news:c9nj9l$cif$1@a1-hrz.uni-duisburg.de... > > AI-00286 present pragma assert with two arguments, one > > of them a string. (Likewise, exceptions can be raised > > "with a string"). I have some messages I want use as > > the second argument. They contain characters outside > > Latin-1. (And another 8bit character set won't do.) > > > > In an assert(x, y), y has to be static. So I guess for y I > > will have to play tricks and use UTF-8 coding of static > > String values? > > Yes. That seems like a strange answer to me, on its own. Surely the answer must be: yes, if the subsystem (run time system, operating system, development environment, or whatever) that outputs the string can be expected to output UTF-8 (or at least the UCS) correctly; otherwise, no (you must stick to Latin-1). (Maybe this was meant to be implied.) > > Has using Wide_String variants ever been considered? Or > > is there just "no demand"? > > Ada.Exceptions only supports String for exception messages. > Assert just uses that existing mechanism for handling messages. > > As far as demand goes, you're the first person to mention it to my > knowledge -- which is suggests that the demand is low. :-) > > I'd like to see better support for UTF-8, but I don't think anything > sensible would really work in Assert (because the argument is static). Of > course, a function would work when raising with a message: > raise Assert_Error with To_UTF_8 ("Wide_Wide_String"); > so that might be preferable for this purpose. (But you'll probably have to > write the function yourself; there doesn't seem to be much support for > including such functions in the Standard.) I feel that implementations (for which it makes sense) could additionally support alternatives to (NOT overloadings of) Ada.Exceptions.Exception_Message/Name/Information, .Raise_Exception, and pragma Assert with return values or parameters of type Wide_String (and/or Wide_Wide_String) instead of String. Maybe it would not be appropriate for such extensions to be mandated by the primary standard (since they wouldn't be appropriate for many implementations), but perhaps some kind of secondary or informal standard might be a good idea. As an aside, it might be worth just mentioning that the syntax: raise ... with ...; is a proposed (and likely) extension of the raise statement for Ada 200X, and not legal in the current Ada standard. -- Nick Roberts