From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=0.2 required=5.0 tests=BAYES_00,INVALID_MSGID, REPLYTO_WITHOUT_TO_CC autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: fac41,2c6139ce13be9980 X-Google-Attributes: gidfac41,public X-Google-Thread: 103376,3d3f20d31be1c33a X-Google-Attributes: gid103376,public X-Google-Thread: f43e6,2c6139ce13be9980 X-Google-Attributes: gidf43e6,public From: Nick Leaton Subject: Re: Interface/Implementation (was Re: Design by Contract) Date: 1997/09/10 Message-ID: <3416BE96.A38F2295@calfp.co.uk>#1/1 X-Deja-AN: 271318455 References: Reply-To: nickle@pauillac X-NNTP-Posting-Host: calfp.demon.co.uk [158.152.70.168] Newsgroups: comp.software-eng,comp.lang.ada,comp.lang.eiffel Date: 1997-09-10T00:00:00+00:00 List-Id: Tucker Taft wrote: > > Robert Dewar (dewar@merv.cs.nyu.edu) wrote: > > : ... It is in fact NOT possible in any reasonable > : way to create a one-pass compiler for Ada 95, and certainly no one has > : done so. > > In the "for what it's worth" department... > > The AdaMagic front end is a "nearly" one-pass Ada 95 front end. > It "quick-parses" ahead only as necessary to find things like labels > and the name of a generic unit, and it does static analysis for > all declarations between bodies before emitting elaboration > code for the declarations (because rep-clauses can follow > the declarations, but not follow an intervening body). > But other than that, it can generate IL (intermediate language) > as it goes. Which is then passed through various other passes, such as linking, code optimisation, generation of machine code from the IL ... > What this means is that you could feed the source code for > a package body into the front end and start seeing stuff coming > out of the other end before you finished feeding in the whole package > body. > > Be that as it may, I agree with Robert that the "one pass" model is most > important in its role in simplifying the semantics of "elaboration" > (the executable code associated with declarations) and in helpng with > human comprehension. OK, so we come to the crux. The one pass compiler is not the real issue, you shouldn't care about that part. The human comprehension issue is the important concern. > Coming from Ada, it is somewhat alarming to read Java code where > fields and methods can be referenced in code prior to their > declarations. This seems to be one side-effect of a lack of > separate method declarations in Java. Ordering code bottom up a la Ada vs ordering code in any order. Does having the ability to freely order increase the readability of the code? Well I do like grouping features with a class in clusters, and (hopefully) being consistent between clusters. You can always order bottom up if you want to, but you don't have to. In other words having free ordering is a superset of bottom up ordering. > Java does have an "import" clause which must come first, > analagous to the Ada "with" clause, when referring to external > (packages of) classes. Eiffel seems to have foregone even > this bit of declaration-before-use -- there seems no need to > declare the importing of one class prior to using it anywhere > inside another. Though to be fair, even in Java, "import" is > not needed for java.lang.*, nor if you are willing to use the > fully qualified class name rather than just its simple name. The assumption in Eiffel is let the compiler do the work for you, so as another example, working out dependencies is a job for the compiler. You don't write makefiles with Eiffel. When I changed from C++ to Eiffel, there is a major change in the way you work. C++ Pascal, (and probably Ada) are languages that you write using text editors. Eiffel is very different, using (ISE's) workbench writting code is much closer to browsing the net. You are dragging and droping code into windows, and then applying filters such as the short tool, filters to find the attributes, features, once features, deferred features etc. Browsing class heirachies. etc... This, I believe although I haven't used one is close to a Small talk environment. It is a very different way of working, and takes a couple of weeks to get used to it. Someone recently pointed out that you could replace text file based systems with code in a database. This is a hybrid between the two. If you think about an OO class. You want to write a complete class, without holes but without going over the top. You will write features that may not be used in your system, but are there for completeness. So that you can reuse the class, or because you may require the system in the future. The disadvantage is that you have code in your system that isn't used in the end product. This isn't a problem as any good compiler will remove the dead code for you. In OO systems you have much more dead code that in procedural systems, and it is not wrong for systems to do so. -- Nick Eiffel - Possibly the best language in the world - unless proven otherwise.