* [OT] interesting reason why a language is considered good @ 2012-04-15 10:27 Nasser M. Abbasi 2012-04-15 11:57 ` J-P. Rosen ` (5 more replies) 0 siblings, 6 replies; 48+ messages in thread From: Nasser M. Abbasi @ 2012-04-15 10:27 UTC (permalink / raw) I thought some here might enjoy this, since I know Ada folks are more "software engineering" aware than the average on the net ;) Here is what I read: "The lack of reserved words in the language gives the programmer complete freedom to choose identifiers." The above was listed under the header of what makes this language easy, robust and well defined! (I am not going to name the language). Now, I found this to be so strange and really bizarre, as I would have thought it should be the other way round. Reserved words are a good thing. Having an identifier be called 'if' or 'then' or 'which' is supposed to be good as it gives the programmer the freedom to choose the name of the variables? I am sometimes just amazed at what I read on the net about what makes a language good. But this one tops the list. --Nasser ^ permalink raw reply [flat|nested] 48+ messages in thread
* Re: [OT] interesting reason why a language is considered good 2012-04-15 10:27 [OT] interesting reason why a language is considered good Nasser M. Abbasi @ 2012-04-15 11:57 ` J-P. Rosen 2012-04-16 10:37 ` Peter C. Chapin 2012-04-15 12:27 ` Dmitry A. Kazakov ` (4 subsequent siblings) 5 siblings, 1 reply; 48+ messages in thread From: J-P. Rosen @ 2012-04-15 11:57 UTC (permalink / raw) Le 15/04/2012 12:27, Nasser M. Abbasi a �crit : > "The lack of reserved words in the language gives the > programmer complete freedom to choose identifiers." > Complete freedom, hey... Quoting myself ;-): "All other languages praise themselves for what they allow to do; Ada is the only one which praises itself for what it prevents from doing" -- J-P. Rosen Adalog 2 rue du Docteur Lombard, 92441 Issy-les-Moulineaux CEDEX Tel: +33 1 45 29 21 52, Fax: +33 1 45 29 25 00 http://www.adalog.fr ^ permalink raw reply [flat|nested] 48+ messages in thread
* Re: [OT] interesting reason why a language is considered good 2012-04-15 11:57 ` J-P. Rosen @ 2012-04-16 10:37 ` Peter C. Chapin 0 siblings, 0 replies; 48+ messages in thread From: Peter C. Chapin @ 2012-04-16 10:37 UTC (permalink / raw) On 2012-04-15 07:57, J-P. Rosen wrote: > "All other languages praise themselves for what they allow to do; Ada is > the only one which praises itself for what it prevents from doing" That's great. Thanks! Peter ^ permalink raw reply [flat|nested] 48+ messages in thread
* Re: [OT] interesting reason why a language is considered good 2012-04-15 10:27 [OT] interesting reason why a language is considered good Nasser M. Abbasi 2012-04-15 11:57 ` J-P. Rosen @ 2012-04-15 12:27 ` Dmitry A. Kazakov 2012-04-17 6:59 ` tonyg 2012-04-15 14:05 ` Bill Findlay ` (3 subsequent siblings) 5 siblings, 1 reply; 48+ messages in thread From: Dmitry A. Kazakov @ 2012-04-15 12:27 UTC (permalink / raw) On Sun, 15 Apr 2012 05:27:36 -0500, Nasser M. Abbasi wrote: > "The lack of reserved words in the language gives the > programmer complete freedom to choose identifiers." > > The above was listed under the header of what makes this > language easy, robust and well defined! (I am not > going to name the language). > > Now, I found this to be so strange and really bizarre, as > I would have thought it should be the other way round. > > Reserved words are a good thing. Having an > identifier be called 'if' or 'then' or 'which' is > supposed to be good as it gives the programmer the freedom > to choose the name of the variables? Yes, or take defamatory words. What kind of identifiers they would be? Clearly words like sh*t, f*ck etc must be reserved! -- Regards, Dmitry A. Kazakov http://www.dmitry-kazakov.de ^ permalink raw reply [flat|nested] 48+ messages in thread
* Re: [OT] interesting reason why a language is considered good 2012-04-15 12:27 ` Dmitry A. Kazakov @ 2012-04-17 6:59 ` tonyg 2012-04-17 7:43 ` Dmitry A. Kazakov 0 siblings, 1 reply; 48+ messages in thread From: tonyg @ 2012-04-17 6:59 UTC (permalink / raw) Cc: mailbox On Sunday, 15 April 2012 13:27:45 UTC+1, Dmitry A. Kazakov wrote: > On Sun, 15 Apr 2012 05:27:36 -0500, Nasser M. Abbasi wrote: > > > "The lack of reserved words in the language gives the > > programmer complete freedom to choose identifiers." > > > > The above was listed under the header of what makes this > > language easy, robust and well defined! (I am not > > going to name the language). > > > > Now, I found this to be so strange and really bizarre, as > > I would have thought it should be the other way round. > > > > Reserved words are a good thing. Having an > > identifier be called 'if' or 'then' or 'which' is > > supposed to be good as it gives the programmer the freedom > > to choose the name of the variables? > > Yes, or take defamatory words. What kind of identifiers they would be? > Clearly words like sh*t, f*ck etc must be reserved! > > -- > Regards, > Dmitry A. Kazakov > http://www.dmitry-kazakov.de They should be reserved for use in the exception handler. ^ permalink raw reply [flat|nested] 48+ messages in thread
* Re: [OT] interesting reason why a language is considered good 2012-04-17 6:59 ` tonyg @ 2012-04-17 7:43 ` Dmitry A. Kazakov 0 siblings, 0 replies; 48+ messages in thread From: Dmitry A. Kazakov @ 2012-04-17 7:43 UTC (permalink / raw) On Mon, 16 Apr 2012 23:59:44 -0700 (PDT), tonyg wrote: > On Sunday, 15 April 2012 13:27:45 UTC+1, Dmitry A. Kazakov wrote: >> On Sun, 15 Apr 2012 05:27:36 -0500, Nasser M. Abbasi wrote: >> >>> "The lack of reserved words in the language gives the >>> programmer complete freedom to choose identifiers." >>> >>> The above was listed under the header of what makes this >>> language easy, robust and well defined! (I am not >>> going to name the language). >>> >>> Now, I found this to be so strange and really bizarre, as >>> I would have thought it should be the other way round. >>> >>> Reserved words are a good thing. Having an >>> identifier be called 'if' or 'then' or 'which' is >>> supposed to be good as it gives the programmer the freedom >>> to choose the name of the variables? >> >> Yes, or take defamatory words. What kind of identifiers they would be? >> Clearly words like sh*t, f*ck etc must be reserved! >> > They should be reserved for use in the exception handler. Indeed. I know a programmer who is consistently using such words in the unanticipated error messages. The only problem is that customers sometimes see them popping! (:-)) -- Regards, Dmitry A. Kazakov http://www.dmitry-kazakov.de ^ permalink raw reply [flat|nested] 48+ messages in thread
* Re: [OT] interesting reason why a language is considered good 2012-04-15 10:27 [OT] interesting reason why a language is considered good Nasser M. Abbasi 2012-04-15 11:57 ` J-P. Rosen 2012-04-15 12:27 ` Dmitry A. Kazakov @ 2012-04-15 14:05 ` Bill Findlay 2012-04-15 14:21 ` Pascal Obry ` (2 subsequent siblings) 5 siblings, 0 replies; 48+ messages in thread From: Bill Findlay @ 2012-04-15 14:05 UTC (permalink / raw) On 15/04/2012 11:27, in article jme7r1$eo7$1@speranza.aioe.org, "Nasser M. Abbasi" <nma@12000.org> wrote: > > I thought some here might enjoy this, since I know Ada > folks are more "software engineering" aware than the > average on the net ;) > > Here is what I read: > > "The lack of reserved words in the language gives the > programmer complete freedom to choose identifiers." > > The above was listed under the header of what makes this > language easy, robust and well defined! (I am not > going to name the language). See: <http://www.multicians.org/proc-proc.html> -- Bill Findlay with blueyonder.co.uk; use surname & forename; ^ permalink raw reply [flat|nested] 48+ messages in thread
* Re: [OT] interesting reason why a language is considered good 2012-04-15 10:27 [OT] interesting reason why a language is considered good Nasser M. Abbasi ` (2 preceding siblings ...) 2012-04-15 14:05 ` Bill Findlay @ 2012-04-15 14:21 ` Pascal Obry 2012-04-15 14:54 ` Simon Wright 2012-04-16 10:43 ` Marius Amado-Alves 2012-04-17 21:59 ` anon 5 siblings, 1 reply; 48+ messages in thread From: Pascal Obry @ 2012-04-15 14:21 UTC (permalink / raw) To: nma Nasser, > I am sometimes just amazed at what I read on the net > about what makes a language good. But this one tops > the list. I've never understood the need for reserved words nor for any letters either, look at what I consider the best language in the world! http://fr.wikipedia.org/wiki/Brainfuck :) Pascal. -- --|------------------------------------------------------ --| Pascal Obry Team-Ada Member --| 45, rue Gabriel Peri - 78114 Magny Les Hameaux FRANCE --|------------------------------------------------------ --| http://www.obry.net - http://v2p.fr.eu.org --| "The best way to travel is by means of imagination" --| --| gpg --keyserver keys.gnupg.net --recv-key F949BD3B ^ permalink raw reply [flat|nested] 48+ messages in thread
* Re: [OT] interesting reason why a language is considered good 2012-04-15 14:21 ` Pascal Obry @ 2012-04-15 14:54 ` Simon Wright 2012-04-15 15:34 ` Pascal Obry 2012-04-15 23:53 ` Brian Drummond 0 siblings, 2 replies; 48+ messages in thread From: Simon Wright @ 2012-04-15 14:54 UTC (permalink / raw) Pascal Obry <pascal@obry.net> writes: > Nasser, > >> I am sometimes just amazed at what I read on the net >> about what makes a language good. But this one tops >> the list. > > I've never understood the need for reserved words nor for any letters > either, look at what I consider the best language in the world! > > http://fr.wikipedia.org/wiki/Brainfuck > > :) http://en.wikipedia.org/wiki/Whitespace_(programming_language) ^ permalink raw reply [flat|nested] 48+ messages in thread
* Re: [OT] interesting reason why a language is considered good 2012-04-15 14:54 ` Simon Wright @ 2012-04-15 15:34 ` Pascal Obry 2012-04-17 5:42 ` Brad Moore 2012-04-15 23:53 ` Brian Drummond 1 sibling, 1 reply; 48+ messages in thread From: Pascal Obry @ 2012-04-15 15:34 UTC (permalink / raw) Le 15/04/2012 16:54, Simon Wright a �crit : > Pascal Obry <pascal@obry.net> writes: > >> Nasser, >> >>> I am sometimes just amazed at what I read on the net >>> about what makes a language good. But this one tops >>> the list. >> >> I've never understood the need for reserved words nor for any letters >> either, look at what I consider the best language in the world! >> >> http://fr.wikipedia.org/wiki/Brainfuck >> >> :) > > http://en.wikipedia.org/wiki/Whitespace_(programming_language) Pure and clean... What else? Pascal. -- --|------------------------------------------------------ --| Pascal Obry Team-Ada Member --| 45, rue Gabriel Peri - 78114 Magny Les Hameaux FRANCE --|------------------------------------------------------ --| http://www.obry.net - http://v2p.fr.eu.org --| "The best way to travel is by means of imagination" --| --| gpg --keyserver keys.gnupg.net --recv-key F949BD3B ^ permalink raw reply [flat|nested] 48+ messages in thread
* Re: [OT] interesting reason why a language is considered good 2012-04-15 15:34 ` Pascal Obry @ 2012-04-17 5:42 ` Brad Moore 2012-04-17 16:11 ` Simon Wright 0 siblings, 1 reply; 48+ messages in thread From: Brad Moore @ 2012-04-17 5:42 UTC (permalink / raw) On 15/04/2012 9:34 AM, Pascal Obry wrote: > Le 15/04/2012 16:54, Simon Wright a �crit : >> Pascal Obry<pascal@obry.net> writes: >> >>> Nasser, >>> >>>> I am sometimes just amazed at what I read on the net >>>> about what makes a language good. But this one tops >>>> the list. >>> >>> I've never understood the need for reserved words nor for any letters >>> either, look at what I consider the best language in the world! >>> >>> http://fr.wikipedia.org/wiki/Brainfuck >>> >>> :) >> >> http://en.wikipedia.org/wiki/Whitespace_(programming_language) > > Pure and clean... What else? > > Pascal. > What I like about Whitespace is that after a hard day of debugging, I can make corrections to the program and then print out the modified listing using the same piece of paper. Brad ^ permalink raw reply [flat|nested] 48+ messages in thread
* Re: [OT] interesting reason why a language is considered good 2012-04-17 5:42 ` Brad Moore @ 2012-04-17 16:11 ` Simon Wright 2012-04-17 16:33 ` Robert A Duff 0 siblings, 1 reply; 48+ messages in thread From: Simon Wright @ 2012-04-17 16:11 UTC (permalink / raw) Brad Moore <brad.moore@shaw.ca> writes: > On 15/04/2012 9:34 AM, Pascal Obry wrote: >> Le 15/04/2012 16:54, Simon Wright a écrit : >>> Pascal Obry<pascal@obry.net> writes: >>> >>>> Nasser, >>>> >>>>> I am sometimes just amazed at what I read on the net >>>>> about what makes a language good. But this one tops >>>>> the list. >>>> >>>> I've never understood the need for reserved words nor for any >>>> letters either, look at what I consider the best language in the >>>> world! >>>> >>>> http://fr.wikipedia.org/wiki/Brainfuck >>>> >>>> :) >>> >>> http://en.wikipedia.org/wiki/Whitespace_(programming_language) >> >> Pure and clean... What else? >> >> Pascal. > > What I like about Whitespace is that after a hard day of debugging, I > can make corrections to the program and then print out the modified > listing using the same piece of paper. > > Brad The current ada-mode works best with this in ~/.emacs (add-hook 'before-save-hook 'delete-trailing-whitespace) which makes writing Whitespace code rather hard. ^ permalink raw reply [flat|nested] 48+ messages in thread
* Re: [OT] interesting reason why a language is considered good 2012-04-17 16:11 ` Simon Wright @ 2012-04-17 16:33 ` Robert A Duff 2012-04-17 19:34 ` Simon Wright 2012-04-17 21:17 ` Jeffrey Carter 0 siblings, 2 replies; 48+ messages in thread From: Robert A Duff @ 2012-04-17 16:33 UTC (permalink / raw) Simon Wright <simon@pushface.org> writes: > The current ada-mode works best with this in ~/.emacs > > (add-hook 'before-save-hook 'delete-trailing-whitespace) > > which makes writing Whitespace code rather hard. You'd have to put a comment at the end of every line. - Bob ^ permalink raw reply [flat|nested] 48+ messages in thread
* Re: [OT] interesting reason why a language is considered good 2012-04-17 16:33 ` Robert A Duff @ 2012-04-17 19:34 ` Simon Wright 2012-04-17 21:42 ` Robert A Duff 2012-04-17 21:17 ` Jeffrey Carter 1 sibling, 1 reply; 48+ messages in thread From: Simon Wright @ 2012-04-17 19:34 UTC (permalink / raw) Robert A Duff <bobduff@shell01.TheWorld.com> writes: > Simon Wright <simon@pushface.org> writes: > >> The current ada-mode works best with this in ~/.emacs >> >> (add-hook 'before-save-hook 'delete-trailing-whitespace) >> >> which makes writing Whitespace code rather hard. > > You'd have to put a comment at the end of every line. ada-mode also untabifies! ^ permalink raw reply [flat|nested] 48+ messages in thread
* Re: [OT] interesting reason why a language is considered good 2012-04-17 19:34 ` Simon Wright @ 2012-04-17 21:42 ` Robert A Duff 2012-04-17 22:24 ` Randy Brukardt 0 siblings, 1 reply; 48+ messages in thread From: Robert A Duff @ 2012-04-17 21:42 UTC (permalink / raw) Simon Wright <simon@pushface.org> writes: > ada-mode also untabifies! So we need to abandon our plans to rewrite GNAT in Whitespace?! By the way, it's probably possible to write a program that is both a Whitespace program and an Ada program. It might even do the same thing in both languages, if you're very very careful. - Bob ^ permalink raw reply [flat|nested] 48+ messages in thread
* Re: [OT] interesting reason why a language is considered good 2012-04-17 21:42 ` Robert A Duff @ 2012-04-17 22:24 ` Randy Brukardt 2012-04-18 7:00 ` stefan-lucks 0 siblings, 1 reply; 48+ messages in thread From: Randy Brukardt @ 2012-04-17 22:24 UTC (permalink / raw) "Robert A Duff" <bobduff@shell01.TheWorld.com> wrote in message news:wccty0if31u.fsf@shell01.TheWorld.com... > Simon Wright <simon@pushface.org> writes: > >> ada-mode also untabifies! > > So we need to abandon our plans to rewrite GNAT in Whitespace?! > > By the way, it's probably possible to write a program that is both > a Whitespace program and an Ada program. It might even do > the same thing in both languages, if you're very very careful. I was thinking something similar; Whitespace (or a variant) would be a great language to use to hide some program in plain sight. For instance, you could distribute some open source Ada software for a game, but have a program embedded within it to do something totally different. However, this capability only seems useful for various sorts of criminals -- I can't think of anything legitimate to do with it. Otherwise, I'd start figuring out how to map Ada code to a Whitespace variant. Randy. ^ permalink raw reply [flat|nested] 48+ messages in thread
* Re: [OT] interesting reason why a language is considered good 2012-04-17 22:24 ` Randy Brukardt @ 2012-04-18 7:00 ` stefan-lucks 0 siblings, 0 replies; 48+ messages in thread From: stefan-lucks @ 2012-04-18 7:00 UTC (permalink / raw) On Tue, 17 Apr 2012, Randy Brukardt wrote: > I was thinking something similar; Whitespace (or a variant) would be a great > language to use to hide some program in plain sight. For instance, you could > distribute some open source Ada software for a game, but have a program > embedded within it to do something totally different. However, this > capability only seems useful for various sorts of criminals -- I can't think > of anything legitimate to do with it. Dissidents in oppressive regimes? Or distributing the "amnesty international software distribution" around the world? (Of course, from the regimes' standpoint, a dissident is worse than a criminal, and amnesty international is is not better ...) -- ---- Stefan.Lucks (at) uni-weimar.de, University of Weimar, Germany ---- <http://www.uni-weimar.de/cms/medien/mediensicherheit/home.html> ------ I love the taste of Cryptanalysis in the morning! ------ ^ permalink raw reply [flat|nested] 48+ messages in thread
* Re: [OT] interesting reason why a language is considered good 2012-04-17 16:33 ` Robert A Duff 2012-04-17 19:34 ` Simon Wright @ 2012-04-17 21:17 ` Jeffrey Carter 1 sibling, 0 replies; 48+ messages in thread From: Jeffrey Carter @ 2012-04-17 21:17 UTC (permalink / raw) On 04/17/2012 09:33 AM, Robert A Duff wrote: > Simon Wright<simon@pushface.org> writes: > >> The current ada-mode works best with this in ~/.emacs >> >> (add-hook 'before-save-hook 'delete-trailing-whitespace) >> >> which makes writing Whitespace code rather hard. > > You'd have to put a comment at the end of every line. Or run emacs in whitespace-mode. -- Jeff Carter "Don't knock masturbation. It's sex with someone I love." Annie Hall 45 ^ permalink raw reply [flat|nested] 48+ messages in thread
* Re: [OT] interesting reason why a language is considered good 2012-04-15 14:54 ` Simon Wright 2012-04-15 15:34 ` Pascal Obry @ 2012-04-15 23:53 ` Brian Drummond 1 sibling, 0 replies; 48+ messages in thread From: Brian Drummond @ 2012-04-15 23:53 UTC (permalink / raw) On Sun, 15 Apr 2012 15:54:30 +0100, Simon Wright wrote: >> I've never understood the need for reserved words nor for any letters >> either, look at what I consider the best language in the world! >> >> http://fr.wikipedia.org/wiki/Brainfuck >> >> :) > > http://en.wikipedia.org/wiki/Whitespace_(programming_language) I am convinced Whitespace was invented after a week of utter frustration spent debugging a large recursive set of Makefiles where someone randomly used eight spaces instead of tab, and vice-versa. (Or maybe building gcc with gnat as a cross-compiler. grrr...) - Brian ^ permalink raw reply [flat|nested] 48+ messages in thread
* Re: [OT] interesting reason why a language is considered good 2012-04-15 10:27 [OT] interesting reason why a language is considered good Nasser M. Abbasi ` (3 preceding siblings ...) 2012-04-15 14:21 ` Pascal Obry @ 2012-04-16 10:43 ` Marius Amado-Alves 2012-04-16 11:48 ` Georg Bauhaus ` (2 more replies) 2012-04-17 21:59 ` anon 5 siblings, 3 replies; 48+ messages in thread From: Marius Amado-Alves @ 2012-04-16 10:43 UTC (permalink / raw) Cc: nma Love OT threads in this clever forum:-) Actually there is a bit of thruth in the absurd no keyword thing: *many* keywords can get in the way of naming identifiers. Ada, for one, has a bit too many keywords, with some good identifier candidates (when, others...) This links on thread took me on a short journey where I ended up checking out YAML, because I am looking for a good data description language. I was totally confused at section 2.3 Scalars (http://www.yaml.org/spec/1.2/spec.html#id2760844) At first I could not make anything of it, because I never understood "scalar" as anything else than something that has values (along a "scale"). [Then I still could not make anything of it because they don't seem to be addressing scalars at all, even in their wrong denotation, but that's a minor point.] A bit net surfing... it seems there is a trend now to call "scalar" to mean any value! Please fix this! (Yes, I am expecting you to change the world.) ^ permalink raw reply [flat|nested] 48+ messages in thread
* Re: [OT] interesting reason why a language is considered good 2012-04-16 10:43 ` Marius Amado-Alves @ 2012-04-16 11:48 ` Georg Bauhaus 2012-04-16 13:06 ` Dmitry A. Kazakov 2012-04-16 19:55 ` sbelmont700 2012-04-17 0:48 ` Peter C. Chapin 2 siblings, 1 reply; 48+ messages in thread From: Georg Bauhaus @ 2012-04-16 11:48 UTC (permalink / raw) On 16.04.12 12:43, Marius Amado-Alves wrote: > Love OT threads in this clever forum:-) > > Actually there is a bit of thruth in the absurd no keyword thing: *many* keywords can get in the way of naming identifiers. Ada, for one, has a bit too many keywords, with some good identifier candidates (when, others...) "when" and "others" are general abstractions. What kind of programs will in effect be about general abstractions? (For example, "when" does not name the operation that happened at the time that "when" should be denoting. Provided "when" is supposed to ask for time, not conditions. I think that adding the name of what happened to "when" to form an identifier will reduce the amount of obfuscation that general abstractions will incur: When_Added, When_Leaving, etc. The ambiguity of "when" in natural language (also meaning "if") is an additional problem.) ("Others" does not name the "distinguishing line" that informs about the qualities of the elements in the "others" set. Why are those other objects (or values) different in this specific program? Again, adding a descriptive name to others should reduce the amount of obfuscation that general abstractions will incur.) ^ permalink raw reply [flat|nested] 48+ messages in thread
* Re: [OT] interesting reason why a language is considered good 2012-04-16 11:48 ` Georg Bauhaus @ 2012-04-16 13:06 ` Dmitry A. Kazakov 2012-04-16 15:01 ` Georg Bauhaus 0 siblings, 1 reply; 48+ messages in thread From: Dmitry A. Kazakov @ 2012-04-16 13:06 UTC (permalink / raw) On Mon, 16 Apr 2012 13:48:04 +0200, Georg Bauhaus wrote: > On 16.04.12 12:43, Marius Amado-Alves wrote: >> Love OT threads in this clever forum:-) >> >> Actually there is a bit of thruth in the absurd no keyword thing: >> *many* keywords can get in the way of naming identifiers. Ada, for one, >> has a bit too many keywords, with some good identifier candidates (when, >> others...) > > "when" and "others" are general abstractions. What kind > of programs will in effect be about general abstractions? The kind of programs in Ada language, which uses exactly these words. Your argument is bogus. If a reserved word is good for the language then it is good for a program in that language. Furthermore if "when" is bad, then "what", "who" etc should be too. Yet, they are not reserved. The purpose of words being reserved has nothing to do with words. It does 1) with readability, to clearly separate identifiers from other syntactic tokens in order to improve readability. 2) With syntax issues, to make grammar less ambiguous for the parser. The reason #1 does not stand anymore because programs are read in IDEs. It was different in 70s, the era of punched cards and typewriters. The reason #2 is still valid, but it does not require that huge amount of reserved words Ada has, maybe only a half of them or less. -- Regards, Dmitry A. Kazakov http://www.dmitry-kazakov.de ^ permalink raw reply [flat|nested] 48+ messages in thread
* Re: [OT] interesting reason why a language is considered good 2012-04-16 13:06 ` Dmitry A. Kazakov @ 2012-04-16 15:01 ` Georg Bauhaus 2012-04-16 15:31 ` Dmitry A. Kazakov 0 siblings, 1 reply; 48+ messages in thread From: Georg Bauhaus @ 2012-04-16 15:01 UTC (permalink / raw) On 16.04.12 15:06, Dmitry A. Kazakov wrote: > On Mon, 16 Apr 2012 13:48:04 +0200, Georg Bauhaus wrote: > >> On 16.04.12 12:43, Marius Amado-Alves wrote: >>> Love OT threads in this clever forum:-) >>> >>> Actually there is a bit of thruth in the absurd no keyword thing: >>> *many* keywords can get in the way of naming identifiers. Ada, for one, >>> has a bit too many keywords, with some good identifier candidates (when, >>> others...) >> >> "when" and "others" are general abstractions. What kind >> of programs will in effect be about general abstractions? > > The kind of programs in Ada language, which uses exactly these words. And these are? (If you could avoid the tautological void. Be constructive! ;-) > Your > argument is bogus. If a reserved word is good for the language then it is > good for a program in that language. If a reserved word is good for the language, then it is a general abstraction, such as "when", or "others", because is it applicable to all kinds of programs regardless of concrete notions. The word "Morning" or "brothers" are not applicable to all kinds of programs because they are very unlike "when" or "others". I bet the former words are not reserved by any programming language. Amado-Alves claimed that "when" and "others" show that the number of reserved words in Ada is too large, because they are good candidates for identifiers. I still only see the same claim repeated, but not substantiated, and compared on a scale of "understandability". > Furthermore if "when" is bad, then "what", "who" etc should be too. Yet, > they are not reserved. More often than I like, I translate programs that use overly general identifiers, words that can only be understood after an inordinate amount of study. "What" as an identifier shouldn't be, IMHO, reserved or not, so words like "what" not being reserved does not count as counter-argument in my book. I'd rather have a list of words not recommended to augment reserved words. > The purpose of words being reserved has nothing to do with words. It does > 1) with readability, to clearly separate identifiers from other syntactic > tokens in order to improve readability. > > The reason #1 does not stand anymore because programs are read in IDEs. I disagree strongly, likely because IDEs usually become only DEs for heterogeneous sources in my real world: IDEs typically lack reliable means of automatically mapping (possibly broken) source to and from foreign layout, but layout becomes essential if syntax is abandoned for readability. Moreover, I happen to work in an environment that requires the use of editors (and terminals) that happen to be available with a given foreign system. My work can become rather difficult when programmers have relied on "graphical" or "typographical" properties of some IDE, and not plain old syntax. ^ permalink raw reply [flat|nested] 48+ messages in thread
* Re: [OT] interesting reason why a language is considered good 2012-04-16 15:01 ` Georg Bauhaus @ 2012-04-16 15:31 ` Dmitry A. Kazakov 2012-04-16 17:11 ` Georg Bauhaus ` (2 more replies) 0 siblings, 3 replies; 48+ messages in thread From: Dmitry A. Kazakov @ 2012-04-16 15:31 UTC (permalink / raw) On Mon, 16 Apr 2012 17:01:05 +0200, Georg Bauhaus wrote: > On 16.04.12 15:06, Dmitry A. Kazakov wrote: >> On Mon, 16 Apr 2012 13:48:04 +0200, Georg Bauhaus wrote: >> >>> On 16.04.12 12:43, Marius Amado-Alves wrote: >>>> Love OT threads in this clever forum:-) >>>> >>>> Actually there is a bit of thruth in the absurd no keyword thing: >>>> *many* keywords can get in the way of naming identifiers. Ada, for one, >>>> has a bit too many keywords, with some good identifier candidates (when, >>>> others...) >>> >>> "when" and "others" are general abstractions. What kind >>> of programs will in effect be about general abstractions? >> >> The kind of programs in Ada language, which uses exactly these words. > > And these are? (If you could avoid the tautological void. > Be constructive! ;-) All Ada programs that use the case-statement. >> Your >> argument is bogus. If a reserved word is good for the language then it is >> good for a program in that language. > > If a reserved word is good for the language, then it is a general > abstraction, such as "when", or "others", because is it applicable to > all kinds of programs regardless of concrete notions. => it is bad to use in all programs => it is bad for the language in which all these programs are written. q.e.d. > The word > "Morning" or "brothers" are not applicable to all kinds of programs > because they are very unlike "when" or "others". I bet the former > words are not reserved by any programming language. What about the words "return", "range", "abs", "tagged"? > Amado-Alves claimed that "when" and "others" show that the number > of reserved words in Ada is too large, because they are good > candidates for identifiers. Surely "when" and "at" are prefect names for a formal parameter of the type Time. Also your argument to universality would also apply to the parameters named "X", "Y", "Left", "Right" all over the LRM. It did not work there, but suddenly does for "when"? >> Furthermore if "when" is bad, then "what", "who" etc should be too. Yet, >> they are not reserved. > > More often than I like, I translate programs that use overly > general identifiers, words that can only be understood after an inordinate > amount of study. "What" as an identifier shouldn't be, IMHO, > reserved or not, so words like "what" not being reserved does > not count as counter-argument in my book. I'd rather have a > list of words not recommended to augment reserved words. So either they must be reserved or your argument is wrong. The choice is yours. >> The purpose of words being reserved has nothing to do with words. It does >> 1) with readability, to clearly separate identifiers from other syntactic >> tokens in order to improve readability. >> >> The reason #1 does not stand anymore because programs are read in IDEs. > > I disagree strongly, likely because IDEs usually become only DEs for > heterogeneous sources in my real world: IDEs typically > lack reliable means of automatically mapping (possibly broken) > source to and from foreign layout, but layout becomes essential if > syntax is abandoned for readability. Moreover, I happen to work in > an environment that requires the use of editors (and terminals) > that happen to be available with a given foreign system. My work > can become rather difficult when programmers have relied on > "graphical" or "typographical" properties of some IDE, and not > plain old syntax. Statistically irrelevant. Probably there exist Ada programmers using typewriter without characters |, #, " (See Ada 83 RM 2.10). Don't care! -- Regards, Dmitry A. Kazakov http://www.dmitry-kazakov.de ^ permalink raw reply [flat|nested] 48+ messages in thread
* Re: [OT] interesting reason why a language is considered good 2012-04-16 15:31 ` Dmitry A. Kazakov @ 2012-04-16 17:11 ` Georg Bauhaus 2012-04-16 17:19 ` Georg Bauhaus 2012-04-16 18:00 ` Dmitry A. Kazakov 2012-04-17 3:24 ` Randy Brukardt 2012-04-17 3:33 ` Randy Brukardt 2 siblings, 2 replies; 48+ messages in thread From: Georg Bauhaus @ 2012-04-16 17:11 UTC (permalink / raw) On 16.04.12 17:31, Dmitry A. Kazakov wrote: > On Mon, 16 Apr 2012 17:01:05 +0200, Georg Bauhaus wrote: > >> On 16.04.12 15:06, Dmitry A. Kazakov wrote: >>> On Mon, 16 Apr 2012 13:48:04 +0200, Georg Bauhaus wrote: >>> >>>> On 16.04.12 12:43, Marius Amado-Alves wrote: >>>>> Love OT threads in this clever forum:-) >>>>> >>>>> Actually there is a bit of thruth in the absurd no keyword thing: >>>>> *many* keywords can get in the way of naming identifiers. Ada, for one, >>>>> has a bit too many keywords, with some good identifier candidates (when, >>>>> others...) >>>> >>>> "when" and "others" are general abstractions. What kind >>>> of programs will in effect be about general abstractions? >>> >>> The kind of programs in Ada language, which uses exactly these words. >> >> And these are? (If you could avoid the tautological void. >> Be constructive! ;-) > > All Ada programs that use the case-statement. How now? First, you distinguish syntax from some "rest" of the program, and then, when I do the same, the distinction is gone? My question is: If "others" were moved from syntax to identifiers, then what fraction, and what kind of programs will hugely profit because they can now name things "others"? (In place of "foreigners", or "remaining_parts", or "tail", or "<the-opposite>", or ...) >>> Your >>> argument is bogus. If a reserved word is good for the language then it is >>> good for a program in that language. >> >> If a reserved word is good for the language, then it is a general >> abstraction, such as "when", or "others", because is it applicable to >> all kinds of programs regardless of concrete notions. Rephrased: (reserved(word) = good-for(C(identifiers)) => general-abstraction(word) No further conclusions other than a wish for a list of words not recommended for use as identifiers either, such as "what". > => it is bad to use in all programs => it is bad for the language in which > all these programs are written. q.e.d. IIUC, this is close to what I have said about the word "what" as an identifier. "What" is bad in programs except maybe in programs whose problem domain is the singleton word "what". It should not be used as an identifier, IMHO. > Surely "when" and "at" are prefect names for a formal parameter of the type > Time. I disagree. In my initial response, I made them "Leaving_When" and so on, as these names are more meaningful. "at" is worthless without context (at a place? at a time?). You could require context with dot notation. Pkg.T? Pkg.Obj? Really? I cannot at the moment think of a really good way to use "at" as an identifier in the body of a function. when := offset (when => at); Seen from another angle, refactoring becomes a nightmare if you have wish to reuse an Ada function in a PascAlgol-17 program, by rewriting, say, if its profile uses names that are ubiquitously reserved : Index (From => ..., To => ..., ); And vice versa for the reverse. I'd rather not have Ada fans tell me that they couldn't care less, why don't I use Ada etc., when at the same time they are witness to programs breaking because Ada didn't at least warn against using the fairly general word "interface" when it was around already. Clear an plain. Java did better, insofar as "goto" is reserved even though it is not part of the language's syntax. > Also your argument to universality would also apply to the parameters named > "X", "Y", "Left", "Right" all over the LRM. It did not work there, but > suddenly does for "when"? A word may work in an LRM. However, a program's problem domain is not the LRM, in general. Simon Wright has recently shown a nice way how to mend the situation with X and Y for surface orientation, using Ada 2012 (substituting Northings and Eastings in the profile, IIRC). >> "What" as an identifier shouldn't be, IMHO, >> reserved or not, so words like "what" not being reserved does >> not count as counter-argument in my book. I'd rather have a >> list of words not recommended to augment reserved words. > > So either they must be reserved or your argument is wrong. The choice is > yours. There is no MUST here. Programming is a human activity, not to be HALTed: What counts is understandability of a program, which I think is not to be had from some reduction to an ad-hoc rules base on a formalism made for a different purpose (C(identifier)). > Statistically irrelevant. I know I am not statistically relevant. Yet, for actual statistics, if you see how programs are written in the low budget industry that might change your mind. The industry includes Google. ^ permalink raw reply [flat|nested] 48+ messages in thread
* Re: [OT] interesting reason why a language is considered good 2012-04-16 17:11 ` Georg Bauhaus @ 2012-04-16 17:19 ` Georg Bauhaus 2012-04-16 18:00 ` Dmitry A. Kazakov 1 sibling, 0 replies; 48+ messages in thread From: Georg Bauhaus @ 2012-04-16 17:19 UTC (permalink / raw) On 16.04.12 19:11, Georg Bauhaus wrote: > What counts is understandability of a program, which I think > is not to be had from some reduction to an ad-hoc rules base on > a formalism made for a different purpose (C(identifier)). (Monday...) What counts is understandability of a program, which I think is not to be had from some reduction to a formalism made for a different purpose, namely (C(identifier)). ^ permalink raw reply [flat|nested] 48+ messages in thread
* Re: [OT] interesting reason why a language is considered good 2012-04-16 17:11 ` Georg Bauhaus 2012-04-16 17:19 ` Georg Bauhaus @ 2012-04-16 18:00 ` Dmitry A. Kazakov 2012-04-16 21:48 ` Georg Bauhaus 1 sibling, 1 reply; 48+ messages in thread From: Dmitry A. Kazakov @ 2012-04-16 18:00 UTC (permalink / raw) On Mon, 16 Apr 2012 19:11:13 +0200, Georg Bauhaus wrote: > On 16.04.12 17:31, Dmitry A. Kazakov wrote: >> On Mon, 16 Apr 2012 17:01:05 +0200, Georg Bauhaus wrote: >> >>> On 16.04.12 15:06, Dmitry A. Kazakov wrote: >>>> On Mon, 16 Apr 2012 13:48:04 +0200, Georg Bauhaus wrote: >>>> >>>>> On 16.04.12 12:43, Marius Amado-Alves wrote: >>>>>> Love OT threads in this clever forum:-) >>>>>> >>>>>> Actually there is a bit of thruth in the absurd no keyword thing: >>>>>> *many* keywords can get in the way of naming identifiers. Ada, for one, >>>>>> has a bit too many keywords, with some good identifier candidates (when, >>>>>> others...) >>>>> >>>>> "when" and "others" are general abstractions. What kind >>>>> of programs will in effect be about general abstractions? >>>> >>>> The kind of programs in Ada language, which uses exactly these words. >>> >>> And these are? (If you could avoid the tautological void. >>> Be constructive! ;-) >> >> All Ada programs that use the case-statement. > > How now? First, you distinguish syntax from some "rest" of > the program, and then, when I do the same, the distinction is gone? You asked for examples of programs allegedly suffering from generality of the word "when", here is one: case Alignment is when Left => ...; when Right => ...; when Middle => ...; end case; > My question is: If "others" were moved from syntax to identifiers, > then what fraction, and what kind of programs will hugely profit > because they can now name things "others"? No, it is you who have to show a great number of reasonable written programs hugely suffering if "others" were allowed as an identifier. In order to do this you need to put up examples specific to the word "others." If the template works for a non-reserved word too, it does not qualify. >> => it is bad to use in all programs => it is bad for the language in which >> all these programs are written. q.e.d. > > IIUC, this is close to what I have said about the word "what" as > an identifier. "What" is bad in programs except maybe in programs > whose problem domain is the singleton word "what". It should not be > used as an identifier, IMHO. Should not be used /= must be reserved. Reserved = restricted for special use. I.e. *needed* and *used*, but not everywhere. The argument you were trying to make is about illegal words, ones which may not to used (because they sound bad for you). Example in Ada: "0_Illegal___identifier" >> Surely "when" and "at" are prefect names for a formal parameter of the type >> Time. > > I disagree. In my initial response, I made them "Leaving_When" and > so on, as these names are more meaningful. Counter example: procedure Leave (When : Time); >> Also your argument to universality would also apply to the parameters named >> "X", "Y", "Left", "Right" all over the LRM. It did not work there, but >> suddenly does for "when"? > > A word may work in an LRM. However, a program's problem domain is > not the LRM, in general. function "+" (Left, Right : Integer) return Integer; > Simon Wright has recently shown a nice way how to mend the situation > with X and Y for surface orientation, using Ada 2012 (substituting > Northings and Eastings in the profile, IIRC). I wonder what Australians would say about that. Anyway X is not reserved. Why? >>> "What" as an identifier shouldn't be, IMHO, >>> reserved or not, so words like "what" not being reserved does >>> not count as counter-argument in my book. I'd rather have a >>> list of words not recommended to augment reserved words. >> >> So either they must be reserved or your argument is wrong. The choice is >> yours. > > There is no MUST here. See. In other words, there are other reasons why "when" is reserved. Exactly my point. >> Statistically irrelevant. > > I know I am not statistically relevant. Yet, for actual statistics, > if you see how programs are written in the low budget industry > that might change your mind. You mean that low budget industry has no access to an editor capable to colourise Ada source code? Come on, gedit, AdaGide, GPS are free! -- Regards, Dmitry A. Kazakov http://www.dmitry-kazakov.de ^ permalink raw reply [flat|nested] 48+ messages in thread
* Re: [OT] interesting reason why a language is considered good 2012-04-16 18:00 ` Dmitry A. Kazakov @ 2012-04-16 21:48 ` Georg Bauhaus 2012-04-17 3:43 ` Randy Brukardt 2012-04-17 7:34 ` Dmitry A. Kazakov 0 siblings, 2 replies; 48+ messages in thread From: Georg Bauhaus @ 2012-04-16 21:48 UTC (permalink / raw) On 16.04.12 20:00, Dmitry A. Kazakov wrote: > You asked for examples of programs allegedly suffering from generality of > the word "when", here is one: Actually I asked for programs that profit from generality of words like "when" used as identifiers. > case Alignment is > when Left => ...; > when Right => ...; > when Middle => ...; > end case; What's the pain? >> My question is: If "others" were moved from syntax to identifiers, >> then what fraction, and what kind of programs will hugely profit >> because they can now name things "others"? > > No, it is you who have to show a great number of reasonable written > programs hugely suffering if "others" were allowed as an identifier. I have tried to explain that generic identifiers do not inform about specific things. "Others" is a generic, unspecific word. Is there a fraction of programs that profit from generic, unspecific identifiers? What is it? > Should not be used /= must be reserved. Er, yes, did I say that those words should be reserved? I imagine that one might draw this conclusion if arguing within a certain set of premises that isn't mine. > The argument you were trying to make is about illegal words, ones which may > not to used (because they sound bad for you). Example in Ada: > "0_Illegal___identifier" My bad if I did. I think I mentioned a wish for a list of words not recommended for use as identifiers, in addition to the one Ada reserves. >>> Surely "when" and "at" are prefect names for a formal parameter of the type >>> Time. >> >> I disagree. In my initial response, I made them "Leaving_When" and >> so on, as these names are more meaningful. > > Counter example: Only in case of universally quantified propositions. None of my business. But anyway, > procedure Leave (When : Time); ... begin while Now < When loop delay Step; Now := Clock; end loop; Left (Slot (When)) := Now; -- NB p.p. of to leave end Leave; I have tried to choose only unspecific or ambiguous nouns. Do you find this to be explaining itself well? Note the "well," not: possible to understand for the next few moments. begin while Now < Scheduled_Departure loop delay Pausing_Time; Now := Clock; end loop; Actual_Departure (Minute_Of (Scheduled_Departure)) := Now; end Leave; The first solution lets insiders pride themselves of knowing what the generic words mean, the second solution less so, I think. (I claim that neither is perfect.) >> Simon Wright has recently shown a nice way how to mend the situation >> with X and Y for surface orientation, using Ada 2012 (substituting >> Northings and Eastings in the profile, IIRC). > > I wonder what Australians would say about that. You don't mean that Australian drivers (or pilots) do not know how to head North? >>>> "What" as an identifier shouldn't be, IMHO, >>>> reserved or not, so words like "what" not being reserved does >>>> not count as counter-argument in my book. I'd rather have a >>>> list of words not recommended to augment reserved words. >>> >>> So either they must be reserved or your argument is wrong. The choice is >>> yours. >> >> There is no MUST here. > > See. In other words, there are other reasons why "when" is reserved. > Exactly my point. Not the point in question, I think. The point in question is what happens when even words like "when", i.e. even those that happen to be reserved now, do loose that special status. (Again, my desire to have a list of words that should be _effectively_ reserved, maybe trigger a warning, even when they can be used as identifiers.) >>> Statistically irrelevant. >> >> I know I am not statistically relevant. Yet, for actual statistics, >> if you see how programs are written in the low budget industry >> that might change your mind. > > You mean that low budget industry has no access to an editor capable to > colourise Ada source code? Come on, gedit, AdaGide, GPS are free! A graphical terminal on site? Wow! I am used to SSH. But I meant the thoughtless choice of identifiers that just happens, like sh*t. It is easier to choose generic words as identifier when a programming language is more permissive, Simply because it is harder to think of good names than to speak in broad, generic terms. So Ada unproven "limitation" is an accidental benefit of "when" etc. being reserved words. (I will not insist that this phenomenon is a low budget phenomenon, but I would think that software written in relatively expensive environments that feature quality control (even when functioning as a ritual only) do not let inscrutable cleverness pass. At least when it is understood that software matters.) ^ permalink raw reply [flat|nested] 48+ messages in thread
* Re: [OT] interesting reason why a language is considered good 2012-04-16 21:48 ` Georg Bauhaus @ 2012-04-17 3:43 ` Randy Brukardt 2012-04-17 4:43 ` Bill Findlay ` (2 more replies) 2012-04-17 7:34 ` Dmitry A. Kazakov 1 sibling, 3 replies; 48+ messages in thread From: Randy Brukardt @ 2012-04-17 3:43 UTC (permalink / raw) "Georg Bauhaus" <rm.dash-bauhaus@futureapps.de> wrote in message news:4f8c93a0$0$6638$9b4e6d93@newsspool2.arcor-online.net... > On 16.04.12 20:00, Dmitry A. Kazakov wrote: ... >> Counter example: > > Only in case of universally quantified propositions. None of my business. > But anyway, > >> procedure Leave (When : Time); > ... > begin > while Now < When loop > delay Step; > Now := Clock; > end loop; > Left (Slot (When)) := Now; -- NB p.p. of to leave > end Leave; > > I have tried to choose only unspecific or ambiguous nouns. > Do you find this to be explaining itself well? Note the "well," > not: possible to understand for the next few moments. This is irrelevant, because Ada requires the names of the parameters to be those used in *calls*. The names used in the body probably ought to be nouns, but in calls, verbs or adjectives often work better: Leave (When => Now); It is a smallish fault of Ada, in fact, because there almost never are names that work well both in calls and in the body. The solution is to define the parameter names as needed for readability in calls, and then (if those names are problematic in the body), rename them for use in the body: Exit_Time : Time renames When; ... > begin > while Now < Scheduled_Departure loop > delay Pausing_Time; > Now := Clock; > end loop; > Actual_Departure (Minute_Of (Scheduled_Departure)) := Now; > end Leave; Unfortunately, this solution makes insanely wordy calls: Leave (Scheduled_Departure => Now); In many cases, the parameter names overwhelm the actual values. The "solution" usually used is to omit them from the calls altogether, reducing readability and understandability. > The first solution lets insiders pride themselves of knowing what > the generic words mean, the second solution less so, I think. > (I claim that neither is perfect.) I would suggest using both, with a renames so that within the body, you can use the longer name, and at calls you can use the shorter name. Except, of course, since it is reserved. Randy. ^ permalink raw reply [flat|nested] 48+ messages in thread
* Re: [OT] interesting reason why a language is considered good 2012-04-17 3:43 ` Randy Brukardt @ 2012-04-17 4:43 ` Bill Findlay 2012-04-17 7:46 ` Georg Bauhaus 2012-04-17 15:48 ` Simon Wright 2 siblings, 0 replies; 48+ messages in thread From: Bill Findlay @ 2012-04-17 4:43 UTC (permalink / raw) On 17/04/2012 04:43, in article jmiotp$3gc$1@munin.nbi.dk, "Randy Brukardt" <randy@rrsoftware.com> wrote: > This is irrelevant, because Ada requires the names of the parameters to be > those used in *calls*. The names used in the body probably ought to be > nouns, but in calls, verbs or adjectives often work better: > > Leave (When => Now); > > It is a smallish fault of Ada, in fact, because there almost never are names > that work well both in calls and in the body. The solution is to define the > parameter names as needed for readability in calls, and then (if those names > are problematic in the body), rename them for use in the body: > > Exit_Time : Time renames When; System Control Language (SCL), the "JCL" for ICL's VME 2900 OS allowed a 'keyword' to be specified for each formal parameter, alongside its identifier in the formal parameter list. The keyword was used in calls and the identifier in the body. If no keyword was given explicitly, the identifier was used by default. This worked well, in my view. -- Bill Findlay with blueyonder.co.uk; use surname & forename; ^ permalink raw reply [flat|nested] 48+ messages in thread
* Re: [OT] interesting reason why a language is considered good 2012-04-17 3:43 ` Randy Brukardt 2012-04-17 4:43 ` Bill Findlay @ 2012-04-17 7:46 ` Georg Bauhaus 2012-04-17 22:32 ` Randy Brukardt 2012-04-17 15:48 ` Simon Wright 2 siblings, 1 reply; 48+ messages in thread From: Georg Bauhaus @ 2012-04-17 7:46 UTC (permalink / raw) On 17.04.12 05:43, Randy Brukardt wrote: > Ada requires the names of the parameters to be > those used in *calls*. Yes. In case there is a callable. > ... The solution is to define the > parameter names as needed for readability in calls, and then (if those names > are problematic in the body), rename them for use in the body: > > Exit_Time : Time renames When; > > ... >> begin >> while Now< Scheduled_Departure loop >> delay Pausing_Time; >> Now := Clock; >> end loop; >> Actual_Departure (Minute_Of (Scheduled_Departure)) := Now; >> end Leave; > > Unfortunately, this solution makes insanely wordy calls: > > Leave (Scheduled_Departure => Now); > > In many cases, the parameter names overwhelm the actual values. So, if Exit_Time is what you'd choose to denote the kind of time you have in mind, what about Leave (Exit_Time => Now) ? To me, "Exit_Time" says a lot more than "when" in any case! Why this insistence on "when"? There is an curious phenomenon here: everyone seems to be concentrating on parameter names. A case in which there is context. So there is - a unanimous vote in case of parameters: "when" is great! - a workaround for some other cases (but not aggregates, ...) - thoughtful considerations Still no answer to the question about a fraction of programs profiting from identifiers "when" and "others", so much that they should be allowed. I'd challenge, if I may, the compiler writers: Would you compiler writers honestly prefer to write code like for some access in record => when(access) = array(of); when when > at => accept record (type) do task.type := type; done; Trying to understand the source text requires constantly switching levels of meanings of the words. Does it really help? Nevertheless, I'd add expression functions to the set of solutions, which now only includes (re)naming of objects. A kind of the LET expressions: function Outer (par1, par2: T) return T is function flap return T is (par1 + globalN); function fluff return T is (((par2 + par1)) / 2 * flap); begin return flap * fluff; end Outer ^ permalink raw reply [flat|nested] 48+ messages in thread
* Re: [OT] interesting reason why a language is considered good 2012-04-17 7:46 ` Georg Bauhaus @ 2012-04-17 22:32 ` Randy Brukardt 2012-04-18 7:10 ` stefan-lucks 0 siblings, 1 reply; 48+ messages in thread From: Randy Brukardt @ 2012-04-17 22:32 UTC (permalink / raw) "Georg Bauhaus" <rm.dash-bauhaus@futureapps.de> wrote in message news:4f8d1fdf$0$6638$9b4e6d93@newsspool2.arcor-online.net... > On 17.04.12 05:43, Randy Brukardt wrote: ... > There is an curious phenomenon here: everyone seems to be > concentrating on parameter names. A case in which there is > context. It's not a "phenomenon". It's the entire point. There are places, even in Ada code, where there is enough context such that very short names are sufficient. (Another such case is names of primitive operations of tagged types.) In those cases, the very short names often turn out to be reserved. I don't care that much about "fixing" this "problem". In particular, "when" is just an example. And it is one of the words that would be a major problem if not reserved (you really need reserved words to delinate between parts of major syntax structures, such as the limbs of a case statement). So I don't see a future in which "when" would not be reserved. Plus, there is a major disconnect within WG 9 over reserved words. Most of the ARG believes that Ada has too many reserved words and could use an "unreserved keyword" concept (things like "some" and "until" belong in that category; there is little parsing value to having them reserved). However, every version of Ada (95, 2005, 2012) has that idea removed by WG 9. This happens because WG 9 votes by country, and most of the ARG supporters of the idea are from the US; Europeans tend to hate the idea. (This split happens very rarely, this is issue is the only one I recall.) So I doubt very much there ever will be a change in this in Ada. Randy. ^ permalink raw reply [flat|nested] 48+ messages in thread
* Re: [OT] interesting reason why a language is considered good 2012-04-17 22:32 ` Randy Brukardt @ 2012-04-18 7:10 ` stefan-lucks 2012-04-18 23:48 ` Randy Brukardt 0 siblings, 1 reply; 48+ messages in thread From: stefan-lucks @ 2012-04-18 7:10 UTC (permalink / raw) On Tue, 17 Apr 2012, Randy Brukardt wrote: > I don't care that much about "fixing" this "problem". In particular, "when" > is just an example. And it is one of the words that would be a major problem > if not reserved (you really need reserved words to delinate between parts of > major syntax structures, such as the limbs of a case statement). So I don't > see a future in which "when" would not be reserved. One solution could be introducing some limited form of case sensitivity: Making "when" and "WHEN" reserved words (with exactly the same syntactical meaning) while treating any mixed-case form, such as "When" or "WhEn" as identifiers, without differentiating between "When" and "WhEn". That would not make parsing any more difficult -- you would probably just have to tweak the lexer. And I have yet so see some Ada code where keywords are written in mixed case. -- ---- Stefan.Lucks (at) uni-weimar.de, University of Weimar, Germany ---- <http://www.uni-weimar.de/cms/medien/mediensicherheit/home.html> ------ I love the taste of Cryptanalysis in the morning! ------ ^ permalink raw reply [flat|nested] 48+ messages in thread
* Re: [OT] interesting reason why a language is considered good 2012-04-18 7:10 ` stefan-lucks @ 2012-04-18 23:48 ` Randy Brukardt 2012-04-19 14:22 ` Shark8 0 siblings, 1 reply; 48+ messages in thread From: Randy Brukardt @ 2012-04-18 23:48 UTC (permalink / raw) <stefan-lucks@see-the.signature> wrote in message news:Pine.LNX.4.64.1204180902020.24751@medsec1.medien.uni-weimar.de... ... > And I have yet so see some Ada code where > keywords are written in mixed case. The original R.R.Software style wrote keywords in mixed case. We only changed that style when Claw was built (I wanted Claw to have a more typical style). Most of the Janus/Ada compiler and runtime code has the old style (I've been changing the style when I've worked on particular subprograms, but of course many subprograms haven't needed changes). That's about 300,000 lines of Ada in total. So here's a piece of Janus/Ada code in the original style: Function Actual_Type(Old : In Type_Ptr) Return Type_Ptr Is ---------------------------------------------------------------------- -- Returns Actual type for a type which was declared in a generic -- -- unit specification. (The actual type was the subtype -- -- substituted in the template). Returns Type_Ptr'First if this -- -- isn't declared in a generic. Only can be used outside the -- -- Generic. -- ---------------------------------------------------------------------- Checking_Type : Type_Ptr := Old; Temp_Rec : Type_Rec := J2TypeTable.Get_From_Type_Table(Checking_Type); Begin Loop If Temp_Rec.Typs = GENERIC_INST Then Return Temp_Rec.Actual; -- Found it! Elsif Temp_Rec.Parent_Type /= Type_Ptr'First Then Checking_Type := Temp_Rec.Parent_Type; Temp_Rec := J2TypeTable.Get_From_Type_Table(Checking_Type); Else Return Type_Ptr'First; End If; End Loop; End Actual_Type; Now, having seen that, you can never say again that you haven't seen "some Ada code where keywords are written in mixed case." :-) Randy. ^ permalink raw reply [flat|nested] 48+ messages in thread
* Re: [OT] interesting reason why a language is considered good 2012-04-18 23:48 ` Randy Brukardt @ 2012-04-19 14:22 ` Shark8 0 siblings, 0 replies; 48+ messages in thread From: Shark8 @ 2012-04-19 14:22 UTC (permalink / raw) On Wednesday, April 18, 2012 6:48:28 PM UTC-5, Randy Brukardt wrote: > <stefan-lucks@see-the.signature> wrote in message > news:Pine.LNX.4.64.1204180902020.24751@medsec1.medien.uni-weimar.de... > ... > > And I have yet so see some Ada code where > > keywords are written in mixed case. > > The original R.R.Software style wrote keywords in mixed case. We only > changed that style when Claw was built (I wanted Claw to have a more typical > style). Most of the Janus/Ada compiler and runtime code has the old style > (I've been changing the style when I've worked on particular subprograms, > but of course many subprograms haven't needed changes). That's about 300,000 > lines of Ada in total. > > So here's a piece of Janus/Ada code in the original style: > > Function Actual_Type(Old : In Type_Ptr) Return Type_Ptr Is > ---------------------------------------------------------------------- > -- Returns Actual type for a type which was declared in a generic -- > -- unit specification. (The actual type was the subtype -- > -- substituted in the template). Returns Type_Ptr'First if this -- > -- isn't declared in a generic. Only can be used outside the -- > -- Generic. -- > ---------------------------------------------------------------------- > Checking_Type : Type_Ptr := Old; > Temp_Rec : Type_Rec := > J2TypeTable.Get_From_Type_Table(Checking_Type); > Begin > Loop > If Temp_Rec.Typs = GENERIC_INST Then > Return Temp_Rec.Actual; -- Found it! > Elsif Temp_Rec.Parent_Type /= Type_Ptr'First Then > Checking_Type := Temp_Rec.Parent_Type; > Temp_Rec := J2TypeTable.Get_From_Type_Table(Checking_Type); > Else > Return Type_Ptr'First; > End If; > End Loop; > End Actual_Type; > > Now, having seen that, you can never say again that you haven't seen "some > Ada code where keywords are written in mixed case." :-) > > Randy. I rather like the style there. ^ permalink raw reply [flat|nested] 48+ messages in thread
* Re: [OT] interesting reason why a language is considered good 2012-04-17 3:43 ` Randy Brukardt 2012-04-17 4:43 ` Bill Findlay 2012-04-17 7:46 ` Georg Bauhaus @ 2012-04-17 15:48 ` Simon Wright 2012-04-17 16:15 ` Dmitry A. Kazakov 2 siblings, 1 reply; 48+ messages in thread From: Simon Wright @ 2012-04-17 15:48 UTC (permalink / raw) "Randy Brukardt" <randy@rrsoftware.com> writes: > Unfortunately, this solution makes insanely wordy calls: > > Leave (Scheduled_Departure => Now); > > In many cases, the parameter names overwhelm the actual values. The > "solution" usually used is to omit them from the calls altogether, > reducing readability and understandability. Your "insanely wordy" is my "perfectly natural"! procedure Serve (Using_Port : GNAT.Sockets.Port_Type; At_Priority : System.Priority := System.Default_Priority; With_Stack : Positive := 20_000; Logging_Via : Logger := null; Tracing : Boolean := False); called as Serve (Using_Port => 8080, With_Stack => 40_000, Tracing => Verbose); Now that I look at them, both would probably be improved with a bit of alignment: Serve (Using_Port => 8080, With_Stack => 40_000, Tracing => Verbose); ^ permalink raw reply [flat|nested] 48+ messages in thread
* Re: [OT] interesting reason why a language is considered good 2012-04-17 15:48 ` Simon Wright @ 2012-04-17 16:15 ` Dmitry A. Kazakov 2012-04-17 19:33 ` Simon Wright 0 siblings, 1 reply; 48+ messages in thread From: Dmitry A. Kazakov @ 2012-04-17 16:15 UTC (permalink / raw) On Tue, 17 Apr 2012 16:48:23 +0100, Simon Wright wrote: > "Randy Brukardt" <randy@rrsoftware.com> writes: > >> Unfortunately, this solution makes insanely wordy calls: >> >> Leave (Scheduled_Departure => Now); >> >> In many cases, the parameter names overwhelm the actual values. The >> "solution" usually used is to omit them from the calls altogether, >> reducing readability and understandability. > > Your "insanely wordy" is my "perfectly natural"! > > procedure Serve (Using_Port : GNAT.Sockets.Port_Type; > At_Priority : System.Priority := System.Default_Priority; > With_Stack : Positive := 20_000; > Logging_Via : Logger := null; > Tracing : Boolean := False); > > called as > > Serve (Using_Port => 8080, > With_Stack => 40_000, > Tracing => Verbose); > > Now that I look at them, both would probably be improved with a bit of > alignment: > > Serve (Using_Port => 8080, > With_Stack => 40_000, > Tracing => Verbose); Why not "With_Tracing" then? In "Using_Port" "Using" is just noise, as well as "With" in "With_Stack." My take would be: Serve (Port => 8080, Max_Stack_Depth => 40_000, Tracing_Level => Verbose); P.S. I would never use an abstraction with side-effects. I.e. Serve would become an operation of some explicit Connection, Worker etc object keeping the state. -- Regards, Dmitry A. Kazakov http://www.dmitry-kazakov.de ^ permalink raw reply [flat|nested] 48+ messages in thread
* Re: [OT] interesting reason why a language is considered good 2012-04-17 16:15 ` Dmitry A. Kazakov @ 2012-04-17 19:33 ` Simon Wright 0 siblings, 0 replies; 48+ messages in thread From: Simon Wright @ 2012-04-17 19:33 UTC (permalink / raw) "Dmitry A. Kazakov" <mailbox@dmitry-kazakov.de> writes: > P.S. I would never use an abstraction with side-effects. I.e. Serve would > become an operation of some explicit Connection, Worker etc object keeping > the state. Since this web server was meant to be minimal and to run in small embedded systems, there was only one server, servicing a single port, so it wasn't all that abstract. I think I might revisit that now, in which case this would have been a Create operation, returning a web server. ^ permalink raw reply [flat|nested] 48+ messages in thread
* Re: [OT] interesting reason why a language is considered good 2012-04-16 21:48 ` Georg Bauhaus 2012-04-17 3:43 ` Randy Brukardt @ 2012-04-17 7:34 ` Dmitry A. Kazakov 2012-04-17 16:01 ` Simon Wright 2012-04-17 17:42 ` Georg Bauhaus 1 sibling, 2 replies; 48+ messages in thread From: Dmitry A. Kazakov @ 2012-04-17 7:34 UTC (permalink / raw) On Mon, 16 Apr 2012 23:48:15 +0200, Georg Bauhaus wrote: > On 16.04.12 20:00, Dmitry A. Kazakov wrote: > >> You asked for examples of programs allegedly suffering from generality of >> the word "when", here is one: > > Actually I asked for programs that profit from generality of words > like "when" used as identifiers. If you want to go that way, then I will ask you to show such programs for "why", "whose" etc. It always works (does not, actually) in both ways. >> case Alignment is >> when Left => ...; >> when Right => ...; >> when Middle => ...; >> end case; > > What's the pain? Yes, what pain? Why this program didn't suffered from using the dreadful "when"? > I have tried to explain that generic identifiers do not inform about > specific things. And I answered that this does not make them *reserved*. >>> Simon Wright has recently shown a nice way how to mend the situation >>> with X and Y for surface orientation, using Ada 2012 (substituting >>> Northings and Eastings in the profile, IIRC). >> >> I wonder what Australians would say about that. > > You don't mean that Australian drivers (or pilots) do not know how > to head North? I mean that "North" is probably not the best replacement for "vertical." And the latter is probably not same as "Y." It is sometimes "Z." The choice of names is always a difficult one, which also depends on the context of use, as Randy has pointed out. >> See. In other words, there are other reasons why "when" is reserved. >> Exactly my point. > > Not the point in question, I think. The point in question is what happens > when even words like "when", i.e. even those that happen to be reserved > now, do loose that special status. See, it has nothing to do with the meaning of a word. The only reason why "when" should possibly be reserved is on syntactic grounds. That should be considered from case to case. Specifically "when" could be allowed, I guess. >>>> Statistically irrelevant. >>> >>> I know I am not statistically relevant. Yet, for actual statistics, >>> if you see how programs are written in the low budget industry >>> that might change your mind. >> >> You mean that low budget industry has no access to an editor capable to >> colourise Ada source code? Come on, gedit, AdaGide, GPS are free! > > A graphical terminal on site? Wow! I am used to SSH. http://sourceforge.net/projects/xming + putty -- Regards, Dmitry A. Kazakov http://www.dmitry-kazakov.de ^ permalink raw reply [flat|nested] 48+ messages in thread
* Re: [OT] interesting reason why a language is considered good 2012-04-17 7:34 ` Dmitry A. Kazakov @ 2012-04-17 16:01 ` Simon Wright 2012-04-17 17:42 ` Georg Bauhaus 1 sibling, 0 replies; 48+ messages in thread From: Simon Wright @ 2012-04-17 16:01 UTC (permalink / raw) "Dmitry A. Kazakov" <mailbox@dmitry-kazakov.de> writes: > On Mon, 16 Apr 2012 23:48:15 +0200, Georg Bauhaus wrote: >>>> Simon Wright has recently shown a nice way how to mend the >>>> situation with X and Y for surface orientation, using Ada 2012 >>>> (substituting Northings and Eastings in the profile, IIRC). >>> >>> I wonder what Australians would say about that. >> >> You don't mean that Australian drivers (or pilots) do not know how to >> head North? > > I mean that "North" is probably not the best replacement for > "vertical." And the latter is probably not same as "Y." It is > sometimes "Z." The choice of names is always a difficult one, which > also depends on the context of use, as Randy has pointed out. Pretty sure you'll find that Australian maps are printed with North at the top. In the context of converting 2-D surface coordinates to compass bearings, I maintain that it makes a lot of sense to use the names Northings and Eastings. Of course, coordinate systems are always fun. The last system I worked on had at least 5, praise be I never had to understand them. ^ permalink raw reply [flat|nested] 48+ messages in thread
* Re: [OT] interesting reason why a language is considered good 2012-04-17 7:34 ` Dmitry A. Kazakov 2012-04-17 16:01 ` Simon Wright @ 2012-04-17 17:42 ` Georg Bauhaus 2012-04-17 19:17 ` Dmitry A. Kazakov 1 sibling, 1 reply; 48+ messages in thread From: Georg Bauhaus @ 2012-04-17 17:42 UTC (permalink / raw) On 17.04.12 09:34, Dmitry A. Kazakov wrote: > On Mon, 16 Apr 2012 23:48:15 +0200, Georg Bauhaus wrote: > >> On 16.04.12 20:00, Dmitry A. Kazakov wrote: >> >>> You asked for examples of programs allegedly suffering from generality of >>> the word "when", here is one: >> >> Actually I asked for programs that profit from generality of words >> like "when" used as identifiers. > > If you want to go that way, then I will ask you to show such programs for > "why", "whose" etc. It always works (does not, actually) in both ways. Same thing, I'll be happy if you have a list of convincing length showing programs that profit from "when", or "why", or "whose" in the same way; feel free to fist replace "when" with some word not in this set so that "when" does not become a dual use word (part of syntax and identifier). Unspecific, generic words just do not work well as identifiers. Be they "why", or "the", or "and", or "when". AFAICT, no one so far has cared about the direction of reasoning you keep bringing to the table. This is all about identifiers: There is a subset R of identifiers not working well and it happens to coincide with reserved words of Ada. There is another subset U of identifiers not working well either, but they are not reserved words of Ada. For w in R, bad wording is prevented (see below). For w in U, bad wording is not prevented (see below). If w is removed from R, and added to U, then the number of programs that can be written with bad wording will grow. The reasons for why w is in R has absolutely nothing to do with the consequences of moving w from R to U. >>> case Alignment is >>> when Left => ...; >>> when Right => ...; >>> when Middle => ...; >>> end case; >> >> What's the pain? > > Yes, what pain? Why this program didn't suffered from using the dreadful > "when"? "When" (like "at", or "from", or "why") is a generic, unspecific word that serves a purpose well, namely insofar as it is applicable to all kinds of programs. Being unspecific is a necessary precondition for a word to be applicable to all kinds of programs. (But unspecific, generic, does not mean meaningless. Try substituting other words, either equally unspecific such as "why", or a more specific such as "booyah", in place of "when". But this is all beside the point.) >> I have tried to explain that generic identifiers do not inform about >> specific things. > > And I answered that this does not make them *reserved*. Who cares? Making words reserved has nothing to do with the matter. It is all about the effects of making them *unreserved*. > See, it has nothing to do with the meaning of a word. The only reason why > "when" should possibly be reserved is on syntactic grounds. Again, not the point. "When" does not work well as a identifier. Context will help a lot when understanding some occurrence of "when". But Ada is not a language that has this "context principle" built in. So "when" alone is bound to be a failure, just as "why" is. case Foo is why Red => ...; case Foo is booyah Red => ...; I see more than syntax as the base for preferring "when" over "why", or "booyah". >> A graphical terminal on site? Wow! I am used to SSH. > > http://sourceforge.net/projects/xming + putty X11? Great. BTW, a fancy IDE will not convince me that the language's syntax should be changed in favor of appearance aided by a massively error checking source code editor. ^ permalink raw reply [flat|nested] 48+ messages in thread
* Re: [OT] interesting reason why a language is considered good 2012-04-17 17:42 ` Georg Bauhaus @ 2012-04-17 19:17 ` Dmitry A. Kazakov 0 siblings, 0 replies; 48+ messages in thread From: Dmitry A. Kazakov @ 2012-04-17 19:17 UTC (permalink / raw) On Tue, 17 Apr 2012 19:42:57 +0200, Georg Bauhaus wrote: > On 17.04.12 09:34, Dmitry A. Kazakov wrote: >> On Mon, 16 Apr 2012 23:48:15 +0200, Georg Bauhaus wrote: >> >>> On 16.04.12 20:00, Dmitry A. Kazakov wrote: >>> >>>> You asked for examples of programs allegedly suffering from generality of >>>> the word "when", here is one: >>> >>> Actually I asked for programs that profit from generality of words >>> like "when" used as identifiers. >> >> If you want to go that way, then I will ask you to show such programs for >> "why", "whose" etc. It always works (does not, actually) in both ways. > > Same thing, I'll be happy if you have a list of convincing length > showing programs that profit from "when", or "why", or "whose" in > the same way; Not required. Your argument is already wrong per Modus tollens. >>>> case Alignment is >>>> when Left => ...; >>>> when Right => ...; >>>> when Middle => ...; >>>> end case; >>> >>> What's the pain? >> >> Yes, what pain? Why this program didn't suffered from using the dreadful >> "when"? > > "When" (like "at", or "from", or "why") is a generic, unspecific word > that serves a purpose well, namely insofar as it is applicable to all > kinds of programs. You repeated that many times. According to you practically any Ada program is pain. Congratulations. >>> I have tried to explain that generic identifiers do not inform about >>> specific things. >> >> And I answered that this does not make them *reserved*. > > Who cares? Making words reserved has nothing to do with the matter. > It is all about the effects of making them *unreserved*. not reserved = unreserved. >>> A graphical terminal on site? Wow! I am used to SSH. >> >> http://sourceforge.net/projects/xming + putty > > X11? Great. BTW, a fancy IDE will not convince me that the > language's syntax should be changed in favor of appearance aided > by a massively error checking source code editor. There is no need to change language syntax in order to remove at least half of reserved words, because it is not syntax (e.g. having to extra look ahead) that motivated the choice for most of them. -- Regards, Dmitry A. Kazakov http://www.dmitry-kazakov.de ^ permalink raw reply [flat|nested] 48+ messages in thread
* Re: [OT] interesting reason why a language is considered good 2012-04-16 15:31 ` Dmitry A. Kazakov 2012-04-16 17:11 ` Georg Bauhaus @ 2012-04-17 3:24 ` Randy Brukardt 2012-04-17 3:33 ` Randy Brukardt 2 siblings, 0 replies; 48+ messages in thread From: Randy Brukardt @ 2012-04-17 3:24 UTC (permalink / raw) "Dmitry A. Kazakov" <mailbox@dmitry-kazakov.de> wrote in message news:szik5e8e6n4m$.dgyqh41b6k6b$.dlg@40tude.net... ... >> Amado-Alves claimed that "when" and "others" show that the number >> of reserved words in Ada is too large, because they are good >> candidates for identifiers. > > Surely "when" and "at" are prefect names for a formal parameter of the > type > Time. I was going to say that; I tend to write such parameters from time-to-time, and after the compiler complains, I change them to something wordier. But that's not necessarily helpful, as formal parameter names can be (and ought to be) used in calls: Open_Gates (To_Percent => 0.75, When => Clock + 3600.00); (Not to mention us compiler-writers, which want to have enumerations named "Array" and "Record" and "Access" for describing kinds of types.) Randy. ^ permalink raw reply [flat|nested] 48+ messages in thread
* Re: [OT] interesting reason why a language is considered good 2012-04-16 15:31 ` Dmitry A. Kazakov 2012-04-16 17:11 ` Georg Bauhaus 2012-04-17 3:24 ` Randy Brukardt @ 2012-04-17 3:33 ` Randy Brukardt 2 siblings, 0 replies; 48+ messages in thread From: Randy Brukardt @ 2012-04-17 3:33 UTC (permalink / raw) "Dmitry A. Kazakov" <mailbox@dmitry-kazakov.de> wrote in message news:szik5e8e6n4m$.dgyqh41b6k6b$.dlg@40tude.net... ... >> I disagree strongly, likely because IDEs usually become only DEs for >> heterogeneous sources in my real world: IDEs typically >> lack reliable means of automatically mapping (possibly broken) >> source to and from foreign layout, but layout becomes essential if >> syntax is abandoned for readability. Moreover, I happen to work in >> an environment that requires the use of editors (and terminals) >> that happen to be available with a given foreign system. My work >> can become rather difficult when programmers have relied on >> "graphical" or "typographical" properties of some IDE, and not >> plain old syntax. > > Statistically irrelevant. Probably there exist Ada programmers using > typewriter without characters |, #, " (See Ada 83 RM 2.10). Don't care! Well, I think you'll find a lot of Ada programmers that don't use an IDE at least part of the time. Me, for instance. (I've never found one that doesn't get in the way when editing -- and I built two of them during my career; I still use a circa 1986 MS-DOS editor for virtually all program editing.) Assuming any particular display for a programming language is exactly wrong, because things change faster than the programming language could possibly change. Randy. ^ permalink raw reply [flat|nested] 48+ messages in thread
* Re: [OT] interesting reason why a language is considered good 2012-04-16 10:43 ` Marius Amado-Alves 2012-04-16 11:48 ` Georg Bauhaus @ 2012-04-16 19:55 ` sbelmont700 2012-04-17 0:48 ` Peter C. Chapin 2 siblings, 0 replies; 48+ messages in thread From: sbelmont700 @ 2012-04-16 19:55 UTC (permalink / raw) Cc: nma On Monday, April 16, 2012 6:43:21 AM UTC-4, marius63 wrote: > Actually there is a bit of thruth in the absurd no keyword thing Imagine the nightmare if no keywords were reserved: if if then then; end; if end then if else then end if; end if; Now just imagine trying to write a compiler to parse it. The simplicity gained by reserving a few (or even more than a few...) far outweighs the minor annoyance of picking a new name now and again. ^ permalink raw reply [flat|nested] 48+ messages in thread
* Re: [OT] interesting reason why a language is considered good 2012-04-16 10:43 ` Marius Amado-Alves 2012-04-16 11:48 ` Georg Bauhaus 2012-04-16 19:55 ` sbelmont700 @ 2012-04-17 0:48 ` Peter C. Chapin 2 siblings, 0 replies; 48+ messages in thread From: Peter C. Chapin @ 2012-04-17 0:48 UTC (permalink / raw) On 2012-04-16 06:43, Marius Amado-Alves wrote: > Actually there is a bit of truth in the absurd no keyword thing: > *many* keywords can get in the way of naming identifiers. Ada, for > one, has a bit too many keywords, with some good identifier > candidates (when, others...) I think it's good that Ada reserves a number of simple words like "with" and "others" and "is." That way when new features are added and new syntax is needed it's relatively easy to find existing words to support the new syntax. For example: aspect clauses introduced with "with" and multiple inheritance of interfaces introduced with "and." I know there was much gnashing of teeth about adding "some" to Ada 2012's list of reserved words but now that it's done, and now that Ada reserves both "some" and "all," who knows what interesting uses those words can be put to in the future. :) Peter ^ permalink raw reply [flat|nested] 48+ messages in thread
* Re: [OT] interesting reason why a language is considered good 2012-04-15 10:27 [OT] interesting reason why a language is considered good Nasser M. Abbasi ` (4 preceding siblings ...) 2012-04-16 10:43 ` Marius Amado-Alves @ 2012-04-17 21:59 ` anon 2012-05-13 4:14 ` David Thompson 5 siblings, 1 reply; 48+ messages in thread From: anon @ 2012-04-17 21:59 UTC (permalink / raw) Most languages uses, a limited set of words. One reason is that it is easier to implement. An example is where a routine does not return a value aka a procedure is defined in some languages like Ada with the usage of the word "procedure" but in other languages like C the same routines is defined as a function with a "void" return value. The problem in C is that a "return <value>" statement can still be used with a C's procedure, unlike Ada. An exception is PL/I. Due to it origins PL/I is the one of a very few language that more language words. And in PL/I there is no "Reserved words." All words can be use for any purpose, an and example of a legal statement is, if if = true then else = 0 ; else call then ; end ; In this case, "if" and "then" and "else" are both variables, routine and language words. And even though these type of statement are legal most PL/I programmers only see these type of statements on test or a text book. In <jme7r1$eo7$1@speranza.aioe.org>, "Nasser M. Abbasi" <nma@12000.org> writes: > >I thought some here might enjoy this, since I know Ada >folks are more "software engineering" aware than the >average on the net ;) > >Here is what I read: > >"The lack of reserved words in the language gives the >programmer complete freedom to choose identifiers." > >The above was listed under the header of what makes this >language easy, robust and well defined! (I am not >going to name the language). > >Now, I found this to be so strange and really bizarre, as >I would have thought it should be the other way round. > >Reserved words are a good thing. Having an >identifier be called 'if' or 'then' or 'which' is >supposed to be good as it gives the programmer the freedom >to choose the name of the variables? > >I am sometimes just amazed at what I read on the net >about what makes a language good. But this one tops >the list. > >--Nasser ^ permalink raw reply [flat|nested] 48+ messages in thread
* Re: [OT] interesting reason why a language is considered good 2012-04-17 21:59 ` anon @ 2012-05-13 4:14 ` David Thompson 0 siblings, 0 replies; 48+ messages in thread From: David Thompson @ 2012-05-13 4:14 UTC (permalink / raw) On Tue, 17 Apr 2012 21:59:08 +0000 (UTC), anon@att.net wrote: > Most languages uses, a limited set of words. One reason is that it is > easier to implement. An example is where a routine does not return a > value aka a procedure is defined in some languages like Ada with the > usage of the word "procedure" but in other languages like C the same > routines is defined as a function with a "void" return value. The Yes, although this doesn't tie directly to use of (reserved) keywords. You can declare an ordinary identifier as a typedef for void, use that identifier as the return type for a function, and you have a function returning void, i.e. a procedure or 'void function', exactly as if you used the keyword. Nit: void return *type*. C treats void as a type that has no values. Um, well, okay. > problem in C is that a "return <value>" statement can still be used > with a C's procedure, unlike Ada. > Not true, but approximately equidistant from three true things: - in original=K&R1 C, there was no void. (Kind of the opposite of Genesis <G>) All functions returned some primitive or pointer type (original C couldn't return struct, and C still can't return array); if you didn't specify a return type, it defaulted to int. The/each caller could either use or ignore any type of function value. If a function had no meaningful value to return, the convention was to default the type to int but not execute any 'return expr' statement and the caller didn't use the invalid value. Being only a convention the compiler(s) couldn't catch bugs here. - in C89, type void was added, and it became a constraint violation (and mandatory diagnostic) to use 'return expr' in a void function, or for a caller to use a 'void' return. But it was allowed to use 'return /*noexpr*/' in a nonvoid function as long as all callers didn't use the invalid value. In C99 'return /*noexpr*/ became c.v. also, but it is still permitted to return by 'falling off the end' which in a nonvoid function returns bogus; better compilers warn for this. - in *C++*, which is *not* a superset of C although it comes close enough to fool many people, you can 'return expr' in a void function *if* the expression has type void (and necessarily no value). This allows writing generics that work equally for void and other(?) types; that isn't useful very often, but sometimes it is. > > An exception is PL/I. > > Due to it origins PL/I is the one of a very few language that more > language words. And in PL/I there is no "Reserved words." All words > can be use for any purpose, an and example of a legal statement is, > It's true PL/I keywords aren't reserved, and this can be badly abused as in your example. I don't understand what 'very few language that more language words' means. If you mean PL/I has very many keywords, not so; I'd guess COBOL has easily twice as many, and COBOL *does* reserve them, so with each revision (and expansion) of the standard people had to change now-illegal identifiers in their programs. Ada has roughly as many as PL/I, although Ada's are more carefully chosen. I'd bet even SQL has more keywords than PL/I, although SQL has a syntax to un-keyword something you want as an identifier. And modern Fortran (>=90 and especially >=03) has probably about as many keywords as PL/I, also unreserved (and sometimes context-limited). ^ permalink raw reply [flat|nested] 48+ messages in thread
end of thread, other threads:[~2012-05-13 4:14 UTC | newest] Thread overview: 48+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2012-04-15 10:27 [OT] interesting reason why a language is considered good Nasser M. Abbasi 2012-04-15 11:57 ` J-P. Rosen 2012-04-16 10:37 ` Peter C. Chapin 2012-04-15 12:27 ` Dmitry A. Kazakov 2012-04-17 6:59 ` tonyg 2012-04-17 7:43 ` Dmitry A. Kazakov 2012-04-15 14:05 ` Bill Findlay 2012-04-15 14:21 ` Pascal Obry 2012-04-15 14:54 ` Simon Wright 2012-04-15 15:34 ` Pascal Obry 2012-04-17 5:42 ` Brad Moore 2012-04-17 16:11 ` Simon Wright 2012-04-17 16:33 ` Robert A Duff 2012-04-17 19:34 ` Simon Wright 2012-04-17 21:42 ` Robert A Duff 2012-04-17 22:24 ` Randy Brukardt 2012-04-18 7:00 ` stefan-lucks 2012-04-17 21:17 ` Jeffrey Carter 2012-04-15 23:53 ` Brian Drummond 2012-04-16 10:43 ` Marius Amado-Alves 2012-04-16 11:48 ` Georg Bauhaus 2012-04-16 13:06 ` Dmitry A. Kazakov 2012-04-16 15:01 ` Georg Bauhaus 2012-04-16 15:31 ` Dmitry A. Kazakov 2012-04-16 17:11 ` Georg Bauhaus 2012-04-16 17:19 ` Georg Bauhaus 2012-04-16 18:00 ` Dmitry A. Kazakov 2012-04-16 21:48 ` Georg Bauhaus 2012-04-17 3:43 ` Randy Brukardt 2012-04-17 4:43 ` Bill Findlay 2012-04-17 7:46 ` Georg Bauhaus 2012-04-17 22:32 ` Randy Brukardt 2012-04-18 7:10 ` stefan-lucks 2012-04-18 23:48 ` Randy Brukardt 2012-04-19 14:22 ` Shark8 2012-04-17 15:48 ` Simon Wright 2012-04-17 16:15 ` Dmitry A. Kazakov 2012-04-17 19:33 ` Simon Wright 2012-04-17 7:34 ` Dmitry A. Kazakov 2012-04-17 16:01 ` Simon Wright 2012-04-17 17:42 ` Georg Bauhaus 2012-04-17 19:17 ` Dmitry A. Kazakov 2012-04-17 3:24 ` Randy Brukardt 2012-04-17 3:33 ` Randy Brukardt 2012-04-16 19:55 ` sbelmont700 2012-04-17 0:48 ` Peter C. Chapin 2012-04-17 21:59 ` anon 2012-05-13 4:14 ` David Thompson
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox