YAPL - Yet Another Programming Language

A

Adem24

The World Joint Programming Language Standardization Committe (WJPLSC)
hereby proclaims to the people of the world that a new programming language
is needed for the benefit of the whole mankind in the 21st millenium.
This new language not only differs from existing ones by new features
and paradigms but which also brings real advantage by rigourously
preventing bad programmer habits by omitting features which are outdated.
In the proposed new joint language for the world (codename YAPL)
several concepts in use by currently used bad languages have been eliminated.
All UN member countries and organizations are urged to adapt these
recommendations which are for the benefit and safety of the planet and the mankind:

1) There is no goto statement.
Hidden goto's like break- and continue-statements are also omitted.

2) There is no return statement.
Instead a result variable can be declared to which the result of a function can be assigned.

3) There are no automatic type conversions.
When a subprogram should be used for different types it must be overloaded.

4) There are no variable length parameter lists.
Instead it is possible to use arrays as parameters.

5) There are no default parameters.
But it is easy to define two subprograms: One with and one without an additional parameter.

6) There is no special "parameter" called "self" or "this".
In a procedure the receiving object is declared as formal parameter with a user-defined name.

7) There is no macro feature since this mechanism is too similar to the subprogram feature.
Instead subprograms can be used in a more flexible way than in other languages.

8) There are no reserved words.

9) There is no conceptual distinction between functions, operators, procedures and statements.

10) The procedure calling mechanism is not based on a concept with an object-message pair
(An object receives a message). Instead a match is done over a list of objects.
This more general (and powerful) mechanism is called multimatch and it includes
the simple object-message mechanism as special case.


cu l8er
Jesus DeCoder



..
 
C

CBFalconer

Adem24 said:
The World Joint Programming Language Standardization Committe (WJPLSC)
hereby proclaims to the people of the world that a new programming language
is needed for the benefit of the whole mankind in the 21st millenium.
.... snip ...

This appears to have little to do with the C language, and is thus
off-topic.
 
K

Keith Thompson

Adem24 said:
The World Joint Programming Language Standardization Committe (WJPLSC)

I see no evidence outside this article that such an organization exists.
hereby proclaims to the people of the world that a new programming language
is needed for the benefit of the whole mankind in the 21st millenium.

Then you've got nearly 18,000 years to work on it. Given the number
of attempts there have been to create a new universal programming
language that will Change Everything, that might be almost enough.

[...]

Followups to comp.programming (though comp.lang.misc might have been
an appropriate place to post this -- unlike any of the other
comp.lang.* groups to which it was cross-posted).
 
T

thomas.mertes

The World Joint Programming Language Standardization Committe (WJPLSC)
hereby proclaims to the people of the world that a new programming language
is needed for the benefit of the whole mankind in the 21st millenium.
Mr. Adem24 (I have no relationship to him) seems to make a
joke at my cost. His 10 points are a list of features of Seed7
mentioned in the manual. See the second list in chapter 1.3:
http://seed7.sourceforge.net/manual/intro.htm
Besides sounding funny I have no idea what the intentions of
Mr Adem24 are. Please accept my apology for sending this
answer to so much groups. I have humor myself, but I will not
uncover my plans to reach world domination with Seed7. :)

Greetings Thomas Mertes

Seed7 Homepage: http://seed7.sourceforge.net
Seed7 - The extensible programming language: User defined statements
and operators, abstract data types, templates without special
syntax, OO with interfaces and multiple dispatch, statically typed,
interpreted or compiled, portable, runs under linux/unix/windows.
 
T

thomas.mertes

I see no evidence outside this article that such an organization exists.


Then you've got nearly 18,000 years to work on it.

The 18,000 years are over now, because an implementation
of such a language already exists (see my direct answer to
Mr. Adem24). Such effects in time distortion can be explained
by relativity...

Greetings Thomas Mertes

Seed7 Homepage: http://seed7.sourceforge.net
Seed7 - The extensible programming language: User defined statements
and operators, abstract data types, templates without special
syntax, OO with interfaces and multiple dispatch, statically typed,
interpreted or compiled, portable, runs under linux/unix/windows.
 
M

Matthias Buelow

Malcolm said:
Replace "array" with "list" and you've got Lisp.

Lisp has goto! :) (GO, and friends like RETURN-FROM etc...)

If a designer of a general purpose language thinks goto is unnecessary
(or even "evil"), he should go back to the desk and think a couple years
more.
 
J

James Kanze

The World Joint Programming Language Standardization Committe
(WJPLSC) hereby proclaims to the people of the world that a
new programming language is needed for the benefit of the
whole mankind in the 21st millenium. This new language not
only differs from existing ones by new features and paradigms
but which also brings real advantage by rigourously preventing
bad programmer habits by omitting features which are outdated.
In the proposed new joint language for the world (codename
YAPL) several concepts in use by currently used bad languages
have been eliminated. All UN member countries and
organizations are urged to adapt these recommendations which
are for the benefit and safety of the planet and the mankind:

Apparently, this message got held up for some 90 days somewhere.
 
W

Wolfgang Draxinger

Adem24 said:
1) There is no goto statement.
Hidden goto's like break- and continue-statements are also
omitted.

There are cases, they are scarce but they exist, where goto is
nothing else but really usefull, and makes the simplemost kind
of code. Examples:

Say you got a series of dependent structures, that must be
allocated in a certain order and deallocated in opposite order.
With goto you can:

void foo()
{
Bar bar;
Baz baz;
Bla bla;

int failure = 1;

bar = bar_create();
if(!bar)
goto bar_create_failed;

baz = baz_create(bar);
if(!baz)
goto baz_create_failed;

bla = bla_create(baz);
if(!bla)
goto bla_create_failed;

failure = 0;

/* do some stuff */


bla_destroy(bla);
bla_create_failed:
baz_destroy(baz);
baz_create_failed:
bar_destroy(bar);
bar_create_failed:

if(failure){
/* deal with failure */
}
}

Challenge: Do this with only if, while and for in a more readable
fashion.

Another exercise: Exit from a stack of neested loops to the
outermost structure, or some loop levels above, and perform some
post handling.

for(...){
for(...){
for(...){
if(...)
goto break_loop_3_to_0;

if(...)
goto break_loop_3_to_1;
}
if(...)
goto break_loop_2_to_0;
}
break_loop_3_to_1:
}
goto normal_finish;
{
break_loop_3_to_0;
/* ... */;
goto normal_finish;

}
normal_finish:

Of course I know that Djkstra will now hate me, too (and not only
some guy called Linus T.).
2) There is no return statement.
Instead a result variable can be declared to which the
result of a function can be assigned.

Helps you in how far? Makes lambda expressions a PITA.
3) There are no automatic type conversions.
When a subprogram should be used for different types it
must be overloaded.

If a type can be converted without possible loss of data, why not
make it implicit. Compilers (should) raise a warning otherwise,
anyway.
4) There are no variable length parameter lists.
Instead it is possible to use arrays as parameters.

See the D programming language. D even has a feature, that
variable parameter lists are implicitly converted into an array.
6) There is no special "parameter" called "self" or "this".
In a procedure the receiving object is declared as formal
parameter with a user-defined name.

In OOP aimed languages such parameters are implicitly created,
but a fixed name is a must, otherwise code is hard to read.
7) There is no macro feature since this mechanism is too
similar to the subprogram feature.
Instead subprograms can be used in a more flexible way than
in other languages.

Sounds like templates and mixins in the D programming language
8) There are no reserved words.

Err, how do you want to code then? Ther muse be a few reserved
words the lexer can recognize. How do you want to reference
preimitive typed then?
9) There is no conceptual distinction between functions,
operators, procedures and statements.

See the D programming language. Operators are actually calls to
functions named op_add, op_mul, op_cmp and so on.
10) The procedure calling mechanism is not based on a concept
with an object-message pair
(An object receives a message). Instead a match is done
over a list of objects. This more general (and powerful)
mechanism is called multimatch and it includes the simple
object-message mechanism as special case.

Bug prone and non deterministic. Can make hell break loose (think
about circular calls...)

I designed a language addressing all those aspects to speed up
development of my game engine system. This language also has a
own mechanism for non-goto loop breaking and post error
cleanups, that I presented with the goto dance above. However
even this language still has goto. You never know, when you may
make good use of it.

Wolfgang Draxinger
 
C

Chris Dollin

Matthias said:
Lisp has goto! :) (GO, and friends like RETURN-FROM etc...)

If a designer of a general purpose language thinks goto is unnecessary
(or even "evil"), he should go back to the desk and think a couple years
more.

Oh, yeah?

My pop11-inspired Pepper programming language is a "general purpose"
imperative programming language that has no goto. It's gotolessness
doesn't stop the Pepper compiler from being written in Pepper.

Most of the "I'd like a goto here" seems to stem from needing
n-and-a-half-times loops (which Pepper has) and poor man's tail
recursion (ditto). No "break", no "continue", no "goto".

What is missing is some kind of exception-handling ...
 
T

thomas.mertes

Lisp has goto! :) (GO, and friends like RETURN-FROM etc...)

If a designer of a general purpose language thinks goto is unnecessary
(or even "evil"), he should go back to the desk and think a couple years
more.
What about Java?
In Java goto is a reserved word but does not presently serve
any function.

I can assure you that writing unmaintainable spaghetti
code is also possible without GOTO statements. :)

Greetings Thomas Mertes

Seed7 Homepage: http://seed7.sourceforge.net
Seed7 - The extensible programming language: User defined statements
and operators, abstract data types, templates without special
syntax, OO with interfaces and multiple dispatch, statically typed,
interpreted or compiled, portable, runs under linux/unix/windows.
 
J

Juha Nieminen

Adem24 said:
1) There is no goto statement.
Hidden goto's like break- and continue-statements are also omitted.

2) There is no return statement.
Instead a result variable can be declared to which the result of a function can be assigned.

Is the goal of this language to make the life of programmers as hard
as possible? Something like this becomes difficult to implement:

// Find the first value in 'data' which meets the requirements imposed
// by the parameter:
Type1 foo(Type2 value)
{
for(size_t i = 0; i < data.size(); ++i)
for(size_t j = 0; j < data.size(); ++j)
for(size_t k = 0; k < data[j].size(); ++k)
if(meetsRequirements(data[j][k], value)
return data[j][k];
}
 
T

thomas.mertes

Adem24 said:
1) There is no goto statement.
Hidden goto's like break- and continue-statements are also omitted.
2) There is no return statement.
Instead a result variable can be declared to which the result of a function can be assigned.

Is the goal of this language to make the life of programmers as hard
as possible? Something like this becomes difficult to implement:

