* Array Of Constant Strings? @ 2003-02-14 2:58 Dr Nancy's Sweetie 2003-02-14 4:28 ` tmoran ` (2 more replies) 0 siblings, 3 replies; 18+ messages in thread From: Dr Nancy's Sweetie @ 2003-02-14 2:58 UTC (permalink / raw) Maybe I'm just doing this wrong, but the only solution I can see looks unreasaonbly verbose. What I want is to set up an array of constant strings, all the same length. I tried using Ada.Strings.Bounded, with something like this: package Name_Package is new Generic_Bounded_Length(7); type Name_String is new Digit_Package.Bounded_String; Name_List : constant array(1..26) of Name_String := ("Anthony", "Barbara", "Claudia", "Deborah" "Elliott", .... and so on. But it complains that: expected private type "Name_String" defined at line 26 found a string type (I sorta expected this to work because a similar initialization is possible with Integers.) I can throw in explicit conversion functions: function To_Name_String(Source: String; Drop: Truncation := Right) return Name_String renames Name_Package.To_Bounded_String; and then make the Name_List this way: Name_List : constant array(1..26) of Name_String := (To_Name_String("Anthony"), To_Name_String("Barbara"), To_Name_String("Claudia"), ... and so on. But that seems really klunky, somehow; like there ought to be a better way to do this than repeating "To_Name_String" dozens of times. It won't let me just say: Name_List : constant array(1..26) of String := ("Anthony", "Barbara", "Claudia", "Deborah" "Elliott", .... and so on. because, as it informs me, unconstrained element type in array declaration So is there some better way to do this? I primarily speak C, so I'm used to (and maybe spoiled by 8-) a little type flexibility which isn't here to be had. The strings don't have to be bounded: the input is guaranteed to be exactly a given length, so fixed-length strings would be fine. But I couldn't get that to work either. My situation is that I have a bunch of strings, all the same length, and they'll never ever change. All I want to do is stick them in an array so later I can read in a strings and see if it matches one on my list, and if so in what position. What's the "best" (for some definition of "best") way to do that? Darren Provine ! kilroy@elvis.rowan.edu ! http://www.rowan.edu/~kilroy "Many verbal attacks are part of someone's aim to establish their rank in a dominance hierarchy, the same sort of behavior common among nesting fowl." -- Daniel Mocsny ^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: Array Of Constant Strings? 2003-02-14 2:58 Array Of Constant Strings? Dr Nancy's Sweetie @ 2003-02-14 4:28 ` tmoran 2003-02-14 7:28 ` Dale Stanbrough [not found] ` <19guh-2f4.ln1@beastie.ix.netcom.com> 2 siblings, 0 replies; 18+ messages in thread From: tmoran @ 2003-02-14 4:28 UTC (permalink / raw) > It won't let me just say: > > Name_List : constant array(1..26) of String := > ("Anthony", "Barbara", "Claudia", "Deborah" "Elliott", > .... and so on. > > because, as it informs me, > > unconstrained element type in array declaration But it *will* let you say: subtype Name_Strings is String(1 .. 7); Name_List : constant array(1 .. 26) of Name_Strings := ("Anthony", "Barbara", "Claudia", "Deborah", "Elliott", etc. ^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: Array Of Constant Strings? 2003-02-14 2:58 Array Of Constant Strings? Dr Nancy's Sweetie 2003-02-14 4:28 ` tmoran @ 2003-02-14 7:28 ` Dale Stanbrough 2003-02-14 7:47 ` tmoran [not found] ` <19guh-2f4.ln1@beastie.ix.netcom.com> 2 siblings, 1 reply; 18+ messages in thread From: Dale Stanbrough @ 2003-02-14 7:28 UTC (permalink / raw) In article <RXY2a.4080$io.157916@iad-read.news.verio.net>, Dr Nancy's Sweetie <kilroy@elvis.rowan.edu> wrote: > Maybe I'm just doing this wrong, but the only solution I can see > looks unreasaonbly verbose. > > What I want is to set up an array of constant strings, all the same > length. I tried using Ada.Strings.Bounded, with something like > this: > > package Name_Package is new Generic_Bounded_Length(7); > > type Name_String is new Digit_Package.Bounded_String; > > Name_List : constant array(1..26) of Name_String := > ("Anthony", "Barbara", "Claudia", "Deborah" "Elliott", > .... and so on. > a more versatile solution would be to use aliased strings, and string pointers. type String_Ptr is access all String; -- defined in the Ada hierachy somewhere... type Strings is array (Positive range <>) of String_Ptr; a : aliased String := "Anthony"; b : aliased String := "Bert"; c : aliased String := "Carla"; List : Strings := (a'Access, b'access, c'access); (or should that be 'Unrestricted_Access?) not as compact as C, but you end up with the same effect. Dale ^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: Array Of Constant Strings? 2003-02-14 7:28 ` Dale Stanbrough @ 2003-02-14 7:47 ` tmoran 2003-02-14 10:06 ` Dale Stanbrough 0 siblings, 1 reply; 18+ messages in thread From: tmoran @ 2003-02-14 7:47 UTC (permalink / raw) > a more versatile solution would be to use aliased strings, and string In what way is that better than the simple solution of saying you've got names, which are 7 character strings, and you've got an array of them? ^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: Array Of Constant Strings? 2003-02-14 7:47 ` tmoran @ 2003-02-14 10:06 ` Dale Stanbrough 0 siblings, 0 replies; 18+ messages in thread From: Dale Stanbrough @ 2003-02-14 10:06 UTC (permalink / raw) In article <ua13a.94318$SD6.5604@sccrnsc03>, tmoran@acm.org wrote: > > a more versatile solution would be to use aliased strings, and string > In what way is that better than the simple solution of saying you've > got names, which are 7 character strings, and you've got an array > of them? It can be used in situations where you won't have strings all of the same length. I don't know the application (of course) but it could be that at some time in the future different length strings could be used. Dale ^ permalink raw reply [flat|nested] 18+ messages in thread
[parent not found: <19guh-2f4.ln1@beastie.ix.netcom.com>]
* Re: Array Of Constant Strings? [not found] ` <19guh-2f4.ln1@beastie.ix.netcom.com> @ 2003-02-14 19:41 ` Jeffrey Carter 2003-02-14 20:38 ` tmoran ` (2 more replies) 0 siblings, 3 replies; 18+ messages in thread From: Jeffrey Carter @ 2003-02-14 19:41 UTC (permalink / raw) Dennis Lee Bieber wrote: > Ah, but perusal of the reference manual appendix A indicates that > bounded string is a private type, which means no direct assignment to > it. This is not right. Assignment is defined for private types; assignment is not defined for limited types. Maybe that's not what was meant, but it's what it looks like to me. >>I can throw in explicit conversion functions: >> >> function To_Name_String(Source: String; >> Drop: Truncation := Right) >> return Name_String renames >> Name_Package.To_Bounded_String; >> >>and then make the Name_List this way: >> >> Name_List : constant array(1..26) of Name_String := >> (To_Name_String("Anthony"), >> To_Name_String("Barbara"), >> To_Name_String("Claudia"), >> ... and so on. Name_Package.To_Bounded_String returns Name_Package.Bounded_String, not Name_String, which is a different type. This renaming is not accepted by GNAT 3.15p (assuming appropriate visibility of Truncation and Right). In any event, the derived type Name_String inherits the function To_Bounded_String which is directly visible, so no renaming is necessary. Some people like to use a unary operator such as "+" for common conversions. There was a proposal for the Ada 95 revision to allow a special unary operator with no predefined meaning for this purpose. It wasn't accepted, and that turns out to be good, since the character for the operator symbol that would have been used has now been changed to the Euro symbol. Personally I think "\" would be a good operator for this simply to give C people fits :) So, if you rename To_Bounded_String to "+", you could write Name_List : constant array (1 .. 26) of Name_String := (+"Anthony", +"Barbara", +"Claudia", ... and so on. I don't like this, though. One of Ada's explicit design goals is to emphasize ease of reading over ease of writing, and "To_Bounded_String" is clearer than "+" to the reader. This is the opposite of C's philosophy, in which ease of writing is everything and ease of reading is unimportant. Ada.Strings.Bounded.Generic_Bounded_Length is intended to be mentioned in a use clause; it's written in such a way that things are still easy to understand in that case. So I would recommend: package Package_Name_Is_An_Elephant is new Generic_Bounded_Length (7); use Package_Name_Is_An_Elephant; Name_List : constant array (1 .. 26) of Bounded_String := (To_Bounded_String ("Anthony"), ...); If all the strings are always the same length, then using fixed length strings is even simpler. However, I would tend to be suspicious of such a requirement; things like that are almost always changed later. > with Ada.Strings.Fixed; use Ada.Strings.Fixed; > procedure aoc is > type Name_String is new String(1..7); > > Name_List : constant array(1..5) of Name_String := > ("Anthony", > "Barbara", > "Claudia", > "Deborah", > "Elliott" ); > begin > Null; > end aoc; Why is Ada.Strings.Fixed mentioned here? It's not used anywhere. -- Jeff Carter "Spam! Spam! Spam! Spam! Spam! Spam! Spam! Spam!" Monty Python's Flying Circus ^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: Array Of Constant Strings? 2003-02-14 19:41 ` Jeffrey Carter @ 2003-02-14 20:38 ` tmoran [not found] ` <e0q0i-n14.ln1@beastie.ix.netcom.com> 2003-02-22 19:31 ` Robert A Duff 2 siblings, 0 replies; 18+ messages in thread From: tmoran @ 2003-02-14 20:38 UTC (permalink / raw) >If all the strings are always the same length, then using fixed length >strings is even simpler. However, I would tend to be suspicious of such >a requirement; things like that are almost always changed later. Plug: One of the packages I recently posted (www.adapower.com/os/notify.html) is WORM_Str - Write Once Read Many Strings. It's exactly intended for situations where you never delete from a table of strings. Name_Store : WORM_Str.Store_Type(Max_Strings=> some number Max_Characters=> another number Task_Safe=> boolean ... WORM_Str.Add(Name_Store, "Anthony", a); WORM_Str.Add(Name_Store, "Barbara", b); WORM_Str.Add(Name_Store, "Joe", c); etc, and Ada.Text_IO.Put(WORM_Str.Get(Name_Store, b)); -- or whatever >array so later I can read in a strings and see if it matches one on WORM_Str also includes an internal subpackage that adds binary search and sorted dump capabilities. WORM_Str is not OS, compiler, or library dependent, but just plain Ada. ^ permalink raw reply [flat|nested] 18+ messages in thread
[parent not found: <e0q0i-n14.ln1@beastie.ix.netcom.com>]
* Re: Array Of Constant Strings? [not found] ` <e0q0i-n14.ln1@beastie.ix.netcom.com> @ 2003-02-15 22:28 ` Jeffrey Carter 0 siblings, 0 replies; 18+ messages in thread From: Jeffrey Carter @ 2003-02-15 22:28 UTC (permalink / raw) Dennis Lee Bieber wrote: > > I think what I was trying to get at was bounded strings aren't > "compiler recognized" (native fixed String), so the compiler couldn't > produce the proper type from a string literal. <does that make more > sense?> I think so. I would put it as, "Bounded_String is not a string type, so a string literal cannot be used where a Bounded_String is required.". -- Jeff Carter "Perfidious English mouse-dropping hoarders." Monty Python & the Holy Grail ^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: Array Of Constant Strings? 2003-02-14 19:41 ` Jeffrey Carter 2003-02-14 20:38 ` tmoran [not found] ` <e0q0i-n14.ln1@beastie.ix.netcom.com> @ 2003-02-22 19:31 ` Robert A Duff 2003-04-14 18:43 ` Dr Nancy's Sweetie 2 siblings, 1 reply; 18+ messages in thread From: Robert A Duff @ 2003-02-22 19:31 UTC (permalink / raw) Jeffrey Carter <jrcarter@acm.org> writes: > Name_List : constant array (1 .. 26) of Name_String := > (+"Anthony", > +"Barbara", > +"Claudia", > ... and so on. > > I don't like this, though. One of Ada's explicit design goals is to > emphasize ease of reading over ease of writing, and "To_Bounded_String" > is clearer than "+" to the reader. This is the opposite of C's > philosophy, in which ease of writing is everything and ease of reading > is unimportant. I don't agree. I think putting To_Bounded_String all over the place makes the code *less* readable. Bounded_String is, conceptually, a string type (even though the RM doesn't say so), so string literals ought to be allowed for it. Using varying-length strings should be just as painless as using Standard.String; literals, array indexing, etc, should be allowed without cluttering the code with explicit conversion operations that don't really do anything interesting. > If all the strings are always the same length, then using fixed length > strings is even simpler. However, I would tend to be suspicious of such > a requirement; things like that are almost always changed later. Well, we don't know why the OP wants same-length strings, but I agree -- such a restriction seems suspicious. - Bob ^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: Array Of Constant Strings? 2003-02-22 19:31 ` Robert A Duff @ 2003-04-14 18:43 ` Dr Nancy's Sweetie 2003-04-15 11:36 ` Georg Bauhaus 0 siblings, 1 reply; 18+ messages in thread From: Dr Nancy's Sweetie @ 2003-04-14 18:43 UTC (permalink / raw) Last February, I wrote about setting arrays of constant strings that were always the same length and never changed. I got some useful help on the subject, and a few people expressed concerns such as: > If all the strings are always the same length, then using fixed > length strings is even simpler. However, I would tend to be > suspicious of such a requirement; things like that are almost > always changed later. and > Well, we don't know why the OP wants same-length strings, but > I agree -- such a restriction seems suspicious. I wanted to reply at the time, but couldn't, because the question went to my version of the sample solution of a problem for a programming contest. Keeping the problem a secret before the contest is obviously necessary. As we've had the contest (last Saturday), I can explain. The problem involved parsing out the 95 bits encoded by a UPC-A bar code, with the bits represented as a string of 1s and 0s. You can read the whole thing at <http://elvis.rowan.edu/hspc/>, but the short version is that each digit in the UPC code is represented by 7 bits, and so the student programs have to split the input string into 7-character chunks and then check each substring against a table to see which digit it's supposed to be. Such a limitation is usually a bad idea, but (a) the UPC-A code is not likely to change much any time soon, given the huge investment in equipment which currently supports it, and (b) for the contest problem, I get to define any limits I like. 8-) The relevant snippets of code are here: --------------- -- Constants -- values from problem description --------------- Bit_String_Size : constant Integer := 7; [...] subtype Bit_String is String(1..Bit_String_Size); [...] -- type for bitstring lookup table type Encoding_Array is array(0..9) of Bit_String; -- Lookup tables for extracted bit strings -- (encodings taken from problem description) Left_Encoding : constant Encoding_Array := ("0001101", "0011001", "0010011", "0111101", "0100011", "0110001", "0101111", "0111011", "0110111", "0001011"); Right_Encoding : constant Encoding_Array := ("1110010", "1100110", "1101100", "1000010", "1011100", "1001110", "1010000", "1000100", "1001000", "1110100"); There are other ways to attack this, of course (make a 128-entry table and interpret the strings as binary numbers to give a direct lookup, eg), but I wanted a program whose operation would be understandable to high school students. Thanks for all your help! Darren Provine ! kilroy@elvis.rowan.edu ! http://www.rowan.edu/~kilroy "Fred Rogers was not only the nicest man I ever met, he was the nicest man ANYONE ever met." -- Robert X. Cringely ^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: Array Of Constant Strings? 2003-04-14 18:43 ` Dr Nancy's Sweetie @ 2003-04-15 11:36 ` Georg Bauhaus 2003-04-15 13:40 ` Dr Nancy's Sweetie 0 siblings, 1 reply; 18+ messages in thread From: Georg Bauhaus @ 2003-04-15 11:36 UTC (permalink / raw) Dr Nancy's Sweetie <kilroy@elvis.rowan.edu> wrote: : : The relevant snippets of code are here: "The languages allowed for the 2003 contest are C, C++, Java, QuickBasic, and Visual Basic." How is that? ^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: Array Of Constant Strings? 2003-04-15 11:36 ` Georg Bauhaus @ 2003-04-15 13:40 ` Dr Nancy's Sweetie 2003-04-15 15:13 ` Georg Bauhaus 0 siblings, 1 reply; 18+ messages in thread From: Dr Nancy's Sweetie @ 2003-04-15 13:40 UTC (permalink / raw) Georg Bauhaus <sb463ba@d2-hrz.uni-duisburg.de> asked, of the programming contest I mentioned earlier: > "The languages allowed for the 2003 contest are C, C++, Java, > QuickBasic, and Visual Basic." > > How is that? The contest is open to any high school in south Jersey whose team wins at the county level. In order to ensure fairness, we allow the students to program using whatever language and environment they have been learning in their classes. The union of all the languages in use at all the schools in half a state turns out to be pretty big. One of the reasons I decided to go with Ada for my canonical sample solution is that the language is reasonably readable to anyone who knows much about programming. (My solution isn't up on the site yet, so the teachers can assign the problem for homework if they want.) The schools teaching AP courses tend to use the language of the AP exam, which is currently C++. Next year, the AP test is going to switch from C++ to Java, and many of the schools will be switching as well. My own feelings are that C and C++ are not good languages for teaching a first class in programming, and given what I saw of QuickBasic I'm amazed that anyone uses it for anything. But I don't get to make those choices for other people. Darren Provine ! kilroy@elvis.rowan.edu ! http://www.rowan.edu/~kilroy "It is practically impossible to teach good programming style to students that have had prior exposure to BASIC: as potential programmers they are mentally mutilated beyond hope of regeneration." -- Edsger W. Dijkstra, SIGPLAN Notices, Volume 17, Number 5 ^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: Array Of Constant Strings? 2003-04-15 13:40 ` Dr Nancy's Sweetie @ 2003-04-15 15:13 ` Georg Bauhaus 2003-04-16 2:17 ` Matthew Heaney 0 siblings, 1 reply; 18+ messages in thread From: Georg Bauhaus @ 2003-04-15 15:13 UTC (permalink / raw) Dr Nancy's Sweetie <kilroy@elvis.rowan.edu> wrote: : One of the reasons I decided to go with Ada for my canonical sample : solution is that the language is reasonably readable to anyone who knows : much about programming. (My solution isn't up on the site yet, so the : teachers can assign the problem for homework if they want.) Will you collect a few impressions students have of the readability of Ada programs? (As this might add more substance to the argument that Ada syntax has advantages.) -- Georg ^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: Array Of Constant Strings? 2003-04-15 15:13 ` Georg Bauhaus @ 2003-04-16 2:17 ` Matthew Heaney 2003-04-16 16:35 ` Chad R. Meiners 2003-04-16 21:03 ` Georg Bauhaus 0 siblings, 2 replies; 18+ messages in thread From: Matthew Heaney @ 2003-04-16 2:17 UTC (permalink / raw) Georg Bauhaus <sb463ba@d2-hrz.uni-duisburg.de> wrote in message news:<b7h7i3$op4$1@a1-hrz.uni-duisburg.de>... > > Will you collect a few impressions students have of the > readability of Ada programs? (As this might add more substance to > the argument that Ada syntax has advantages.) Well, here's one case where the C syntax is much simpler. In order to declare an array of strings in C, all I have to do is: const char* sa[] = { "now", "is", "the", "time" }; To do the equivalent in Ada, I'd have to do this: type String_Constant_Access is access constant String; type String_Array is array (Positive range <>) of String_Constant_Access; Now_String : aliased constant String := "now"; Is_String : aliased constant String := "is"; The_String : aliased constant String := "the"; Time_String : aliased constant String := "time"; SA : constant String_Array := (Now_String'Access, Is_String'Access, The_String'Access, Time_String'Access); Tucker showed this on CLA once: SA : constant String_Array := (new String'("now"), new String'("is"), new String'("the"), new String'("time")); Since all the string literals have static values, then no heap is really allocated. But this is really a compiler optimization -- I don't know whether you can really depend on it. ^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: Array Of Constant Strings? 2003-04-16 2:17 ` Matthew Heaney @ 2003-04-16 16:35 ` Chad R. Meiners 2003-04-16 21:03 ` Georg Bauhaus 1 sibling, 0 replies; 18+ messages in thread From: Chad R. Meiners @ 2003-04-16 16:35 UTC (permalink / raw) "Matthew Heaney" <mheaney@on2.com> wrote in message news:1ec946d1.0304151817.7182ecd8@posting.google.com... > Georg Bauhaus <sb463ba@d2-hrz.uni-duisburg.de> wrote in message news:<b7h7i3$op4$1@a1-hrz.uni-duisburg.de>... > > > > Will you collect a few impressions students have of the > > readability of Ada programs? (As this might add more substance to > > the argument that Ada syntax has advantages.) > > Well, here's one case where the C syntax is much simpler. In order to > declare an array of strings in C, all I have to do is: > Tucker showed this on CLA once: > > SA : constant String_Array := > (new String'("now"), > new String'("is"), > new String'("the"), > new String'("time")); > > Since all the string literals have static values, then no heap is > really allocated. But this is really a compiler optimization -- I > don't know whether you can really depend on it. Do you make it standard practice to second guess the compiler? As I recalled to do so is usually a bad idea. If it makes so much of a differencem, test your given compiler and complain to the vendor if it doesn't perform such an optimization. ^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: Array Of Constant Strings? 2003-04-16 2:17 ` Matthew Heaney 2003-04-16 16:35 ` Chad R. Meiners @ 2003-04-16 21:03 ` Georg Bauhaus 2003-04-17 17:53 ` Robert A Duff 1 sibling, 1 reply; 18+ messages in thread From: Georg Bauhaus @ 2003-04-16 21:03 UTC (permalink / raw) Matthew Heaney <mheaney@on2.com> wrote: : : Well, here's one case where the C syntax is much simpler. In order to : declare an array of strings in C, all I have to do is: Should programming languages have string literals at all? I sometimes wonder. : : const char* sa[] = : { : "now", [...] -- Georg ^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: Array Of Constant Strings? 2003-04-16 21:03 ` Georg Bauhaus @ 2003-04-17 17:53 ` Robert A Duff 2003-04-17 20:34 ` Georg Bauhaus 0 siblings, 1 reply; 18+ messages in thread From: Robert A Duff @ 2003-04-17 17:53 UTC (permalink / raw) Georg Bauhaus <sb463ba@d2-hrz.uni-duisburg.de> writes: > Should programming languages have string literals at all? > I sometimes wonder. Heh?! - Bob ^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: Array Of Constant Strings? 2003-04-17 17:53 ` Robert A Duff @ 2003-04-17 20:34 ` Georg Bauhaus 0 siblings, 0 replies; 18+ messages in thread From: Georg Bauhaus @ 2003-04-17 20:34 UTC (permalink / raw) Robert A Duff <bobduff@shell01.theworld.com> wrote: : Georg Bauhaus <sb463ba@d2-hrz.uni-duisburg.de> writes: : :> Should programming languages have string literals at all? :> I sometimes wonder. : : Heh?! The reason is that I see many situations where a "string literal loading mechanism" is preferable. Here are some: - In many cases programs that do string processing get their strings from outside the program, not from literals in the program text. No string literals here. - String literals are hopelessly scattered throughout programs. (They need not, but they are, for example ad hoc diagnostic messages.) See below. - String literals are rarely typed (other than being a string). That is, string values of the same type are used in very different situations. That is, they defeat explicit abstraction, even though their content might imply the presence of abstraction. (Could be done with wrapper types, but is it done regularly?) - String literals tend to follow their own non-Ada syntax. (Which, again, is not reflected in their type.) - Lots of textual data can be considered data with a structure, but not just a sequence of characters. String literals don't help here. - Often, string literals are in the way of internationalization (That's one reason for the mechanism called "externalising strings" in some IDEs.) (All this doesn't mean I wouldn't be missing string literals for example to quickly add some tracing output.) Some of the strings mentiones must of course come from somewhere, so someone must write them or say them, and some strings must enter program text, for example in exception messages. O.K. So, absent a "string loading mechanism", the strings could at least be named using constants, declared in some packages that group them together according to some predicates like for example, "this is an error message about erroneous input". It is much easier to go from there to internationalisation, than if you had all the strings scattered throughout the program. Consider a message on a display of a teller machine, in Russian, outside Russia. It has been a string literal in the program driving the machine... If there were no string literals, then wouldn't you be forced to just circumvent this deplorable incident? It is so easy, and usual, to (mis)place string literals in program text that people easily forget these issues. This is why I sometimes wonder whether a programming language without string literals is going to be an improvement. Might there not be a causal relation between the presence of string literals in programming languages (bad) and a templates mechanism (Form-Letter Programming) considered a programming pearl (good)? ^ permalink raw reply [flat|nested] 18+ messages in thread
end of thread, other threads:[~2003-04-17 20:34 UTC | newest] Thread overview: 18+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2003-02-14 2:58 Array Of Constant Strings? Dr Nancy's Sweetie 2003-02-14 4:28 ` tmoran 2003-02-14 7:28 ` Dale Stanbrough 2003-02-14 7:47 ` tmoran 2003-02-14 10:06 ` Dale Stanbrough [not found] ` <19guh-2f4.ln1@beastie.ix.netcom.com> 2003-02-14 19:41 ` Jeffrey Carter 2003-02-14 20:38 ` tmoran [not found] ` <e0q0i-n14.ln1@beastie.ix.netcom.com> 2003-02-15 22:28 ` Jeffrey Carter 2003-02-22 19:31 ` Robert A Duff 2003-04-14 18:43 ` Dr Nancy's Sweetie 2003-04-15 11:36 ` Georg Bauhaus 2003-04-15 13:40 ` Dr Nancy's Sweetie 2003-04-15 15:13 ` Georg Bauhaus 2003-04-16 2:17 ` Matthew Heaney 2003-04-16 16:35 ` Chad R. Meiners 2003-04-16 21:03 ` Georg Bauhaus 2003-04-17 17:53 ` Robert A Duff 2003-04-17 20:34 ` Georg Bauhaus
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox