Modernize language syntax

Initially the NPL syntax was designed to be used by non-programmers. So many programming paradigms have not been taken into account. More than 30 years later, this is still the case althoug NPL is used by programmers only. The features have been extended and the syntax has been extended too. Language design errors have been made and never be corrected to be downward compatible. These errors lead to more complex and less understandable restrictions in the language. Some examples are:

  • Indexes to arrays can’t be qualified by their level 1 name (ARR(LEVEL1.INDEX)) as this syntax is reserved for referencing.
  • You can’t use expressions where you can use a variable (due to ambiguity?).
  • "Filler words" and "options" are not recognizable in some statements and can lead to misunderstandings to the reader. What is the difference between

FOR I 1 10 -1
FOR I 1 (10 -1)
FOR I = 1 TO 10 STEP -1
FOR I = 1 TO (10 -1)
  • What is a single statement and what is many statments? What is the difference between

PRINT A B C 
FUNC(<>)

PRINT A B C;
FUNC(<>)

PRINT A B C 
D=FUNC(<>)

PRINT A B C; 
D=FUNC(<>)
  • There is a bunch of kewords of normal english meaning, e.g. NAME. If you define a variable NAME on level 1, I can accept the ambiguity with the keyword. But if you define it on a higher level, the ambiguity is no longer given, as you can qualify the NAME by its level 1 name.
    This list can be extended to many, many examples.

So, to modernize the syntax, Software AG, remove all ambiguity from NPL. To be backward compatible, a new option canbe added to the source text:


OPTIONS DO-AWAY-WITH-OLD-SHIBBOLETHS

NB: Of course you can name the option as you like :wink:

If this option is set as the first statement, you can use syntax from the modernized NPL. The syntax could state:

  • Each statement is terminated by a semicolon (see ambiquity in the PRINT examples above)
  • Filler words have either to be removed or to be made mandatory (e.g. "=", "TO", "STEP" in a "FOR" statement)
  • Where you can use a variable (not receiving) you can use an (complex) expression, function, system function etc.
  • You can define a variable not only in a DEFINE DATA but everywhere you like. The scope of the variable is restricted to the context (e.g. if you define a variable in an IF … THEN, the scope is restricted to the statements in the THEN-clause)
  • all references to variables must be qualified by their level 1 name .

and much more.

@Software AG: you can name the new language NPL2050. This would manifest your current Natural 2050 agenda!

Programming languages, like communication languages, have rules; not all of which make sense.

In English we have the made up word GHOTI, which, if it were a word, could be pronounced the same as FISH.

How can “ghoti” and “fish” sound the same?

gh = f as in rouGH
o = i as in wOmen
ti = sh as in naTIon

Consider READ and BROWSE in Natural. Only in Natural are the two words READ and BROWSE synonyms.

I have always found it fun to challenge students in my Master class to explain the following

READ EMPLOYEES BY NAME FIRST-NAME CITY

Most students expect a compiler error. WRONG! Try it and then try to explain the output.

Does this mean Natural should be changed? I do not think so. When you learn a spoken language you learn its anomalies. Why are DEER and DEAR pronounced the same? If you want to be fluent in English, you learn the anomalies. The same should be true for Natural.

As I do not have the EMPLOYEES file available, I would guess it means:
READ EMPLOYEES IN LOGICAL ASCENDING SEQUENCE BY NAME STARTING FROM FIRST-NAME ENDING AT CITY
(I have chosen the most elaborate version)

Yes this is, what I mean! A language known and understood by insiders only. Your arguments are all PROs to my argumentation. Unless you want to hide your knowledge from the world. I can’t imagine, that you are such a person :wink:

Yes,indeed. It has to be changed to be understood even by people not so familiar with NPL!

(and to enable a quicker and more reliable parser in Software AG designer).

+1

OK, we are on an older Version of Natural. But my wishlist from my daily life would be:

  • Regular expressions
  • Sorting Arrays by Field
  • Arrays with keys (like “Hashtables” in other languages)
  • Expand x-Arrays by 1 giving index #idx (or even better: push/pop-logic)
  • writing Excel content (not only pure csv)
  • eliminate NAT6256 (e.g. while writing X-Array-Fields to a csv-Workfile)

In combination with ADABAS:

  • Handling more than just one Transaction/adabas-session at the same time (example: get a new Counter for PK + ET for Counter-Record without affecting other open Transactions)
  • SQL-implementation for ADABAS which can be used inside Natural
  • GET [isn] WITH HOLD

… to be continued