A tiny language called Z (2013)
chrisdone.com
chrisdone.com
But on the down side, now macros have to do string formatting (like adding indents and newlines) to produce output that is legible code, for example the "when" macro:
defmacro when input
fn blocks
ap "if"
++ z:indent-before 3
car blocks
++ "\n"
++ z:indent 3
car cdr blocks
++ "\n"
z:indent 3
"unit"
z:blocks input
That's one place where all languages that replace s-expressions with indentation seem to stumble equally: nested parens may look funny, but metaprogramming in lisps is delightfully easy because everything is a list and whitespace doesn't matter, so it's easy to produce and consume at compile time.I is still free :-)
https://christine.website/blog/h-language-2019-06-30
Those are just the first three, but they seem like they're all taken.
defun take n xs
if = n
0
unit
if unit? xs
unit
cons car xs
take - n
1
cdr xs
Here's exactly the same thing using sweet-expressions (which I led the development of): defun take n xs
if {n = 0}
unit
if unit?(xs)
unit
cons car(xs)
take {n - 1}
cdr xs
Even in this trivial example we see a 20% reduction in line use. We can trivially do a lot more, e.g., the last 3 lines could become one line for a 40% reduction in number of lines: cons car(xs) take({n - 1} cdr(xs))
Number of lines matters. Modern screens are typically quite wide but lack height, so a notation that requires the use of lots more lines for simple functionality means you can see far less information at one time (increasing change and debug time). Z-expressions also lack any kind of infix notation, which is a serious problem. Most software developers will not use a language without a built-in infix notation, for the same reason they won't use a line-oriented text editor... there are better alternatives available.I think it's also especially easy to get things wrong. For example:
take - n
1
cdr xs
Is completely different from: take - n
1
cdr xs
Indentation-sensitive notations where the amount of increased indentation causes different interpretations can make it very easy to insert unintentional and hard-to-detect bugs.Anyway, my opinion, but hopefully I've provided some reasonable rationale for my opinion. I don't object to indentation-based syntax (obviously), but unsurprisingly I think there are better alternatives for this use case :-).
I should also mention that naming a project with a single letter guarantees that no search engine will easily find it. It took me forever to find a link to Z, and I knew what I was looking for...
(For those who never heard about Z: https://en.m.wikipedia.org/wiki/Z_notation)
({1},(∅ o α)) ∈ I̸=I ∧ ((∅ o α),{2,3}) ∈ I⊆I {M : Model; t : W | t ∈ [ e ]E M ∧(∀t :[e ]EM•[e ]]E (M⊕t)=[[e ]]E (M⊕t)) •M→[e]E (M⊕t)} ⊆ [[μe•e]]E
It's not always obvious to decipher what it does, either.
That said, here are two general pointers to get an idea:
1. Z uses sets, functions, and integers as its basic "type", on top of which you write more complicated "types". Therefore, in Z you often write specifications of the type "I have this element that belongs to this set, a function that maps elements of this 'type' to other types, and this operation says that my element is inserted into this mapping function" (without you writing down how the insertion is computed). Note that I write "type" in quotes because Z is not a programming language, and my use of the word type is a bit careless.
2. The comment is being a bit cheeky, since Z has comments, function names, and whitespace for better understanding that the comment is not using. The comment is right that the syntax can get complex at times, though, but calling your varibles "t" and "M" doesn't help.
Random fact: the Wikipedia example is a bit clearer, but written in Spanish. It details how to write a toy birthday agenda. It turns out that it was uploaded by a guy I personally know, which should give you an idea of the size of the Z community...
For what it’s worth, this was posted verbatim from the spec :-D
Most programming languages have very simple rules like "tokens end at incompatible characters or at whitespace" or "statements ends at the end of the line or at a semicolon"; there's probably an opportunity to spend some complexity on low-level syntax to reap benefits like macros without boring text and token manipulation.
Concatenative languages such as (or derived from) Forth also use a very low number of delimiters, since they can usually be replaced by stack manipulation words.
I am not sure this is what you were asking, but if you do not know APL and/or Forth, I recommend you to have a look. It's a funny rabbit hole in which to get lost.
But while I also don't like the appearance of significant indentation, if it was just a presentation choice of an underlying more robust representation, I'd be fine with that.
So I sort-of agree - it seems like something that could be a neat editor plugin etc. on top of a s-expression based language and would be better for it than as the only/default syntax.
name argument
This was the explicit design of Smalltalk. (Also of the non-C parts of Objective-C.) Subject verb. nameReference keyword: arg1 withArgs: arg2
The nameReference is the subject. The keyword:withArgs: is the verb.Using templates and selective evaluation is simple and better.