Discussion:
[OT] interesting reason why a language is considered good
(too old to reply)
Nasser M. Abbasi
2012-04-15 10:27:36 UTC
Permalink
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
J-P. Rosen
2012-04-15 11:57:56 UTC
Permalink
Post by Nasser M. Abbasi
"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
Peter C. Chapin
2012-04-16 10:37:44 UTC
Permalink
Post by J-P. Rosen
"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
Dmitry A. Kazakov
2012-04-15 12:27:45 UTC
Permalink
Post by Nasser M. Abbasi
"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
tonyg
2012-04-17 06:59:44 UTC
Permalink
Post by Dmitry A. Kazakov
Post by Nasser M. Abbasi
"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.
Dmitry A. Kazakov
2012-04-17 07:43:33 UTC
Permalink
Post by tonyg
Post by Dmitry A. Kazakov
Post by Nasser M. Abbasi
"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
Bill Findlay
2012-04-15 14:05:25 UTC
Permalink
Post by Nasser M. Abbasi
I thought some here might enjoy this, since I know Ada
folks are more "software engineering" aware than the
average on the net ;)
"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;
Pascal Obry
2012-04-15 14:21:12 UTC
Permalink
Nasser,
Post by Nasser M. Abbasi
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
Simon Wright
2012-04-15 14:54:30 UTC
Permalink
Post by Pascal Obry
Nasser,
Post by Nasser M. Abbasi
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)
Pascal Obry
2012-04-15 15:34:10 UTC
Permalink
Post by Simon Wright
Post by Pascal Obry
Nasser,
Post by Nasser M. Abbasi
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
Brad Moore
2012-04-17 05:42:40 UTC
Permalink
Post by Pascal Obry
Post by Simon Wright
Post by Pascal Obry
Nasser,
Post by Nasser M. Abbasi
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
Simon Wright
2012-04-17 16:11:36 UTC
Permalink
Post by Pascal Obry
Post by Simon Wright
Post by Pascal Obry
Nasser,
Post by Nasser M. Abbasi
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.
Robert A Duff
2012-04-17 16:33:26 UTC
Permalink
Post by Simon Wright
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
Simon Wright
2012-04-17 19:34:51 UTC
Permalink
Post by Robert A Duff
Post by Simon Wright
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!
Robert A Duff
2012-04-17 21:42:37 UTC
Permalink
Post by Simon Wright
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
Randy Brukardt
2012-04-17 22:24:41 UTC
Permalink
Post by Robert A Duff
Post by Simon Wright
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.
s***@see-the.signature
2012-04-18 07:00:46 UTC
Permalink
Post by Randy Brukardt
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! ------
Jeffrey Carter
2012-04-17 21:17:38 UTC
Permalink
Post by Robert A Duff
Post by Simon Wright
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
Brian Drummond
2012-04-15 23:53:14 UTC
Permalink
Post by Simon Wright
Post by Pascal Obry
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
Marius Amado-Alves
2012-04-16 10:43:21 UTC
Permalink
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.)
Georg Bauhaus
2012-04-16 11:48:04 UTC
Permalink
Post by Marius Amado-Alves
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.)
Dmitry A. Kazakov
2012-04-16 13:06:02 UTC
Permalink
Post by Georg Bauhaus
Post by Marius Amado-Alves
Love OT threads in this clever forum:-)
*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
Georg Bauhaus
2012-04-16 15:01:05 UTC
Permalink
Post by Dmitry A. Kazakov
Post by Georg Bauhaus
Post by Marius Amado-Alves
Love OT threads in this clever forum:-)
*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! ;-)
Post by Dmitry A. Kazakov
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".
Post by Dmitry A. Kazakov
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.
Post by Dmitry A. Kazakov
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.
Dmitry A. Kazakov
2012-04-16 15:31:21 UTC
Permalink
Post by Georg Bauhaus
Post by Dmitry A. Kazakov
Post by Georg Bauhaus
Post by Marius Amado-Alves
Love OT threads in this clever forum:-)
*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.
Post by Georg Bauhaus
Post by Dmitry A. Kazakov
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.
Post by Georg Bauhaus
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"?
Post by Georg Bauhaus
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"?
Post by Georg Bauhaus
Post by Dmitry A. Kazakov
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.
Post by Georg Bauhaus
Post by Dmitry A. Kazakov
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
Georg Bauhaus
2012-04-16 17:11:13 UTC
Permalink
Post by Dmitry A. Kazakov
Post by Georg Bauhaus
Post by Dmitry A. Kazakov
Post by Georg Bauhaus
Post by Marius Amado-Alves
Love OT threads in this clever forum:-)
*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 ...)
Post by Dmitry A. Kazakov
Post by Georg Bauhaus
Post by Dmitry A. Kazakov
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".
Post by Dmitry A. Kazakov
=> 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.
Post by Dmitry A. Kazakov
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.
Post by Dmitry A. Kazakov
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).
Post by Dmitry A. Kazakov
Post by Georg Bauhaus
"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)).
Post by Dmitry A. Kazakov
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.
Georg Bauhaus
2012-04-16 17:19:54 UTC
Permalink
Post by Georg Bauhaus
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)).
Dmitry A. Kazakov
2012-04-16 18:00:43 UTC
Permalink
Post by Georg Bauhaus
Post by Dmitry A. Kazakov
Post by Georg Bauhaus
Post by Dmitry A. Kazakov
Post by Georg Bauhaus
Post by Marius Amado-Alves
Love OT threads in this clever forum:-)
*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;
Post by Georg Bauhaus
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.
Post by Georg Bauhaus
Post by Dmitry A. Kazakov
=> 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"
Post by Georg Bauhaus
Post by Dmitry A. Kazakov
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);
Post by Georg Bauhaus
Post by Dmitry A. Kazakov
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;
Post by Georg Bauhaus
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?
Post by Georg Bauhaus
Post by Dmitry A. Kazakov
Post by Georg Bauhaus
"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.
Post by Georg Bauhaus
Post by Dmitry A. Kazakov
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
Georg Bauhaus
2012-04-16 21:48:15 UTC
Permalink
Post by Dmitry A. Kazakov
You asked for examples of programs allegedly suffering from generality of
Actually I asked for programs that profit from generality of words
like "when" used as identifiers.
Post by Dmitry A. Kazakov
case Alignment is
when Left => ...;
when Right => ...;
when Middle => ...;
end case;
What's the pain?
Post by Dmitry A. Kazakov
Post by Georg Bauhaus
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?
Post by Dmitry A. Kazakov
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.
Post by Dmitry A. Kazakov
The argument you were trying to make is about illegal words, ones which may
"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.
Post by Dmitry A. Kazakov
Post by Georg Bauhaus
Post by Dmitry A. Kazakov
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.
Only in case of universally quantified propositions. None of my business.
But anyway,
Post by Dmitry A. Kazakov
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.)
Post by Dmitry A. Kazakov
Post by Georg Bauhaus
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?
Post by Dmitry A. Kazakov
Post by Georg Bauhaus
Post by Dmitry A. Kazakov
Post by Georg Bauhaus
"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.)
Post by Dmitry A. Kazakov
Post by Georg Bauhaus
Post by Dmitry A. Kazakov
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.)
Randy Brukardt
2012-04-17 03:43:49 UTC
Permalink
...
Post by Georg Bauhaus
Only in case of universally quantified propositions. None of my business.
But anyway,
Post by Dmitry A. Kazakov
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;

...
Post by Georg Bauhaus
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.
Post by Georg Bauhaus
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.
Bill Findlay
2012-04-17 04:43:36 UTC
Permalink
Post by Randy Brukardt
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
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
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;
Georg Bauhaus
2012-04-17 07:46:38 UTC
Permalink
Post by Randy Brukardt
Ada requires the names of the parameters to be
those used in *calls*.
Yes. In case there is a callable.
Post by Randy Brukardt
... The solution is to define the
parameter names as needed for readability in calls, and then (if those names
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;
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
Randy Brukardt
2012-04-17 22:32:51 UTC
Permalink
...
Post by Georg Bauhaus
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.
s***@see-the.signature
2012-04-18 07:10:00 UTC
Permalink
Post by Randy Brukardt
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! ------
Randy Brukardt
2012-04-18 23:48:28 UTC
Permalink
<stefan-***@see-the.signature> wrote in message news:***@medsec1.medien.uni-weimar.de...
...
Post by s***@see-the.signature
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.
Shark8
2012-04-19 14:22:58 UTC
Permalink
Post by Randy Brukardt
...
Post by s***@see-the.signature
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.
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.
Simon Wright
2012-04-17 15:48:23 UTC
Permalink
Post by Randy Brukardt
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);
Dmitry A. Kazakov
2012-04-17 16:15:04 UTC
Permalink
Post by Simon Wright
Post by Randy Brukardt
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
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
Simon Wright
2012-04-17 19:33:36 UTC
Permalink
Post by Dmitry A. Kazakov
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.
Dmitry A. Kazakov
2012-04-17 07:34:49 UTC
Permalink
Post by Georg Bauhaus
Post by Dmitry A. Kazakov
You asked for examples of programs allegedly suffering from generality of
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.
Post by Georg Bauhaus
Post by Dmitry A. Kazakov
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"?
Post by Georg Bauhaus
I have tried to explain that generic identifiers do not inform about
specific things.
And I answered that this does not make them *reserved*.
Post by Georg Bauhaus
Post by Dmitry A. Kazakov
Post by Georg Bauhaus
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.
Post by Georg Bauhaus
Post by Dmitry A. Kazakov
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.
Post by Georg Bauhaus
Post by Dmitry A. Kazakov
Post by Georg Bauhaus
Post by Dmitry A. Kazakov
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
Simon Wright
2012-04-17 16:01:47 UTC
Permalink
Post by Dmitry A. Kazakov
Post by Dmitry A. Kazakov
Post by Georg Bauhaus
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.
Georg Bauhaus
2012-04-17 17:42:57 UTC
Permalink
Post by Dmitry A. Kazakov
Post by Georg Bauhaus
Post by Dmitry A. Kazakov
You asked for examples of programs allegedly suffering from generality of
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.
Post by Dmitry A. Kazakov
Post by Georg Bauhaus
Post by Dmitry A. Kazakov
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.)
Post by Dmitry A. Kazakov
Post by Georg Bauhaus
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*.
Post by Dmitry A. Kazakov
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".
Post by Dmitry A. Kazakov
Post by Georg Bauhaus
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.
Dmitry A. Kazakov
2012-04-17 19:17:32 UTC
Permalink
Post by Georg Bauhaus
Post by Dmitry A. Kazakov
Post by Georg Bauhaus
Post by Dmitry A. Kazakov
You asked for examples of programs allegedly suffering from generality of
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.
Post by Georg Bauhaus
Post by Dmitry A. Kazakov
Post by Georg Bauhaus
Post by Dmitry A. Kazakov
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.
Post by Georg Bauhaus
Post by Dmitry A. Kazakov
Post by Georg Bauhaus
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.
Post by Georg Bauhaus
Post by Dmitry A. Kazakov
Post by Georg Bauhaus
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
Randy Brukardt
2012-04-17 03:24:41 UTC
Permalink
"Dmitry A. Kazakov" <***@dmitry-kazakov.de> wrote in message news:szik5e8e6n4m$.dgyqh41b6k6b$***@40tude.net...
...
Post by Dmitry A. Kazakov
Post by Georg Bauhaus
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.
Randy Brukardt
2012-04-17 03:33:35 UTC
Permalink
"Dmitry A. Kazakov" <***@dmitry-kazakov.de> wrote in message news:szik5e8e6n4m$.dgyqh41b6k6b$***@40tude.net...
...
Post by Dmitry A. Kazakov
Post by Georg Bauhaus
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.
s***@gmail.com
2012-04-16 19:55:52 UTC
Permalink
Post by Marius Amado-Alves
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.
Dennis Lee Bieber
2012-04-17 02:37:10 UTC
Permalink
Post by s***@gmail.com
Post by Marius Amado-Alves
Actually there is a bit of thruth in the absurd no keyword thing
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.
Then there is one of my favorites... FORTRAN, in which white space
is optional... Which statements begin a loop, and which are assignments:

DO 10 IX = 1. 5
DO10IX = 1, 5
DO 10 IX = 1,5
DO10IX=1.5
D O1 0I X = 1 . 5
DO1 0IX = 1 , 5

The type of statement can not be determined until one encounters the
. or , -- and if the compiler made the wrong choice it has to back track
all the way to the beginning.
--
Wulfraed Dennis Lee Bieber AF6VN
***@ix.netcom.com HTTP://wlfraed.home.netcom.com/
Peter C. Chapin
2012-04-17 00:48:55 UTC
Permalink
Post by Marius Amado-Alves
*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
a***@att.net
2012-04-17 21:59:08 UTC
Permalink
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.
Post by Nasser M. Abbasi
I thought some here might enjoy this, since I know Ada
folks are more "software engineering" aware than the
average on the net ;)
"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
David Thompson
2012-05-13 04:14:01 UTC
Permalink
Post by a***@att.net
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.
Post by a***@att.net
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.
Post by a***@att.net
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).

Continue reading on narkive:
Loading...