jwg1@bunny.UUCP (James W. Gish) (12/22/88)
One of the things that drove me nuts about Simula 67 was the absence of a concatenation operator. It did have a TEXT attribute called CONCAT, but it was rather unwieldy to use if you had to do much string processing at all. Unfortunately, unless I missed something, Eiffel doesn't even have a CONCAT feature for STRING. It does have prepend and append, but they change the string they are applied to. It would be nice to also have something like this as a feature of STRING: cat (s: STRING): STRING is -- Concatenate a copy of s to current string and return it local newstring: STRING; do newstring.Create( current.length + s.length ); newstring := Current.duplicate; newstring.append( s ); Result := newstring.duplicate end; -- cat Thus, x: STRING is "Foo"; putstring( x.cat("f").cat("a").cat("h!") ); yields: "Foofah!" without changing x. Try to do that with append ! Of course, "a".cat( x ) is NOT valid. Maybe this makes sense from some point of view, but certainly not from one of convenient language features. Cheers. -- Jim Gish GTE Laboratories, Inc., Waltham, MA CSNET: jgish@gte.com UUCP: ..!harvard!bunny!jwg1
jwg1@bunny.UUCP (James W. Gish) (12/22/88)
In article <6385@bunny.UUCP> jwg1@bunny.UUCP (that's me) wrote: >One of the things that drove me nuts about Simula 67 was the absence >of a concatenation operator. It did have a TEXT attribute called >CONCAT, but it was rather unwieldy to use if you had to do much string >processing at all. I realized after I posted this, that Simula did NOT have a CONCAT TEXT attribute. In fact, it was less well equipted than Eiffel since it didn't have an append or prepend. It's been so long since I've been fortunate enough to use Simula, that I forgot that I had my own concat function. My apologies to other Simula aficianados for the incorrect info. In all fairness to Eiffel, so far I think it looks like a very good language. And it good be a great language if minimal steps are taken to add certain language features. For example, a Loop construct with an exit and a Case statement are really needed. The decision to have only an "until" clause, and not provide a "while" clause is a mistake. Some loop conditions read much better as "while" clauses, and if they read better, there probably is a better chance of them being written correctly. Although the designers goal of keeping the language simple is a noble one, without certain powerful yet elegant capabilities, like loop/exit, it becomes tedius to write large programs. I realize that the preference for certain language features is subjective, but I think Eiffel needs some "shaking out" to determine what needs to be added. I hope that the members of this newsgroup can make a positive contribution to doing just that. -- Jim Gish GTE Laboratories, Inc., Waltham, MA CSNET: jgish@gte.com UUCP: ..!harvard!bunny!jwg1
newsuser@LTH.Se (LTH network news server) (12/28/88)
>One of the things that drove me nuts about Simula 67 was the absence >of a concatenation operator. >... >Unfortunately, unless I missed something, Eiffel doesn't even have a >CONCAT feature for STRING. It does have prepend and append, but they >change the string they are applied to. The current standard of Simula DOES have a text concatenation operation. This operator always creates a new text object and does not change any of the operands. Both constants and variables can be handled by the operator. Example: begin text x = "Foo"; ! --- Declaration of text constant ---; sysout.outtext(x & "f" & "a" & "h!"); end; This program yields "Foofah!" on the standard output. The current standard of Simula is published as a Swedish national standard document: SS 636114 (ISBN 91-7162-234-9). It is available via all other national standardization bodies. (And via Simula vendors.) --- Gorel Hedin Dept. of Computer Science. Lund Institute of Technology, Sweden gorel@dna.lth.se