Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.compilers > #3187
| From | robin51@dodo.com.au |
|---|---|
| Newsgroups | comp.compilers |
| Subject | Re: What attributes of a programming language simplify its implementation? |
| Date | 2022-10-03 15:59 +1100 |
| Organization | Compilers Central |
| Message-ID | <22-10-014@comp.compilers> (permalink) |
| References | <22-09-026@comp.compilers> <22-10-002@comp.compilers> <22-10-004@comp.compilers> <22-10-012@comp.compilers> |
On 2022-10-03 12:34, Robin Vowels wrote: > From: "gah4" <gah4@u.washington.edu> > Sent: Sunday, October 02, 2022 11:05 AM >> Unlike many languages, the whole definition of PL/I was written >> before writing the first compiler. > > That's not true. The preprocessor was designed after the first > release. As well as that, some features of output were designed after > the first release. > >> (Not that all features were implemented in the first compiler.) >> [PL/I was a remarkably good language considering what a rush job it >> was but >> it has plenty of odd things, e.g. >> >> DCL (I, J, K) CHAR(3); >> I = 1; >> J = 2; >> K = I+J; > > This will not work either. > In the first place, the lengths of the strings are too small to > accommodate > the converted integer constants, 1 and 2. The STRINGSIZE condition is > raised > at run-time. > In the second place, the length of K is too short to accommodate > the sum of I and J. > In the third place, the STRINGSIZE condition is raised at run-time > for the assignments to I, J, and K. > Apart from that, the compiler gives compile-time messages that, > in each of the three assignments, the string variables are too short to > accommodate the values that are to be assigned to them. > >> What does K contain? Nope, it contains three spaces because the 1 and >> 2 >> are converted to ' 1' and ' 2', they're converted back to integer, >> added, converted back to to a default size integer string >> like ' 3' and string assignment truncates from the right. -John] > > Again, not quite. Even if such a program were allowed to run, > the STRINGSIZE condition is raised. What happens after that depends on > what the programmer does to handle the condition. > [The IBM manuals say that STRINGSIZE is normally disabled. So you > can check for truncation if you want, but by default it won't > and you'll get the three spaces. -John] You're forgetting about the three compile-time messages, warning that all three strings will be truncated. Yes, STRINGSIZE,** like STRINGRANGE***, SUBSCRIPTRANGE, SIZE, FIXEDOVERFLOW*, etc are not enabled by default. Originally, these were not enabled because it took extra instructions to implement the test on S/360. However, it was patently evident that not having them enabled wasted considerable time and effort in detecting programming errors. I, for one, always enable these conditions. The extra instructions and extra execution time are usually trivial and are unimportant. ______ * except for FIXEDOVERFLOW, for which such errors could be detected by hardware on S/360, and produced an interrupt if enabled. ** STRINGSIZE was not in the early specifications for PL/I-F, but was found from practice to be as important as the others because truncation without warning could lead to errors. *** STRINGRANGE was not in the early specifications for PL/I-F, but was comparable to SUBSCRIPTRANGE in checking for out-of-bound position references. It was found to be essential for detecting programming errors. [I agree that adding two numbers and getting three spaces was bad practice, and there were ways to avoid shooting yourself in the foot. My point was that there were situations where each individual step was reasonable, but the combination was absurd. Those are hard to completely avoid. PL/I had a lot of them for entirely understandable reasons. That didn't mean it was a hard language, rather that you had to understand what you were doing. -John]
Back to comp.compilers | Previous | Next — Previous in thread | Next in thread | Find similar
What attributes of a programming language simplify its implementation? Christopher F Clark <christopher.f.clark@compiler-resources.com> - 2022-09-30 12:46 +0100
Re: What attributes of a programming language simplify its implementation? Martin Ward <martin@gkc.org.uk> - 2022-10-01 15:56 +0100
Re: What attributes of a programming language simplify its implementation? gah4 <gah4@u.washington.edu> - 2022-10-01 17:05 -0700
Re: What attributes of a programming language simplify its implementation? gah4 <gah4@u.washington.edu> - 2022-10-02 00:11 -0700
Re: What attributes of a programming language simplify its implementation? "Robin Vowels" <robin51@dodo.com.au> - 2022-10-03 12:34 +1100
Re: What attributes of a programming language simplify its implementation? robin51@dodo.com.au - 2022-10-03 15:59 +1100
Re: What attributes of a programming language simplify its implementation? gah4 <gah4@u.washington.edu> - 2022-10-03 12:28 -0700
Re: What attributes of a programming language simplify its implementation? Christopher F Clark <christopher.f.clark@compiler-resources.com> - 2022-10-02 01:21 +0100
Re: What attributes of a programming language simplify its implementation? Thomas Koenig <tkoenig@netcologne.de> - 2022-10-08 22:44 +0000
Re: What attributes of a programming language simplify its implementation? "minf...@arcor.de" <minforth@arcor.de> - 2022-11-14 05:14 -0800
Re: What attributes of a programming language simplify its implementation? gah4 <gah4@u.washington.edu> - 2022-11-15 06:09 -0800
RE: Re: What attributes of a programming language simplify its implementation? Roger L Costello <costello@mitre.org> - 2022-11-15 11:52 +0000
Re: Re: What attributes of a programming language simplify its implementation? <minforth@arcor.de> - 2022-11-15 09:48 -0800
Re: Re: What attributes of a programming language simplify its implementation? RPN? gah4 <gah4@u.washington.edu> - 2022-11-15 16:11 -0800
Re: Re: What attributes of a programming language simplify its implementation? RPN? "minf...@arcor.de" <minforth@arcor.de> - 2022-11-16 04:54 -0800
Re: Re: What attributes of a programming language simplify its implementation? RPN? "minf...@arcor.de" <minforth@arcor.de> - 2022-11-16 05:39 -0800
Re: Re: What attributes of a programming language simplify its implementation? RPN? anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2022-11-16 18:12 +0000
csiph-web