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.7 required=5.0 tests=BAYES_00,MSGID_RANDY autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,e61c8636ef35379d X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2001-01-18 12:01:31 PST Path: supernews.google.com!sn-xit-02!supernews.com!news.gv.tsc.tdk.com!news.iac.net!news-out.cwix.com!newsfeed.cwix.com!cpk-news-hub1.bbnplanet.com!news.gtei.net!nntp2.deja.com!nnrp1.deja.com!not-for-mail From: Robert Dewar Newsgroups: comp.lang.ada Subject: Re: Examples in Docs, was Re: Escape Sequences in Strings Date: Thu, 18 Jan 2001 19:53:10 GMT Organization: Deja.com Message-ID: <947hj1$o1r$1@nnrp1.deja.com> References: <93objj$guk$1@nnrp1.deja.com> <93q77h$rr6$1@nnrp1.deja.com> <940f9j$nj2$1@nnrp1.deja.com> <940n0u$tnf$1@nnrp1.deja.com> <942brr$b0t$1@nnrp1.deja.com> <942vqr$sd0$1@nnrp1.deja.com> <945oq2$81c$1@nnrp1.deja.com> NNTP-Posting-Host: 205.232.38.14 X-Article-Creation-Date: Thu Jan 18 19:53:10 2001 GMT X-Http-User-Agent: Mozilla/4.61 [en] (OS/2; U) X-Http-Proxy: 1.0 x61.deja.com:80 (Squid/1.1.22) for client 205.232.38.14 X-MyDeja-Info: XMYDJUIDrobert_dewar Xref: supernews.google.com comp.lang.ada:4183 Date: 2001-01-18T19:53:10+00:00 List-Id: In article , Brian Rogoff wrote: > Well, I am in awe. If I remember correctly, there are a few > important aspects of SML programming, like evaluation order, > that are not explicitly stated but have to be deduced. I > can't imagine anyone getting a feel for how to program in ML > from the definition, especially if they were not familiar > with functional programming style. Neither can I :-) Indeed I was completely familiar with functional programming style (e.g. I knew Miranda well as well as the whole EFL (English-functional-language) work. Actually there is a very important point here which is that examples ARE very valuable for showing style, as opposed to rules. And indeed, I can't imagine learning style without learning rules. An analogy is a piano, you can read a set of specifications that clearly tell you, press this key to get middle A, which is 440Hz etc. But you do NOT get an idea of how to play Chopin from such specs. And even if you were Bach, you might still find yourself a bit mystefied by a Chopin score without any examples of how it sounded on a modern piano. So for stylistic issues etc, I quite agree that examples are helpful, indeed critical, and actually one of our big failings in teaching programming is that students do not get to study large examples of well written programs. > I agree, but I think mathematics is quite a bit different > from programming, and I have a decent background in both. Interesting, people differ on this point. Certainly Lambert Meertens would disagree with you I think :-) >(Note to RBKD: that's why I chose SML as an example, since > it's definition is the most "mathematical" of any well known > current programming language). Well I think the definition of Algol-68 is a whole lot more difficult in that respect, and actually the PL/1 standard is pretty mathematical (it's VDL style denotational semantics). > However, I've found that like most people I learn best > by example. And I have strongly agreed with that position from the start. But this still does not answer the question of whether to put more or less examples in the RM, because it is also the case that most people do NOT learn a language from its defining standard in any case (a point you are essentially arguing :-) So it is not clear that the above agreed on fact (that most people learn best from examples) means that examples belong in the RM, especially trivial examples that assume you do not know the language at all (which is the nature of most of the current RM examples -- they are NOT there to illustrate tricky points in the language). > > Certainly a BNF grammar is a FAR clearer documentation of > > syntax than syntactic examples, wouldn't you agree? > > Of course! However, when I learn a new programming language, > to get an idea of the syntax I look at a few representative > examples first. Ah well, there we are diffeent, I find it quite sufficient to scan through the BNF. Part of the trouble in Algol-68 is that there IS no BNF, only the two level grammar, which embodies all the syntax AND static semantic information, and this makes the syntax somewhat inpenetrable (at least at first). > Algol: Pascal, Modula-, Oberon-, Ada, Dylan > C : C++, Objective-C, Java, C# > Lisp: Scheme, Emacs-Lisp, Common-Lisp... > Prolog: Erlang, Mercury > Haskell: Clean, Python, OCCAM ("offset rules") > ML: SML, OCaml > > While I'm not intimately familiar with all of these languages, a quick > glance at new language examples allows me to categorize it (or not!) and > I find that I can get up to speed *on syntax* quickly. Then, afterwards, I > go to the BNF. I take it that you just go straight to the BNF and skip > the examples altogether. OK, I see that point, that makes sense ... I think I have never come to a new language without knowing in advance which category it belonged in :-) > The reason I asked if you teach your way, and if students are > receptive, is that I'd be interested in trying it myself. In > fact, I'll try this with the next PL I learn. I have not tried to insist on students learning languages from the standard, but I have tried to insist that they read the standard. I taught a course on language standards a while ago, and we looked at several standards, including the COBOL standard in detail, and some students in the class definitely learned COBOL from the standard plus lectures. Going back to Algol-68, I must say this was a huge and surprising failure for me. I joined a little study group where we read through the A68 report, and attended several meetings, and at the end of these meetings I simply had NO IDEA AT ALL what was going on. Which is too bad, because I had been interested in doing a compiler for A68 early on (following off the SPITBOL work), but I decided it was inpenetrable. It was not till several years later that I visited Leeds University where there was an ICL machine with RRE A68 installed, and I read Ian Currie's wonderful 70 page yellow book covering all of A68. I read it an evening. Came the next day, wrote a few hundred line A68 program -- worked first time -- great! And then I got fully involved in A68 (I chaired IFIP WG2.1 and the A68 maintenance committee for many years, and participated in some of the late design efforts including the representation standard, and the modules standard [the latter influenced the Ada design]), but that delay of several years was a pity. [interestingly, if I had not read Ian's book, I would never have got involved in Ada, since my Ada involvement came from the IFIP connection :-)] By the end of things, I was one of the relatively few people who really knew the A68 standard cover to cover. But some people are MUCH better at reading this kind of formal document than me. Phil Shaw wrote a thesis describing a language GYVE for operating system construction. He read the A68 report, immediately understood and liked it, and wrote a complete 2 level grammar for GYVE as part of his thesis. I must say, I still look for the Ada equivalent of Ian Currie's little yellow book -- I know, I know, I should write it :-) [it was of course full of examples, as something like that should be]. I actually started out a year or so ago with a description of Ada by example only -- nothing but examples -- no rules at all. You can see a start of this on the compilers course home page at www.cs.nyu.edu. It's an interesting approach for those who like to learn by example. Sent via Deja.com http://www.deja.com/