Path: utzoo!attcan!uunet!samsung!think!paperboy!meissner From: meissner@osf.org (Michael Meissner) Newsgroups: comp.lang.misc Subject: Re: Cheap implementations of languages (Re: Pointers and poor implementations (was: Re: JLG's flogging ...)) Message-ID: Date: 11 Apr 90 15:25:29 GMT References: <8960014@hpfcso.HP.COM> <14334@lambda.UUCP> Sender: news@OSF.ORG Organization: Open Software Foundation Lines: 51 In-reply-to: jlg@lambda.UUCP's message of 11 Apr 90 06:34:59 GMT In article <14334@lambda.UUCP> jlg@lambda.UUCP (Jim Giles) writes: | From article <8960014@hpfcso.HP.COM>, by mjs@hpfcso.HP.COM (Marc Sabatella): | > [...] | >>II) Feature differences. | > [...] | > What about | > c) math intrinsics and built-in I/O (including implied do-loops) | | This is a discussion of implementation difficulty. Math intrinsics CAN | be implemented as procedure calls -just as C does. Built-in I/O _IS_ | implemented with procedure calls on every system I've ever worked with | - just as C does. Implied do-loops are a red herring in this discussion: | they are simply do loops that are completely simulated at compile time. | What's so hard about that? | | > [...] | > d) equivalence | | Already discussed in other postings. In C, can you say 'union'? I thought | so. NO. Fortran equivalences are much harder to implement than unions. Unions always start off at offset 0 from the start of the union. In FORTRAN, equivalences require much more support within the compiler, in order to support things like equivalencing A[1] to B[100] and equivalencing C to A[20]. Check out section 7.9 in the Red Dragon book for more details. | > [...] | > e) run-time dimensionable arrays | | Again, in the context of simplicity of implementation, these are no harder | than statically declared arrays. The dimension values are just variables | instead of constants. Now, in an _optimizing_ compiler, these dynamic | array bounds limit constant folding to an extent (the bounds aren't constant). Again no. To implement arrays with static bounds, you only need to keep the bounds (as integer constants) within the symbol table. For full run-time dimensionable arrays, you must keep around an indication that the array is dynamic, and where the bound is stored. You must expand this bound expression within the tree as you are evaluating arrays and such. PL/I is much harder in this respect, since it allows variable sized arrays within structures, and all members following the array must be appropriately offset. -- Michael Meissner email: meissner@osf.org phone: 617-621-8861 Open Software Foundation, 11 Cambridge Center, Cambridge, MA Catproof is an oxymoron, Childproof is nearly so