// Find the first value in 'data' which meets the requirements imposed
// by the parameter:
Type1 foo(Type2 value)
{
for(size_t i = 0; i < data.size(); ++i)
for(size_t j = 0; j < data.size(); ++j)
for(size_t k = 0; k < data[j].size(); ++k)
if(meetsRequirements(data[j][k], value)
return data[j][k];

}

Your function returns garbage when nothing meets the requirements.
Your solution may be elegant, but it is wrong (I know that it can
be fixed easily). Some people would even argue that with structured
programming such bugs would not happen.
Besides that, I got your point.

Before going to the details let me explain the advantage when every
statement has exactly one entry and one exit (this is a side effect
of structured programming without any form of goto's):

If you want to add code that should be executed when the function
is left (e.g. some trace statement) you can just add it at the end
of the function. The only reason that your trace code is skipped is
when an exception is raised and no exception handler inside the
function catches it. If there are no exceptions you know that the
flow of control is always stuctured. If you jump around in your
code with gotos and returns you don't have this guarantee.

A stuctured solution to your example could use a boolean flag which
is changed when the data is found. It can be argued that this is
slower but todays compiler optimisations should not be
unerestimated. A C version of this structured function would be:

// Find the first value in 'data' which meets the requirements
// imposed by the parameter:
Type1 foo (Type2 value)
{
int search = 1;
Type1 result = Type1default;

for (size_t i = 0; i < data.size() & search; ++i) {
for (size_t j = 0; j < data.size() & search; ++j) {
for (size_t k = 0; k < data[j].size() & search; ++k) {
if (meetsRequirements(data[j][k], value) {
result = data[j][k];
search = 0;
}
}
}
}
return result;
}

As you can see, I prefer to use curly braces even when they are not
necessary. This use of curly braces allowes that statements
belonging to 'while', 'do', 'for' and 'if' statements can always be
added or removed without unintentionally changing the logic. The
use of a result variable makes clear which function holds the
result of the function. Since C needs a return statement I just put
it in front of the closing curly brace. IMHO a good compiler can
produce code which is as fast as your version.

In a language which has no C for loops like Seed7 the function
would look as follows:

const func Type1: foo (in Type2: aValue) is func
result
var Type1: result is Type1.value;
local
var integer: i is 1;
var integer: j is 1;
var integer: k is 1;
var boolean: search is TRUE;
begin
while i <= maxIdx(data) and search do
while j <= maxIdx(data) and search do
while k < maxIdx(data[j]) and search do
if meetsRequirements(data[j][k], aValue) then
result := data[j][k];
search := FALSE;
end if;
incr(k);
end while;
incr(j);
end while;
incr(i);
end while;
end func;

I know that this solution is not as elegant.
Maybe I should introduce an advanced version of the 'for' statement
like:

for i range minIdx(data) range maxIdx(data) andWhile search do

What do you think?

Greetings Thomas Mertes

Seed7 Homepage: http://seed7.sourceforge.net
Seed7 - The extensible programming language: User defined statements
and operators, abstract data types, templates without special
syntax, OO with interfaces and multiple dispatch, statically typed,
interpreted or compiled, portable, runs under linux/unix/windows.
 
R

Roberto Waltman

... a new programming language is needed ...
...
8) There are no reserved words.
Wonderful! What the world needs is one more language that allows you
to write:

"IF IF THEN THEN ELSE IF ELSE THEN IF ELSE IF END THEN BEGIN ELSE IF;"

or something like that...
 
C

contestcen

The World Joint Programming Language Standardization Committe (WJPLSC)
hereby proclaims to the people of the world that a new programming language
is needed for the benefit of the whole mankind in the 21st millenium.
This new language not only differs from existing ones by new features
and paradigms but which also brings real advantage by rigourously
preventing bad programmer habits by omitting features which are outdated.
In the proposed new joint language for the world (codename YAPL)
several concepts in use by currently used bad languages have been eliminated.
All UN member countries and organizations are urged to adapt these
recommendations which are for the benefit and safety of the planet and the mankind:

�1) There is no goto statement.
� � Hidden goto's like break- and continue-statements are also omitted.

�2) There is no return statement.
� � Instead a result variable can be declared to which the result of a function can be assigned.

�3) There are no automatic type conversions.
� � When a subprogram should be used for different types it must be overloaded.

�4) There are no variable length parameter lists.
� � Instead it is possible to use arrays as parameters.

�5) There are no default parameters.
� � But it is easy to define two subprograms: One with and one without an additional parameter.

�6) There is no special "parameter" called "self" or "this".
� � In a procedure the receiving object is declared as formal parameter with a user-defined name.

�7) There is no macro feature since this mechanism is too similar to the subprogram feature.
� � Instead subprograms can be used in a more flexible way than in other languages.

�8) There are no reserved words.

�9) There is no conceptual distinction between functions, operators, procedures and statements.

10) The procedure calling mechanism is not based on a concept with an object-message pair
� � (An object receives a message). Instead a match is done over a list of objects.
� � This more general (and powerful) mechanism is called multimatch and it includes
� � the simple object-message mechanism as special case.

cu l8er
Jesus DeCoder

.

Item 1 states that hidden Goto's are omitted. To the list which is
given (Continue and Break) the proposer should add For, While, Repeat,
If-Then-Else as well as procedure and function calls.
 
S

s0suk3

"Adem24" <[email protected]> ha scritto nel messaggio




I would take "if() goto" and "goto" and would loose if(), while(), for(), do
while(),
etc

