I have been wrestling with the notion of "command statements" in MiniScript since the very beginning. In particular, I wanted to be able to invoke a function as a statement by itself, without using parentheses around the arguments.
I really want to be able to print 42 instead of print(42).
This would be very much in keeping with MiniScript's "syntax-light" style. We already don't require or recommend empty parens when invoking a function.
But, it causes some thorny problems for the parser, especially figuring out what to do with square brackets. This is because they can be used both for a list literal (which is an expression) and to look things up in a list or map (which is part of an expression).
So back in 2015, I gave up on it. Threw in the towel. Concluded that I just couldn't have it all. And as a result, we're all typing things like print("Hello world!"), even though print "Hello world!" is so natural that I've done it by mistake on a number of occasions.
This has been bugging me more and more lately, especially in environments like Mini Micro, where MiniScript is also the shell environment. When it's time to load a program, you really want to say load "demo" rather than load("demo"). Getting help should be just help "topic". And so on.
So. After many deep and profound brain-things in my head...
I found a solution. :smiley:
> print 42
42
> print [1]
[1]
> print [1,2,3]
[1, 2, 3]
> x = [1,2,3]
> x
[1, 2, 3]
> x[1]
2
> print(42)
42
> print "Holy cows! It works!!!"
Holy cows! It works!!!
This is a major breakthrough. Having to use parentheses on command statements was the last bit of unobvious, klunky syntax; the last design compromise I grudgingly made. Removing it makes MiniScript the clean, elegant, pleasant-to-use language it was always meant to be.
This change will appear in the next official MiniScript update (coming within a few weeks).