* Re: Ada vs. Eiffel [not found] ` <3450li$t04@disuns2.epfl.ch> @ 1994-09-06 13:41 ` Graham Perkins [not found] ` <1994Sep4.100449.205@aldur.demon.co.uk> 1 sibling, 0 replies; 5+ messages in thread From: Graham Perkins @ 1994-09-06 13:41 UTC (permalink / raw) In article <3450li$t04@disuns2.epfl.ch> matomira@di.epfl.ch (Fernando Mato Mira) writes: >Actually, a couple of days ago this question popped up to my mind: > >What does Eiffel3 have that Ada9X doesn't? (language only, not tools) My understanding of Ada9X is that it will have EVERYTHING by the time it is released as production compilers. So the answer will be "nothing". But not a good question anyway. Think of Occam's razor and ask "What does Eiffel omit that Ada doesn't" > > > > > > > > > > ^ permalink raw reply [flat|nested] 5+ messages in thread
[parent not found: <1994Sep4.100449.205@aldur.demon.co.uk>]
[parent not found: <34e4rgINNqdg@ephor.tusc.com.au>]
* Re: Eiffel gripe (was Ada vs. Eiffel) [not found] ` <34e4rgINNqdg@ephor.tusc.com.au> @ 1994-09-12 9:35 ` Matthias Ernst 1994-09-12 13:52 ` Robert Dewar 0 siblings, 1 reply; 5+ messages in thread From: Matthias Ernst @ 1994-09-12 9:35 UTC (permalink / raw) Anthony Shipman (als@tusc.com.au) wrote: : In <1994Sep4.100449.205@aldur.demon.co.uk> neil@aldur.demon.co.uk (Neil Wilson) writes: : The absence of a 'break'-like statement or early return can make coding a : lot more tedious than it should be. Since code with a break or early return : can be mechanically translated into code without why have the programmer do : it? : The one type of loop that has been settled on doesn't cover the range of : loop architectures in common use. It provides a : loop : if not condition then break; : B; : end : style of loop whereas a : loop : A; : if not condition then break; : B; : end : style would be more general. The second reduces to the first by : omitting A but the first cannot be used to implement the second without : duplicating code as in: : [deleted] Ever looked at Sather ? Its iteration approach is IMO the synthesis of powerful but simple constructs. A loop in Sather consists of a - loop ... end frame. - normal code - iter calls An iter is something like a function/procedure with the difference that it has control of the embedding loop: it may either 'yield' control to the loop or 'quit' which exits the loop. Sequential calls to the iter resume execution after the last 'yield' statement. Examples are better than thousand words: [conservative]: i := 1; sum := 0; loop sum := sum + i; until i = 10; [innovative]: sum := 0; loop sum := sum + 1.upto!(10); end; or i := 0; loop while i<10 CODE; i := i+1; end; better: loop 10.times!; CODE end; Here the iters upto! and times! encapsulate - initialization - loop variance - termination Note that the standard loop controls while, until, break can easily be expressed as iters: while yields as long as its argument is true until yields as long as its argument is false break quits immediately One difference: calls to while! and until! can appear ANYWHERE in the loop: loop i := get_int; while!(i ~= 0); print 1/i; end; Further you can easily generalize iteration through containers of any kind. If you're interested, look at the Sather home page: http://www.icsi.berkeley.edu/Sather There is a tech report about iters. Matthias : -- : Anthony Shipman "You've got to be taught before it's too late, : TUSC Computer Systems Pty Ltd Before you are six or seven or eight, : To hate all the people your relatives hate, : E-mail: als@tusc.com.au You've got to be carefully taught." R&H ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Eiffel gripe (was Ada vs. Eiffel) 1994-09-12 9:35 ` Eiffel gripe (was Ada vs. Eiffel) Matthias Ernst @ 1994-09-12 13:52 ` Robert Dewar 1994-09-14 2:07 ` Matt Kennel 0 siblings, 1 reply; 5+ messages in thread From: Robert Dewar @ 1994-09-12 13:52 UTC (permalink / raw) If we are on the subject of loop syntax, how about the loop kit for SETL that I (probably in a fit of over-complex thinking) designed: init <stuff to do before loop. doing <stuff to do at start of each loop> step <stuff to do at end of each loop> while <condition to test at start of loop> loop ... end within the loop there was both a quit and a continue for early exits to either outside the loop or the next iteration (actually to the step code) Well you sure could do anything with that. As in C, one of the powerful uses of general iteration schemes like this is in connection with macros, which allow you to do lots of nice things, but are so open to major abuse that in the final analysis I prefer Ada's approach of excluding macros as a first class capability (SETL *did* have a powerful macro facility as well). ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Eiffel gripe (was Ada vs. Eiffel) 1994-09-12 13:52 ` Robert Dewar @ 1994-09-14 2:07 ` Matt Kennel 1994-09-14 15:37 ` Jacob Gore 0 siblings, 1 reply; 5+ messages in thread From: Matt Kennel @ 1994-09-14 2:07 UTC (permalink / raw) Robert Dewar (dewar@cs.nyu.edu) wrote: : If we are on the subject of loop syntax, how about the loop kit for SETL : that I (probably in a fit of over-complex thinking) designed: : init <stuff to do before loop. : doing <stuff to do at start of each loop> : step <stuff to do at end of each loop> : while <condition to test at start of loop> : loop : ... : end : within the loop there was both a quit and a continue for early exits to : either outside the loop or the next iteration (actually to the step code) : Well you sure could do anything with that. As in C, one of the powerful : uses of general iteration schemes like this is in connection with macros, : which allow you to do lots of nice things, but are so open to major : abuse that in the final analysis I prefer Ada's approach of excluding : macros as a first class capability (SETL *did* have a powerful macro : facility as well). What about Sather's iters? That is the nicest way that I've seen to do loops. All the "init", "step" and "exit" critera are user-programmable in 'iters', which are written like class routines. For example, loop x := collection.elt!; -- each 'x' is an element of the collection. end; "elt!" is an iter in the class of object 'collection'. It initializes internal variables for a loop, and on each iteration through the loop written here, some iter code is called which returns successive elements of the container object. When the iter decides that the loop is done (runs out of elements, e.g.) the actual outer loop is exited itself. If it's an array based structure, then the code for "elt!" would be simple. If it were a linked list, it would be more complicated, or a tree more complicated still. Nevertheless you would write the loop just as above. Each kind of loop structure that you want is user programmable, attached to appropriate classes and completely safe. It's nicer than having to use inefficient 'iterator' objects, one for each different kind of iteration that you want. -- -Matt Kennel mbk@inls1.ucsd.edu -Institute for Nonlinear Science, University of California, San Diego -*** AD: Archive for nonlinear dynamics papers & programs: FTP to -*** lyapunov.ucsd.edu, username "anonymous". ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Eiffel gripe (was Ada vs. Eiffel) 1994-09-14 2:07 ` Matt Kennel @ 1994-09-14 15:37 ` Jacob Gore 0 siblings, 0 replies; 5+ messages in thread From: Jacob Gore @ 1994-09-14 15:37 UTC (permalink / raw) Matt Kennel writes > What about Sather's iters? That is the nicest way that I've seen to > do loops. > > All the "init", "step" and "exit" critera are user-programmable in > 'iters', which are written like class routines. > > For example, > > loop > x := collection.elt!; > -- each 'x' is an element of the collection. > end; 1. I don't like it when functions have side-effects. 2. I don't like it when routines alter control in the caller as part of their normal behavior (as opposed to exceptions -- REAL exceptions, not the use of raise/handle pairs as thinly disguised gotos). 3. The above example combines the problems of #1 and #2 above with superb elegance. Jacob --- Jacob Gore, Eastern NM U. Jacob@BlackBox.ENMU.Edu | Jacob@Gore.Com Member of the League for Programming Freedom (LPF)--lpf@uunet.uu.net ^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~1994-09-14 15:37 UTC | newest] Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- [not found] <DERWAY.94Aug23180251@alumni.ndc.com> [not found] ` <DERWAY.94Aug31133058@alumni.ndc.com> [not found] ` <1994Sep1.094653@lglsun.epfl.ch> [not found] ` <34473c$ru5@info2.rus.uni-stuttgart.de> [not found] ` <344isl$brd@Starbase.NeoSoft.COM> [not found] ` <3450li$t04@disuns2.epfl.ch> 1994-09-06 13:41 ` Ada vs. Eiffel Graham Perkins [not found] ` <1994Sep4.100449.205@aldur.demon.co.uk> [not found] ` <34e4rgINNqdg@ephor.tusc.com.au> 1994-09-12 9:35 ` Eiffel gripe (was Ada vs. Eiffel) Matthias Ernst 1994-09-12 13:52 ` Robert Dewar 1994-09-14 2:07 ` Matt Kennel 1994-09-14 15:37 ` Jacob Gore
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox