Hi Andrew,

Andrew Moore wrote:
Antonio Diaz writes:
| Sorry for taking so long. I have finally reported the problems with
| the 'c' and 'i' commands here:
| http://austingroupbugs.net/view.php?id=1130

Your rationale for rejecting 0c is based on implementation details.

No, it is not.

Per BSD ed man page, which includes GNU ed 0.2:

     One exception to the rule that addresses represent line numbers is the
      address 0 (zero).  This means "before the first line", and is legal wher-
      ever it makes sense.

This is a general rule.  In the particular case of the command 'c',
address 0 never makes sense, except as a synonym for 1.

In the particular case of the 'c' command, address 0 never makes sense.

By analogy, think of military time, where 24:00 is the same as 00:00
(i.e., midnight).

If this were true in ed, then '$+1' would be a synonym for 1. But in ed, '$+1' is neither a valid address nor a synonym for anything.

Address 0 represents a place "before the first line". It makes sense where a place is needed, for example a place where text will be appended. Commands like 'c', 'd' and' 'j' need real line addresses, because they operate on lines, not in places. The line "before the first line" can't be replaced, deleted or joined, because it does not exist.

Best regards,

bug-ed mailing list

Reply via email to