LWN: Comments on "GNU ed 1.6 released" https://lwn.net/Articles/474004/ This is a special feed containing comments posted to the individual LWN article titled "GNU ed 1.6 released". en-us Mon, 29 Sep 2025 03:01:15 +0000 Mon, 29 Sep 2025 03:01:15 +0000 https://www.rssboard.org/rss-specification lwn@lwn.net GNU ed 1.6 released https://lwn.net/Articles/480875/ https://lwn.net/Articles/480875/ dirtyepic <div class="FormattedComment"> These days? SearchKit.<br> </div> Sun, 12 Feb 2012 04:54:26 +0000 GNU ed 1.6 released https://lwn.net/Articles/474751/ https://lwn.net/Articles/474751/ ndk <div class="FormattedComment"> Ah, those were the days: back in the late 70s/early 80s, we had a Prime 750 running PrimOS (anybody remember those?) with an IBM-inspired line editor from the mid-60s as the system editor: if you think ed is frustrating, you should try that beast. I spent a lot of pleasant all-nighters on a terminal with a 300-baud modem porting the Kernighan &amp; Plauger software tools to PL1/G; of course I started with ed. After that bootstrap step, there was a quantum leap in productivity (and a 1200-baud modem upgrade helped, but not as much). The ed port (and quite a few of the other tools) was actually used in the classroom for a few years, before Prime actually paid somebody to port emacs to their OS.<br> </div> Mon, 09 Jan 2012 15:43:24 +0000 note the consistent user interface https://lwn.net/Articles/474488/ https://lwn.net/Articles/474488/ k8to <div class="FormattedComment"> I learned C++ in a mud environment where all I had was ed. I did a lot of pasting from a local editor with very tightly controlled flow rates.<br> <p> Sometimes I did legitimately fix bugs in source on the server system using ed commands. It was painful.<br> </div> Fri, 06 Jan 2012 01:25:11 +0000 GNU ed 1.6 released https://lwn.net/Articles/474400/ https://lwn.net/Articles/474400/ jhhaller My first editor on Unix was ed, vi and emacs hadn't been written yet. em (ed for mortals) was next. But, then moving to emacs instead of vi, I never really learned much of vi other than a, i, d, r, and x; most of my use of vi consists of colon followed by a ed command. Go to the end of the file, <PRE>:$</PRE> make a copy of a line, <PRE>:.t.</PRE> move 3 lines <PRE>:.,.+2t52 :.,.+2d</PRE> (assuming moving lines forward), and substitute apple for banana <PRE>:g/apple/s//banana/g</PRE> Thu, 05 Jan 2012 17:18:00 +0000 GNU ed 1.6 released https://lwn.net/Articles/474309/ https://lwn.net/Articles/474309/ neilbrown <div class="FormattedComment"> We must never forget the greatest legacy that 'ed' has left us.<br> <p> If 're' is a 'regular expression', then<br> /re/<br> will search for it.<br> /re/p<br> will search and then print.<br> g/re/p<br> will apply this globally - for every line that matches 're', print the line.<br> So if you wanted to write a program that just printed the lines that match a regular expression - what do you call it?<br> <p> </div> Thu, 05 Jan 2012 02:11:04 +0000 GNU ed 1.6 released https://lwn.net/Articles/474186/ https://lwn.net/Articles/474186/ cmccabe <div class="FormattedComment"> Well, I guess you are right. Unicode support, even in higher-level languages, still is not perfect. Disappointing.<br> </div> Wed, 04 Jan 2012 16:33:53 +0000 note the consistent user interface https://lwn.net/Articles/474150/ https://lwn.net/Articles/474150/ tnoo <div class="FormattedComment"> this still breaks on ^C. The source code must be more complex, maybe like this:<br> <p> trap "" SIGINT;while :;do read x;echo \?;done<br> </div> Wed, 04 Jan 2012 11:15:18 +0000 GNU ed 1.6 released https://lwn.net/Articles/474119/ https://lwn.net/Articles/474119/ tialaramex <div class="FormattedComment"> If the higher level language and its associated string manipulation APIs were created in the last decade or so, and by someone with a thorough understanding on Unicode itself and the general problems of different text systems, then yes, maybe.<br> <p> In practice, I can't think of any languages like that. Many of them are built by people who at best assumed other writing systems are just like Latin except with differently shaped squiggles. They often mandate that "text" means "UTF-16 strings" and then blunder into all sorts of problems with filenames, URLs, streams of bytes some idiot stashed in a "text" field on a database, and other things that definitely aren't UTF-16 strings. There may be built-in assumptions about writing direction, the meaning of "character" (a very, very tricky issue) and so on.<br> <p> As a rule of thumb if the language claims to be "high level" and yet it has a "character" data type that's distinct from a string, or can be treated meaningfully as an integer, or it has the same data type for binary data and text, then either they're yanking your chain or they had no idea about Unicode. C has the excuse that Unicode literally didn't exist back then. Languages like Python will have to provide their own excuses.<br> <p> Some more bad signs:<br> <p> • Mentions of the "length" of a string that don't either include or point at a multi-paragraph discussion of what "length" means in this context.<br> <p> • Discussion of collation or "sorting" strings that doesn't mention locale.<br> <p> • A string equality operator or comparison method that doesn't come with a multi-paragraph discussion of Unicode equivalence. <br> <p> Of course a lot of this stuff can be /fixed/ in theory. But fixes after the fact are often messy. The can involve things like deprecated methods on core objects, parallel APIs replacing every mention of character with "string", or even inventing another type "Unicode string" and then going around replacing all the other APIs in the system with Unicode-friendly ones, leaving maintenance programmers to handle the debris.<br> </div> Wed, 04 Jan 2012 02:38:20 +0000 GNU ed 1.6 released https://lwn.net/Articles/474106/ https://lwn.net/Articles/474106/ cmccabe <div class="FormattedComment"> I don't see a reason to use ICU unless you need the functionality that ICU provides. Nearly all of the C programs I've ever written just treat strings as opaque blobs and don't try to do "proper semantic text operations."<br> <p> UTF-8 works great for what I need. My only wish is that it had been invented sooner, so that people didn't come up with N+1 different subtly defective, backwards incompatible "wide character" solutions.<br> <p> If I were performing fancy operations on text, I would probably do it in a higher level language with built-in unicode support. At that point the encoding should be a non-issue (right?) because the high level language abstracts that away.<br> </div> Tue, 03 Jan 2012 23:52:41 +0000 GNU ed 1.6 released https://lwn.net/Articles/474090/ https://lwn.net/Articles/474090/ JoeBuck <div class="FormattedComment"> Yes, ed was optimized for use with DECwriters spitting out characters at 300 baud (and I'm old enough that I actually used it as intended).<br> <p> </div> Tue, 03 Jan 2012 21:00:01 +0000 This is not true... https://lwn.net/Articles/474084/ https://lwn.net/Articles/474084/ khim <p>UTF-8 is not just run-of-the-mill variable-length encoding. Ken Thompson modified original IBM's proposal to make sure most algorithms which treat strings as sequence of 8-bit characters were still usable with UTF-8.</p> <p>This means that yes, you can easily use UTF-8 with programs like GNU ED or GNU M4 which know absolutely nothing about UTF-8 <b>but</b> correctly support 8bit characters in strings.</p> Tue, 03 Jan 2012 20:01:41 +0000 GNU ed 1.6 released https://lwn.net/Articles/474081/ https://lwn.net/Articles/474081/ blitzkrieg3 <div class="FormattedComment"> UTF-8 is a variable width encoding. It sounds like they now have support for something like extended ASCII.<br> </div> Tue, 03 Jan 2012 19:39:23 +0000 GNU ed 1.6 released https://lwn.net/Articles/474080/ https://lwn.net/Articles/474080/ nicku It's strange to relate how happy I was writing all my (mostly Pascal) computing assignments at UNSW in ed on the locally compiled Unix through 2400 bps green terminals in 1986--1989. About twenty of us simultaneously wrote 6809 assembly language programs on a time-share OS/9 system running on one 68000 CPU in an ed-like editor. Tue, 03 Jan 2012 19:38:09 +0000 note the consistent user interface https://lwn.net/Articles/474051/ https://lwn.net/Articles/474051/ NAR <div class="FormattedComment"> Once I had to use a router which had ed (but not vi) installed to edit it's configuration file on the router. For some very simple tasks I actually could edit the file, but for anything complicated it was easier to download the file, edit it with vim, upload, then reload the configuration.<br> </div> Tue, 03 Jan 2012 15:28:01 +0000 GNU ed 1.6 released https://lwn.net/Articles/474042/ https://lwn.net/Articles/474042/ bjartur <div class="FormattedComment"> I think ed is even simpler than that: ed doesn't bother with encoding at all, but leaves the mess to terminals. You should be fine as long as you refrain from inputting partial characters. <br> </div> Tue, 03 Jan 2012 13:15:43 +0000 GNU ed 1.6 released https://lwn.net/Articles/474040/ https://lwn.net/Articles/474040/ sorpigal <div class="FormattedComment"> <font class="QuotedText">&gt; There's no *nice* way to hack in this kind of support after the fact...</font><br> <p> There, fixed it for ya.<br> </div> Tue, 03 Jan 2012 12:55:02 +0000 GNU ed 1.6 released https://lwn.net/Articles/474036/ https://lwn.net/Articles/474036/ mpr22 Even if you ignore IPA, not all Latin-alphabet combining sequences used in the orthography of natural languages have precomposed code points. For example, as far as I know there is still no precomposed code point for n̈ - and yes, this does have a use other than correctly representing the name of a certain fictional heavy metal band. Tue, 03 Jan 2012 12:02:49 +0000 note the consistent user interface https://lwn.net/Articles/474035/ https://lwn.net/Articles/474035/ rsidd Source code for ed: <PRE>while :;do read x;echo \?;done</PRE> <P> (from <A HREF="http://www.gnu.org/fun/jokes/ed.html">here</A>) Tue, 03 Jan 2012 08:09:04 +0000 GNU ed 1.6 released https://lwn.net/Articles/474033/ https://lwn.net/Articles/474033/ ssmith32 <div class="FormattedComment"> <font class="QuotedText">&gt;...There's no hacking in this kind of support after the fact;...</font><br> <p> Yet somehow, this is what always happens :D<br> </div> Tue, 03 Jan 2012 05:56:42 +0000 GNU ed 1.6 released https://lwn.net/Articles/474030/ https://lwn.net/Articles/474030/ wahern <div class="FormattedComment"> Also, it's worth point out, from the FAQ:<br> <p> Q: Doesn’t it cause a problem to have only UTF-16 string APIs, instead of UTF-32 char APIs?<br> <p> A: Almost all international functions (upper-, lower-, titlecasing, case folding, drawing, measuring, collation, transliteration, grapheme-, word-, linebreaks, etc.) should take string parameters in the API, not single code-points (UTF-32). Single code-point APIs almost always produce the wrong results except for very simple languages, either because you need more context to get the right answer, or because you need to generate a sequence of characters to return the right answer, or both. <br> <p> (Source: <a href="http://unicode.org/faq/utf_bom.html">http://unicode.org/faq/utf_bom.html</a>)<br> <p> </div> Tue, 03 Jan 2012 04:04:32 +0000 GNU ed 1.6 released https://lwn.net/Articles/474029/ https://lwn.net/Articles/474029/ wahern <div class="FormattedComment"> My fault for being lazy with the terminology.<br> <p> Question: do all combining sequences have precomposed equivalents. I think all the Latin ones do, but what about other scripts?<br> <p> </div> Tue, 03 Jan 2012 04:02:15 +0000 note the consistent user interface https://lwn.net/Articles/474028/ https://lwn.net/Articles/474028/ tnoo <div class="FormattedComment"> Let's look at a typical novice's session with the mighty ed:<br> <p> golem$ ed<br> <p> ?<br> help<br> ?<br> ?<br> ?<br> quit<br> ?<br> exit<br> ?<br> bye<br> ?<br> hello?<br> ?<br> eat flaming death<br> ?<br> ^C<br> ?<br> ^C<br> ?<br> ^D<br> ?<br> <p> ---<br> <p> Note the consistent user interface and error reportage. Ed is generous enough to flag errors, yet prudent enough not to overwhelm the novice with verbosity.<br> <p> “Ed is the standard text editor.”<br> <p> Ed, the greatest WYGIWYG editor of all.<br> <p> (from <a href="http://www.gnu.org/fun/jokes/ed.msg.html">http://www.gnu.org/fun/jokes/ed.msg.html</a>)<br> </div> Tue, 03 Jan 2012 03:38:55 +0000 GNU ed 1.6 released https://lwn.net/Articles/474027/ https://lwn.net/Articles/474027/ mjg59 <div class="FormattedComment"> From the spec:<br> <p> "UTF-32 encoding form: The Unicode encoding form that assigns each Unicode scalar value to a single unsigned 32-bit code unit with the same numeric value as the Unicode scalar value"<br> <p> So UTF-32 isn't variable length. The sudden rise in the use of emoji and other non-BMP characters means that ignoring the variable length of UTF-16 is already broken in real-world cases in non-CJK markets, too. <br> </div> Tue, 03 Jan 2012 03:34:44 +0000 GNU ed 1.6 released https://lwn.net/Articles/474026/ https://lwn.net/Articles/474026/ wahern <div class="FormattedComment"> Both UTF-16 and UTF-32 are also variable length encodings, it's just that most Windows, Java, etc programmers treat them like fixed length encodings. It mostly works for the time being, but will begin breaking when non-Western markets mature and people start requiring more feature parity when slicing and dicing text without buying special-purpose editing packages.<br> <p> For the time being people have low expectations. But political and technical movements like Simplified Chinese will eventually hit substantial cultural barriers and the push back will require that software handle locales which didn't adapt to western syntax. That will mean following the Unicode rules to a T. To follow the Unicode rules you have to use an API for even simple things like "character" iteration, etc, unless the programming language supports the proper semantic text operations, like Perl6 can over graphemes using it's neat NFG hack. Scripts like Thai have no mandatory punctuation, so again you need to use accessors with a complex built-in rule base to detect, e.g., end-of-sentence. There's no hacking in this kind of support after the fact; it has to be baked into the code.<br> <p> APIs like ICU are huge, but in many cases can make the code more clear. Unfortunately ICU doesn't get used much because the rule tables are so gargantuan that virtual memory explodes (though most of that is mmap'd straight from disk), and programmers are still beholden to their notion of low-level C-like character strings.<br> <p> In 10-20 years we are going to see a surge in demand for I18N and L10N programmers to refactor all the crap hacks that came out of the 1990s, heralded by Microsoft's and Sun's half-hearted adoption of UTF-16.<br> <p> </div> Tue, 03 Jan 2012 03:28:13 +0000 GNU ed 1.6 released https://lwn.net/Articles/474025/ https://lwn.net/Articles/474025/ nescafe <div class="FormattedComment"> q <br> </div> Tue, 03 Jan 2012 01:48:47 +0000 GNU ed 1.6 released https://lwn.net/Articles/474023/ https://lwn.net/Articles/474023/ halfline <div class="FormattedComment"> ? <br> </div> Tue, 03 Jan 2012 01:06:22 +0000 GNU ed 1.6 released https://lwn.net/Articles/474020/ https://lwn.net/Articles/474020/ Karellen <div class="FormattedComment"> I think the only problem with the article is that it means 8-bit character *encodings*, where the encoding of the character set uses 8 bits (e.g. UTF-8), rather than 7 (e.g. UTF-7), regardless of how many bits are required by the character *set* (20 for all proper unicode encodings such as both UTF-7 and UTF-8).<br> <p> Anyway, whatever that wikipedia article means, it's kind of a red herring, as "ed" being 8-bit clean means that it can handle both 8 bit character sets (e.g. ISO-8859-*) and 8-bit character encodings (e.g. UTF-8).<br> <p> </div> Tue, 03 Jan 2012 00:56:56 +0000 GNU ed 1.6 released https://lwn.net/Articles/474017/ https://lwn.net/Articles/474017/ geuder <div class="FormattedComment"> True, but I don't think the wikipedia article you link to is very clear. <br> <p> UTF-8 is not a character set at all, but a variable length encoding of a 16-bit or 32-bit character set. <br> <p> 8 bit cleanliness was a big issue for most Europeans wanting to write anything correctly on a computer in their mother tongue in the early 90s. Most editors could only handle 7 bit character sets without quirks.<br> <p> 8 bit character sets were an intermediate step in the 90s. 8 bits per character are enough for most bigger European languages (But not a single 8 bit character set for all of them) <br> <p> But 8 bits don't help the Asians. They need 16 bits per character at least, and because different sets where needed in Europe it wasn't ideal even there.<br> <p> I think the majority of software in use has been basically 16 bit Unicode for may years now. Windows, Symbian, and Java use true 16 bit wide characters, while all Linux distributions I have used use UTF-8 encoding by default. The nice thing with UTF-8 is that you even can't tell the difference to the old ASCII as long as you stick to 7 bit ASCII characters, because their encoding is identical, 8 bits with the most significant bit being 0.<br> <p> Whether ed supports UTF-8 or not is not said in the announcement. IMHO 8 bit cleanliness defines support of 8 bit character sets, not stripping away or clearing the most significant bit. UTF-8 is more than this, the editor must be able to handle the variable length encoding.<br> <p> But whether it can or cannot be used for writing texts in European languages I use regularly, I don't see a reason why I personally would do it using ed. As long as all American programmers remember every day that the world is not 7 bit and not even all ASCII characters are reachable on the keyboard without using modifier key I'm happy. The original question shows that there is work to do, so excuse my long comment.<br> </div> Tue, 03 Jan 2012 00:35:03 +0000 GNU ed 1.6 released https://lwn.net/Articles/474012/ https://lwn.net/Articles/474012/ andrel It means that this version of ed <a href="https://en.wikipedia.org/wiki/8-bit_clean">works with 8-bit character sets</a>. Mon, 02 Jan 2012 22:39:56 +0000 GNU ed 1.6 released https://lwn.net/Articles/474009/ https://lwn.net/Articles/474009/ johnny <div class="FormattedComment"> What does "8-bit clean" mean? That the code only uses 8-bit variables?<br> </div> Mon, 02 Jan 2012 22:27:43 +0000