On 2018-02-17, at 08:24:38, Robin Vowels wrote: > >>>> The prior declaration is (almost) necessary for single-pass compilation. >>> No it isn't. >>> XPL is a single-pass compiler, and declaration of identifiers >>> is not required. >> I said "almost". > > "Almost" was in parentheses. > > Whether almost necessary or necessary, it is not true. > Declarations of labels are not required. > I've worked maintaining and extehding a Pascal compiler. If the requirement for label declarations were removed some small amount of additional code and coding would have been required when both were expensive. But it was probably a false economy to shift a cost from the supplier side to the consumer side.
And earlier Pascal compilers had a loophole where an identifier in an outer scope might be referenced prior to its declaration in an inner scope. I added a check, calling that a syntax error. Some languages consider the scope of an identifier to go from the point of its declaration to the end of the block -- prior to that declaration the identifier in the outer block may be used. On 2018-02-17, at 08:31:57, Robin Vowels wrote: > >> With suitably unrestricted identifier length, alphanumeric labels >> have more evocative value than numbers. > > With names, you don't know where to look (up or down). > > With integers, provided that they are arranged in increasing order, > you know where to look. > o One might adopt a convention such as "L0123_process_transaction:" to keep labels in lexical order and retain evocative value. o Most development systems, even mere editors, make it easy to find any occurrence of a symbol. o Do Assembler programmers find much value in keeping labels in lexical order? I know that seems to be the custom more in conditional assembly than in executable code. o Seriously? I once had a supervisor who, based on experience in previous employment, insisted that all our FORTRAN subroutines have names incorporating a revision level, such as: SUBROUTINE A123V45 C (Use this name in CALLs.) ENTRY PROCESS ... RETURN END The subroutine name appeared in the load map; the entry name did not. Help desk personnel were bemused when I went to them with a problem and showed them a map ("Hey, Nick, look what this guy's manager made him do!") > Rarely do I use FORMAT statements in any language. > FORTRAN (formerly?) required them. -- gil