For me the base language has to have these points
1) No UB so people instead of speak of UB, they program
2) So it should be easy to master and to program so that whatherver
someone write something, there is not much of say about "grammar"
3) If there is some error in writing something it stop to run
4) it is easy to read and to write
5) it should have only few instruction, no if-loop controls only
conditionals jumps and gotos

so it should be some subset of some cpu assembly

All those things are exactly what most modern programming languages
try to omit/discourage (except point 4). I'm not surprised what you
say in point 2 about not being there much to say about grammar, since
4 of your 5 points have grammatical errors. :)
 
T

thomas.mertes

There are cases, they are scarce but they exist, where goto is
nothing else but really usefull, ...
Others have already answered to this. Just one point:
In Java goto is a reserved word but does not presently serve any
function.
Helps you in how far? Makes lambda expressions a PITA.
Why should that make any problems with lambda expressions?
Seed7 (the list is an almost exact copy from the Seed7 manual) uses
result variables which represent the function result when the
function is left. The user can define the name of the result
variable and it can be used like a normal variable. This is similar
to Pascal where the function name is used as result variable. The
difference is that in Pascal normal usages of the function name
(which are not at the left side of an := ) are interpreted as
recursive calls and not as usages of the result variable. In the
following function definition a result variable is used:

const func string: gets (inout string: stri,
in integer: leng) is func
result
var string: result is "";
begin
result := stri[.. leng];
stri := stri[succ(leng) ..];
end func;

As you can see the name of the result variable is 'result'. Although
'result' is also used as keyword in the function declaration this
does not imply that all keywords can be used as variable names. The
keyword 'result' is used in the middle of a syntactic construct (it
just follows the keyword 'func'). As such it does not introduce
something. Therefore the keyword 'result' can be used as variable
name. Most other keywords like 'if', 'while', 'for' , etc. introduce
a statement (or some other construct) and therefore it cannot be
used as variable name.
If a type can be converted without possible loss of data, why not
make it implicit. Compilers (should) raise a warning otherwise,
anyway.
The avoidance of implicit conversions gives us something:

For every expression (and sub expression) you know its type at
compile time without knowing where this expression is used.

This principle improves the readability of code.
I am discussing this also in the FAQ, see:
http://seed7.sourceforge.net/faq.htm#automatic_casts
See the D programming language. D even has a feature, that
variable parameter lists are implicitly converted into an array.
As I said already I am not a fan of implicit conversions.
In OOP aimed languages such parameters are implicitly created,
but a fixed name is a must, otherwise code is hard to read.
I see no reason why code is hard to read when a user supplied name
can be used. Non-OO languages had user defined parameter names for
ages. If you want you can use 'this' as user defined parameter name.
BTW: How do you name your 'this' variables when you use multiple
dispatch? Don't say 'this1', 'this2', ...

What multiple dispatch is, is explained here:
http://seed7.sourceforge.net/faq.htm#multiple_dispatch
Sounds like templates and mixins in the D programming language
Seed7 supports templates, but instead of special template constructs
normal functions are used. Seed7 functions can use types as
parameters and/or a type as function result. Such template functions
are executed at compile time and may declare things like functions.
In this function declarations the type parameters can be used.
That way no special template syntax with angle brackets or similar
constructs is necessary.
Err, how do you want to code then? Ther muse be a few reserved
words the lexer can recognize. How do you want to reference
preimitive typed then?
There are keywords which are used at various places. Some keywords
introduce statements or other constructs (such as declarations).
E.g.: The keywords 'if', 'while', 'repeat', 'for', and some others
introduce statements. Other keywords like 'do', 'range', 'result,
etc. are used in the middle of statements (or other constructs).

Seed7 uses syntax declarations to specify the syntax of statements.
I use the word 'keyword' when a name is used somewhere in a syntax
declaration. Syntax declarations reduce the possibilitys to use
a keyword out of context. E.g: After the keyword 'if' the lexer
expects always an expression. This makes 'if' unusable as variable
name. This way you get error messages when you try to use 'if' as
variable name. That behaviour is just the same as in other languages
which have reserved words.
See the D programming language. Operators are actually calls to
functions named op_add, op_mul, op_cmp and so on.
Connecting operators and functions with a mapping like + --> op_add
is one possibility. In Seed7 new operators can be invented, but
there is no user visible mapping to a function name.
Bug prone and non deterministic. Can make hell break loose (think
about circular calls...)
I see no reason why this should be the case. The technic to connect
a method to more than one type is called multiple dispatch. I wrote
an explanation of multiple dispatch here:
http://seed7.sourceforge.net/faq.htm#multiple_dispatch

