If you created your own programming language ..

Jim Brown

Active Member
Licensed User
Longtime User
.. what would its key features/syntax be?

Perhaps I'm getting older and finding programming languages more alien-looking than ever but it got me thinking, If I could create my own programming language what would its key features and syntax look like.

First things first, I hate typing. So the language would require absolute minimalistic coding.
I would incorporate as many short-cut programming methods as possible.
Next, I'd take a heavy pinch of Pythons tabbed spacing which defines code blocks.
Finally, reduce the need as much as possible of having to type shifted characters like " {} &

Putting it all together then, instead of having to type something very ugly and messy (C++ example):
Code: Copy
for (i=0,i<5,i++){
   DoStuff("hello world");
}
My minimalistic code would shrink the above down to:
Code: Copy
5 times
   DoStuff 'hello world'

In cases where you need to know the loop count ..
Before:
Code: Copy
for (i=0,i<5,i++){
   printf("hello world" + i);
}
After:
Code: Copy
5 times i
   ? 'hello world'+i     ' ? is shortcut for print (C64 days!)

My philosophy is, less is more.
 
I really "hate" that C/C++ thing, the notation with "{" in the same line as the condition and ";" to terminate. We had a thread about that earlier.

My opinion: As every language it should be easy to learn/use (like English, not German). One word more or less doesn't really count.

Maybe:

Code: Copy
I=0
Loop 5 Times
   Add 1 to I
   Print I
Loop End
 
There is certainly a fine between making something 'understandable' and too wordy.
I have seen languages which put too much emphasis on using English language. The problem then is you end up not knowing what order to write the keywords.
Or, forgetting what the keywords are? Was it 'units' or 'pixels'. All of a sudden you are writing an essay rather than coding.
Code: Copy
make red ball
move ball 10 units right

Oh, and taking your code example above I would make it even simpler. Again, for me, less is more:
Code: Copy
5 times
   I+1
   Print I
 
I think you should take a look at the loop construct in Rexx, I think you'll like it.

Infinite loop
Do forever
...
End

Five iterations
Do 5
...
End

Until something happens. Also works with While.
Do Until Condition
...
End

With counter variable, no break criteria
Do x = 5
...
End

Ordinary for
Do x = 5 to 10
...
End

With step size
Do x = 5 by 2
...
End

Combine it all, anyway you want
Do x= 2 to 10 by 2 Until Done
...
End

Rexx also combines arrays and structures in what's called compound variables. Example:

X="Week"
X.Days.1="Monday"
X.Days.2="Tuesday"
X.Weather="Sunny"

Note that, as Rexx is not a declarative language, this structure does not have to be pre-declared. This is both good and bad.

It also have the best syntax rule ever: If the first line of a program is not a comment, it's considered a syntax error and it won't run.

I really love the cleanness of Rexx, and would love a modern, object oriented Rexx as the base for a modern RAD IDE.
 
Back
Top