Date: Mon, 10 Jan 2011 19:06:14 -0000 From: "Bob Walkden" <bob@web-options.com> ... the Modula-2 WITH statement, which was a way to avoid writing the record name against every component of the record.
eg VAR r: RECORD a,b : CARDINAL END ... WITH r DO a := b END instead of R.a := R.b;
This reminds me of an experience I had working on a large Delphi Pascal codebase a few years ago, where previous programmers had knocked themselves out using this form of WITH liberally to save typing at the expense of clarity. However, it was pointed out to me that it's actually worse than the clarity issue; in a statement block like: WITH r, s, t DO ... END (which is allowed in Delphi), the whole *meaning* of the statement block might change if somebody adds a field to one of the record definitions which happens to coincide with an already-used field in one of the other records in the WITH. I instituted a(n only slightly tongue-in-cheek) rule that no-one was allowed to check any unit back into the source-code control system unless they had removed several WITH statements.
participants (1)
-
Paul Reed