12 ms·
I think line noise operators and single character names are bad in any language. Haskell is among the worst offenders, but C++ isn't much better. At some point
by cousin_it 12y ago
I think line noise operators and single character names are bad in any language. Haskell is among the worst offenders, but C++ isn't much better. At some point this frustrated me so much that I started making my own language. Semantically it was pretty much a dialect of ML, a statically typed, eagerly evaluated language with mostly immutable data, but syntactically it aimed for extreme readability:
1) All keywords and standard functions have full English names, no abbreviations.
2) Keywords are UPPERCASE, types are Capitalized, values and functions are camelCase. Easy to tell the difference at a glance.
3) Mandatory type declarations everywhere. Limited type inference within expressions, but that's it.
4) Only one kind of syntactically significant parentheses, instead of () [] {} <> as in C++ or Java.
5) No two-character operators. Instead of x != y you have to write NOT (x = y). Sorry!
6) Significant whitespace.
The code looked something like this:
GENERIC(Type) FUNCTION identity(value: Type): Type
RETURN value
I have a lot of code written in that dialect, just for my own amusement. It's pretty verbose and boring, but extremely easy to write, impossible to misunderstand, and sticks to memory like nothing else I've ever tried. I still want to finish an implementation someday.
- tormeh 12y agoThat sounds awesome. Keep it up!
- mamcx 12y agoThat is a bit close to pascal. I have think in something similar, but extend the idea: #Naming conventions. ENFORCED BY THE COMPILER by default #For type/class/interface Str #Title-case mean public _Str #private ___Str #protected #For functions, properties isPublic #Camel-Case mean public. _isPrivate #private ___isProtected #protected PI = 3.1416 #All CAPS means CONSTANT I wonder how do mutable vs. inmutable. I have think in: thisIsInmutable thisIsMutable* Because if is only a declaration point (using for example let vs var) but not the rest of the use of the name, you lost the ability to know if the thing mutate or not. The other idea is doing this only for functions: fun List.Add(self*, values:Array) Or like in other languages fun List.Add!(values:Array) The other idea (derived from the fact the Lexer/AST give far more info than the text) is color-mark the vars and differentiate by color and/or font style between mut/inmutable, functions, types, vars, etc
- klibertp 12y agoIt's probably not very relevant, but I think you could get some inspiration from Avail http://www.availlang.org/ http://www.availlang.org/ and maybe REBOL or Red www.red-lang.org Either way, good luck and keep working on it, something like this is needed IMHO (also, Go is quite nice on that front, of course) :)