Re: (rant) Three kinds of languages
- Posted by _tom (admin) Oct 26, 2017
- 1669 views
Bugs occur in software; we learn to be tolerant. Deliberate language design surprises do not deserve tolerance.
Surprise!
Two kinds of surprise:
- oopsie surprise...this is a bug
- design surprise...the language is wierd
oopsie surprise
The OE switch may crash under the interpreter but work correctly when compiled. This is a bug that must still be resolved. Most of the time switch works correctly.
This surprise is unintentional.
-- works in OE; used to crash Phix (now fixed) sequence s = {} for i=1 to length(s) do ? s[i] exit end for -- probably what most coders would have written if length(s) then ? s[1] end if
The oopsie surprise is small, rare, and fixed.
design surprise
-- example one def greet(): print( "hello" ) x=1 if x==1: print( "it is one" )
This syntax is based on indentation. If you leave the colon : out you get an "invalid syntax" message; not very helpful. Why is a colon : needed? The colon is a superfluous syntax element. Not simple; not beginner friendly.
This surprise is deliberate.
-- example two function greet() puts(1, "hello" ) end function
This syntax uses keywords in the same way for all language elements. Simple.
-- example three function greet() puts(1, "hello" ) end function
Since the keywords make the syntax work you can write code in any way. Still simple.
_tom