If there are questions, just ask.
I am happy with every feedback.

Greetings Thomas Mertes

Seed7 Homepage: http://seed7.sourceforge.net
Seed7 - The extensible programming language: User defined statements
and operators, abstract data types, templates without special
syntax, OO with interfaces and multiple dispatch, statically typed,
interpreted or compiled, portable, runs under linux/unix/windows.
 
T

thomas.mertes

Wonderful! What the world needs is one more language that allows you
to write:

"IF IF THEN THEN ELSE IF ELSE THEN IF ELSE IF END THEN BEGIN ELSE IF;"

or something like that...
Sorry, but Seed7 (the list is an almost exact copy from the Seed7
manual) does not support this. The keyword 'if' is not reserved in
the classic sense, but the syntax defined for 'if' requests that an
expression follows it. Since variables are not written this way, it
is not possible to define a variable named 'if'.

It can be subsumed that Seed7 reaches the goal of avoiding the
misuse of keywords in other ways and not by reserving them
altogether.

If you look at classic compilers (e.g. a Pascal compiler) there is a
distinction between reserved words and identifiers. Pascal compilers
and probably also Ada, C/C++, Java and C# compilers use an
enumeration type to represent the reserved words.

Since Seed7 allows user defined statements (which may introduce new
keywords) it is not possible to hardcode reserved words in the
compiler as it is done in Pascal, Ada, C/C++, Java and many other
compilers.

Greetings Thomas Mertes

Seed7 Homepage: http://seed7.sourceforge.net
Seed7 - The extensible programming language: User defined statements
and operators, abstract data types, templates without special
syntax, OO with interfaces and multiple dispatch, statically typed,
interpreted or compiled, portable, runs under linux/unix/windows.
 
T

thomas.mertes

(e-mail address removed) said:


BETTIE does.
I am sure that the world needs another esotheric programming
language. :)
Since BETTIE does support it and Seed7 doesn't, we must conclude that
BETTIE is the more powerful language (bless her).
You obviously don't understand the Force ...

Look at the Seed7 homepage, it will introduce you to the Force.

Greetings Thomas Mertes

Seed7 Homepage: http://seed7.sourceforge.net
Seed7 - The extensible programming language: User defined statements
and operators, abstract data types, templates without special
syntax, OO with interfaces and multiple dispatch, statically typed,
interpreted or compiled, portable, runs under linux/unix/windows.
 
T

thomas.mertes

(e-mail address removed) said:



That's correct. In fact, you are now the second person to say so - and as
the Bellman nearly said, "What comp.lang.c tells you three times is true."
So all I need do is say:

The world is in desperate need of another Turing-complete but stupid
programming language!
There are never enough programming languages. :) I got your irony,
but I would like to discuss the reserved word vs. keyword issue (and
other issues).

As I said already elsthread, the misuse of keywords is prohibited in
Seed7. Just because the compilers of most programming languages use
a table of hardcoded reserved words does not imply that this is the
only solution.

I know that new concepts start in a hostile world, but objective
professional feedback is the preferred reaction to them.

I hope that the new ways that I take in some areas do not discourage
you to think about them. I would be glad if you answer with a
professional view towards my ideas. Besids the points mentioned by
the OP the FAQ (see: http://seed7.sourceforge.net/faq.htm ) is a
good starting point for a professional response.

Greetings Thomas Mertes

Seed7 Homepage: http://seed7.sourceforge.net
Seed7 - The extensible programming language: User defined statements
and operators, abstract data types, templates without special
syntax, OO with interfaces and multiple dispatch, statically typed,
interpreted or compiled, portable, runs under linux/unix/windows.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,780
Messages
2,569,607
Members
45,241
Latest member
Lisa1997

Latest Threads

Top