You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Inspired by YAML sequences (which use -) and Markdown lists (which allow -, +, or *), I propose supporting indented implicit lists with some kind of bullet operator:
For Unicode bullets (•), this seems like a no-brainer. The question is what ASCII form(s) it should also have.
. looks a lot like a bullet and isn't currently meaningful when followed by a space. I think this is the current winner.
~ looks something like a dash and isn't currently meaningful when followed by a space, though we've occasionally discussed it being used for typing (as it was in my typed CoffeeScript branch).
-, +, * would be great from a compatibility/familiarity perspective. In particular, I dream of a big YAML subset as being a subset of Civet, in the same way that JSON is a subset of JavaScript. We could also plausibly support them in certain contexts, like right after an assignment as in the example above. But in general we should probably give precedence to these acting like regular binary operators. For example:
test-item1-item2
This should probably remain a subtraction, not an implicit function call test([item1, item2]). But I think this is mainly an issue when trying to do indented implicit function calls, which is a bit of an edge case (though admittedly a useful one; implicit objects are used this way all the time). When we're at the "beginning" of an expression, I think we could safely use -, +, *.
> is maybe another related option, inspired by the recent JSX ideas, but it has the same limitations as -/+/*.
-- is a reasonable option inspired by en-dash (this is how you type it in LaTeX). ++ doesn't make as much sense, and ** already means exponentiation (and >> already means shift-right). The main issue with doubled operators like this is that they look ugly with 2-spaces indentation:
x :=--name: 'hello'
value: 'world'
Context
Civet (and CoffeeScript) currently lack an implicit array mechanism, unlike objects.
They also have an awkward way to write lists of implicit objects — the dedented comma — which this could be a nicer alternative to.
in the same way that JSON is a subset of JavaScript.
Minor correction: this isn't quite true, because LS and PS are treated as line breaks by JavaScript (or at least were before 2019), but are allowed unescaped in JSON strings. JSON5 notes that this is their only incompatibility with ES5.
Inspired by YAML sequences (which use
-
) and Markdown lists (which allow-
,+
, or*
), I propose supporting indented implicit lists with some kind of bullet operator:For Unicode bullets (
•
), this seems like a no-brainer. The question is what ASCII form(s) it should also have..
looks a lot like a bullet and isn't currently meaningful when followed by a space. I think this is the current winner.~
looks something like a dash and isn't currently meaningful when followed by a space, though we've occasionally discussed it being used for typing (as it was in my typed CoffeeScript branch).-
,+
,*
would be great from a compatibility/familiarity perspective. In particular, I dream of a big YAML subset as being a subset of Civet, in the same way that JSON is a subset of JavaScript. We could also plausibly support them in certain contexts, like right after an assignment as in the example above. But in general we should probably give precedence to these acting like regular binary operators. For example:test([item1, item2])
. But I think this is mainly an issue when trying to do indented implicit function calls, which is a bit of an edge case (though admittedly a useful one; implicit objects are used this way all the time). When we're at the "beginning" of an expression, I think we could safely use-
,+
,*
.>
is maybe another related option, inspired by the recent JSX ideas, but it has the same limitations as-
/+
/*
.--
is a reasonable option inspired by en-dash (this is how you type it in LaTeX).++
doesn't make as much sense, and**
already means exponentiation (and>>
already means shift-right). The main issue with doubled operators like this is that they look ugly with 2-spaces indentation:Context
Civet (and CoffeeScript) currently lack an implicit array mechanism, unlike objects.
They also have an awkward way to write lists of implicit objects — the dedented comma — which this could be a nicer alternative to.
The text was updated successfully, but these errors were encountered: