Mombu the Programming Forum

Go Back   Mombu the Programming Forum > Programming > Keywords vs. Reserved Words
User Name
Password
REGISTER NOW! Mark Forums Read




Reply Bookmark and Share
1 23rd August 07:14
bob lidral
External User
 
Posts: 1
Default Keywords vs. Reserved Words



It seemed to me the original thread was getting a little too
deeply-nested and that this topic had split off from the rest so I'm
starting a new topic.


Not true. Again, you seem to ignore, to duck, to be unable to
understand, or to be just too blind to see that, with keywords that are
not reserved, the programmer only needs to know the keywords needed to
write the program. Further, even those keywords can be used as variable
or procedure names (whether or not it makes sense to do so) without
ambiguity. There is NO NEED to know any of the other keywords in the
language. Why do you keep ignoring this or changing the subject? When
the keywords are also reserved (as in Ada, apparently), then, AND ONLY
THEN, does the programmer need to know all of the keywords in the
language to avoid inadvertently using them as user-defined names. Yet
you keep insisting over and over and over and over and over and over and
over and over and over and over again that PL/I programmers need to know
ALL of the PL/I keywords in order to write any program. Why is that?

I believe Shmuel also raised the issue of compatibility with extensions.
If a programmer uses a sensible name for a variable, it's possible
that some future language extension will introduce a reserved word that
conflicts with that variable name -- thereby breaking existing programs.
Thus, in a language with reserved words, a programmer either has to
know all of the current and possible future reserved words or must
misspell every variable and procedure name and hope to avoid potential
future conflicts. Of course, with a language as perfect as Ada, no
extensions will ever be needed or, indeed, have been needed since the
original language spec. But you keep claiming PL/I needs all sorts of
extensions, therefore it would seem to be to PL/I's advantage NOT to
have reserved words in order to make it easier to add those extensions.

There's a similar issue that arises with keyword abbreviations. It's
not so common these days since everything seems to be converting to GUI
interfaces, but some command-oriented utilities (debuggers, editors,
etc.) allow abbreviation of command keywords. There are two common
methods of recognizing keyword abbreviations: either there's an explicit
list of abbreviations for each keyword (e.g., "decl" for "declare") or
the utility recognizes any string of characters that uniquely matches
the beginning of the keyword (with, perhaps, a minimum required number
of characters, e.g., 3): thus, any of "dec", "decl", "decla", ... would
match "declare" (sort of like automatic file name completion in Linux
csh or Windows). The problem with "shortest unique beginning string" is
that, while convenient for the user, later extensions to the utility
that add new keywords can cause previously unique starting sequences to
become ambiguous -- possibly breaking previously-written scripts.

Hmm. Well, if memory serves, you originated this line of comparison by
attacking PL/I as inferior because it didn't have reserved words. In
your ignorance of PL/I and apparent desperation to defend your position,
you disparaged or dismissed counterexamples as not realistic and even
resorted to an ad hominem attack against at least one other member of
this ng. adaworks@sbcglobal.net wrote:

No, I don't. But they're all keywords in PL/I and the reason they
aren't reserved is that PL/I doesn't reserve keywords. Did you
understand that sentence? One of the reasons you don't currently use
any language where those words are reserved -- or even where those words
are keywords, apparently -- is that you clearly don't use PL/I. You
also ignored a subsequent example using the PL/I keywords AREA and OFFSET.

But it was clever of you to change the subject to music rather than
addressing the issue you have been side-stepping. It has been some time
since I have heard any music played using natural tuning and I have
heard so much music written for and played using well-tempered tuning
that natural tuning sounds strange to me.

I use harmonics (which are more relevant to natural than to
well-tempered tuning) to tune my violin and guitars and have wondered
for some time whether it was the frets combined with the difference
between the two tuning methods that made it so difficult to get all of
the guitar strings to sound in tune to me at the same time.

While we're on the OT subject of different instruments, I feel compelled
to mention a keyboard instrument I saw at a university music department
once. The "black" keys were split lengthwise so each half was
independent in order to provide a way to distinguish between C# and
D-flat and make other similar distinctions. It also had a lever that
switched between that setting and one in which each of the "black" key
pairs were locked together (as in a "normal" keyboard instrument) to
provide for well-tempered tuning. Regrettably, I did not have an
opportunity to hear it played.


All true, but irrelevant to PL/I (where the context is unambiguously
clear) and, hence, does not support the claim that Ada is superior to
PL/I just because Ada reserves its keywords (or that PL/I is inferior to
all other languages because it doesn't).

As to your assertion that Ada programmers don't mind the keywords: it
must be nice to be able to speak for all of them. There must not be too
many if you know them all.

I do know of PL/I programmers who don't object to reserved words in
other languages and wouldn't object or be bothered if PL/I reserved its
keywords. I also know of PL/I programmers who would object (several in
this newsgroup, in fact). I won't pretend to speak for all of either
group nor would I claim to know the percentage split between the two
groups. I find reserved words annoying when they conflict with variable
names I think would be especially appropriate for the application area;
otherwise I generally ignore them. I also find the unnecessary
misspelling of user-defined names annoying when I have to read that code.


Please understand: I agree with some of your points. Although I like
PL/I as it is, I can see some advantages to adding real support for
extensibility and polymorphism (having used them in C++) and for some
additional support for modularity. Frankly I don't trust preprocessors
to provide functionality that ought to be provided in the language
proper. But there are a lot of application areas where those features
really aren't needed and wouldn't be missed -- in fact where their use
might get in the way of a clear and efficient solution.

And as soon as I find my router (I just moved and it's in one of the
boxes the movers helpfully labeled "miscellaneous"), I plan to hook up
my Linux box and take a closer look at the free Ada compiler that came
with that distro. But so far I haven't found any other language I like
as well as PL/I for condition handling and I haven't found any other
language except SNOBOL / SPITBOL with as clean a syntax for character-
and string-handling (although there are a few others that come close).


Bob Lidral
lidral at alum dot mit dot edu
  Reply With Quote


 


2 23rd August 07:14
glen herrmannsfeldt
External User
 
Posts: 1
Default Keywords vs. Reserved Words



(snip on reserved keywords)

I haven't looked at C99 to see how they did it. The C language doesn't
have so many reserved words, but many library names are also reserved.
It is supposed to be that all names starting with str are reserved,
leaving the possibility for future string functions.

Fortran has done a very good job of maintaining backwards compatibility,
though no reserved words helped there, too.

Also, compilers I know of aren't very good at diagnosing the improper
use of reserved words. It is even worse for the C preprocessor, where
a reserved word may be replaced with a different word that then appears
in the error message.
(snip) (snip)

My old favorite was using FORMAT for the name of a variable
format in Fortran 66, where it must be an array.

I have run into the reserved word 'this' in Java.


I thought it was equal tempered that was commonly used (2**(1./12)
between notes) and that well tempered was the one with the exact
harmonic relationship. (snip)


I read once of a system with, I believe, 53 notes/octave to allow
for more combinations of harmonics. It is pretty interesting how
well the 12 note system works. (snip)

I rarely run into problems in C, so I suppose I don't really mind
in that case. Using strlen() instead of length() avoids one, and
there are a fair number of others in C that are similar. It does
bother me when it happens, though.

I sometimes use 'this' where others might use 'foo', in quick
test programs, for example. I always have to remember not to
use this.java. (Except on windows, with a case insensitive file
system, where I can use class This in file this.java.)

I have seen code with misspelled names, even when it wasn't needed.
One I know that uses thyme for a variable containing time.

(snip)

-- glen
  Reply With Quote
3 27th August 05:39
john w. kennedy
External User
 
Posts: 1
Default Keywords vs. Reserved Words


"Exact harmonic relationships" are impossible, as no power of 2 is also
a power of 3. There are many tempering systems; "well tempered" is the
name of one subset of them. The Wikipedia article "Musical tuning" gives a brief introduction.

A fairly simple algorithm produces successively (after trivial one- and
two-note "scales") the pentatonic scale, the diatonic scale, the
chromatic scale, and a 53-note scale. The algorithm is simply to search
for powers of three that are successively closer to the nearest powers
of two.

3^5 (243) is near to 2^8 (256)--(0.94922).
3^7 (2187) is nearer to 2^11 (2048)--(1.06787).
3^12 (531441) is still nearer to 2^19 (524288)--(0.98654)
3^53 (19383245667680019896796723) is nearer yet to 2^84
(19342813113834066795298816)--(0.99791)

(A slightly different algorithm with a different definition of "closer"
also produces an intermediate 41-note scale.)

--
John W. Kennedy
"The blind rulers of Logres
Nourished the land on a fallacy of rational virtue."
-- Charles Williams. "Taliessin through Logres: Prelude"
  Reply With Quote
4 27th August 05:40
glen herrmannsfeldt
External User
 
Posts: 1
Default Keywords vs. Reserved Words


(snip on equal tempered and well tempered scales)

Google shows nine hits to "41 note scale" and 33 to "53 note scale."

It seems that both exist.

-- glen
  Reply With Quote
5 31st August 08:22
robin
External User
 
Posts: 1
Default Keywords vs. Reserved Words


I started one 5 days ago. See RESERVED WORDS.

(See also "built-in" file I/O )
  Reply With Quote
6 31st August 08:22
adaworks
External User
 
Posts: 1
Default Keywords vs. Reserved Words


I had planned to abandon these discussions, but I will comment
on the reserved word issue one more time.

In modern programming practice, reserved words are only a
problem when there are a large number of them. Why? The
reality is that most programmers now use some kind of IDE.

An IDE, when configured for a given language, highlights the elements
of a program as you go. A reserved word will show up in one
color, a string constant will show up in another, and numeric
constants can be configured to show as yet another color.

Just as keywords are governed by their context, so too are
reserved words. Consequently, when one types in a reserved
word in the wrong context the error is instantly clear.

Perhaps in the days of punched-cards and COBOL reserved
words were an issue. In today's world they are not. They do
not, as Robin suggests, "waste programmer's time." When used
with a modern IDE, they actually improve productivity.

Granted, a similar IDE can be beneficial to a language that uses
keywords instead of reserved words. I assume that PL/I
programmers also use powerful IDE's to write programs. It is
rare for anyone to depend on punched cards anymore.

As for speaking for all Ada programmers, I certainly am not. Further,
my comments about reserved words are not strictly related to Ada.
While I once was involved in the world of Ada programming, my
current responsibilities are no longer tied to Ada. When I do any
programming these days, it is often with some other language. Almost
all of the languages I use have some reserved words, and in nearly
every case, I have an intelligent IDE available to help me.

Even in a language such as Lisp (or Scheme) where reserved words
are also largely absent, the IDE highlights my errors as I go. Of
course, in those languages I am required to keep my parentheses
balanced. During the age of punched cards, before the advent of
the IDE, parentheses were are terrible nuisance. Now they are
automatically detected by the IDE, as I go.

As to your comments about loading Ada on your computer, I would
recommend you consider Eiffel. From many perspectives it is a
more interesting object-oriented language, and there is a lot to be
gained from an experience of it. Of course, you will find that it
also has reserved words. Few modern language designs are without
reserved words.

It has been suggested that language designers include reserved words
because 1) they are intellectually lazy, or 2) they are simply not smart
enough to do otherwise. Both of these assertions are patently absurd
and I would expect better from the contributors to this forum.

Languages are designed using a variety of criteria. Python, for example,
uses a model that requires every variable to be represented internally
as pointer. On the surface this seems wasteful, but it has some real
benefits in some kinds of systems. A language such as Haskell is
built over the notion of "currying" and "lazy evaluation." Once again,
these ideas seem a little silly at first, but make a lot of sense once
they are understood in the context of the language design. Modula 2
and Modula 3 are characterized by a unique approach to modularity
that would annoy a lot of programmers but many other find to be
just their "cup of tea."

But no language, when first introduced to the world of its users, is
blessed by efficient compilers (that happens later), a lack of
controversy (that persists for every one of them), nor a need
for continued revision, extension, and evolution. This includes
PL/I. How PL/I evolves will determine its future acceptance
among the programming community. If it does become a more
modern language, not in the sense of changing it, but in the
sense of extending it to correspond to the best of contemporary
computer science thought, good enough. If not, that is not
my probem. You need not target the messenger.

This is my last communication on this particular subject.

Richard
  Reply With Quote
7 31st August 08:22
tim c.
External User
 
Posts: 1
Default Keywords vs. Reserved Words


Following up to <adaworks@sbcglobal.net> :


Only if the programmer is aware of the context the reserved word is used
in.
What happens if I write a function which has the same parameters and name
as a reserved word, which can be used in the same context but which
performs a different task? Does the reserved function take precedence or
mine?
--
Tim C.
  Reply With Quote
8 4th September 12:48
shmuel (seymour j.) metz
External User
 
Posts: 1
Default Keywords vs. Reserved Words


In <45600910.7030202@comcast.net>, on 11/18/2006
at 11:34 PM, Bob Lidral <l1dralspamba1t@comcast.net> said:


He doesn't speak for this Ada programmer.


Look at Icon.

--
Shmuel (Seymour J.) Metz, SysProg and JOAT <http://patriot.net/~shmuel>

Unsolicited bulk E-mail subject to legal action. I reserve the
right to publicly post or ridicule any abusive E-mail. Reply to
domain Patriot dot net user shmuel+news to contact me. Do not
reply to spamtrap@library.lspace.org
  Reply With Quote
9 4th September 12:48
shmuel (seymour j.) metz
External User
 
Posts: 1
Default Keywords vs. Reserved Words


In <he98h.17047$B31.14374@newssvr27.news.prodigy.net> , on 11/20/2006
at 03:25 AM, <adaworks@sbcglobal.net> said:

The design of PL/I was not tied to punched cards. Punched cards were
on their way out by the time ANSI passed a PL/I standard.

--
Shmuel (Seymour J.) Metz, SysProg and JOAT <http://patriot.net/~shmuel>

Unsolicited bulk E-mail subject to legal action. I reserve the
right to publicly post or ridicule any abusive E-mail. Reply to
domain Patriot dot net user shmuel+news to contact me. Do not
reply to spamtrap@library.lspace.org
  Reply With Quote
10 4th September 12:48
glen herrmannsfeldt
External User
 
Posts: 1
Default Keywords vs. Reserved Words


I believe IBM allows LRECL=100 for PL/I (F), or maybe 104, is
I believe it likes VB input.

-- glen
  Reply With Quote
Reply


Thread Tools
Display Modes


Some other forums that might be of your interest : Development, Ada, Apple script, Assembler, Awk, Beos, Basic, C, C++, C#, C# .net, .net, .net frameworks, Asp .net, Clarion, Clipper, Clos, Clu, Cobol, Coldfusion, Delphi, Dylan, Eiffel, Forth, Fortran, Haskell, Hermes, Icon, Idl, Java, Java script, Jscript .net, Jcl, Linoleum, Lisp, Lotus, Limbo, Logo, Ml, Mumps, Oberon, Postscript, Pop, Pl1, Prolog, Python, Ruby, Pascal, Perl, Php, Rebol, Rexx, Sed, Sather, Scheme, Smalltalk, Tcl, Vhdl, Vrml, Visual basic, Visual basic .net, Yorick, Mysql, Omnis, Postgresql, Xbase, Access, Oracle, Adabas, Berkeley, Btrieve, Filemaker, Gupta, Db2, Informix, Ingres, Mssql server, Object, Olap, Paradox, Rdb, Revelation, Sybase, Theory, Dbase, Html, Java script, Css, Flash, Photoshop, Corel script, Xml, Tech, Beos, Gem, Hp48, Hpux, Linux, Mac, Ms-dos, Os2, Palm, Solaris, Ti99, Windows, Xenix, Aos, Chorus, Geos, Inferno, Lantastic, Lynx, Mach, Minix, Netware, Os9, Parix, Plan9, Psos, Qnx, Xinu, Sco, Unix, Aix, Aux, 386bsd, Bsdi, Freebsd, Netbsd, Openbsd, Ultrix, Amd, Intel, Aptiva, Buz, Deals, Homebuilt, Overclocking, Programming, Extra forums


Copyright © 2006 SmartyDevil.com - Dies Mies Jeschet Boenedoesef Douvema Enitemaus -
666