Replies: 9 comments 2 replies
-
I've combed back through a pile of notes, and extracted out the various TODOs regarding syntax.
|
Beta Was this translation helpful? Give feedback.
-
Two more items found in old notes:
|
Beta Was this translation helpful? Give feedback.
-
(DONE) One tiny change this past week that had been planned but didn't make it onto the list: The syntax for properties was modified to allow properties with method and/or class body definitions to also have an initial value.
|
Beta Was this translation helpful? Give feedback.
-
|
Beta Was this translation helpful? Give feedback.
-
This one is done and in:
We ended up using the |
Beta Was this translation helpful? Give feedback.
-
These two are both done and in:
|
Beta Was this translation helpful? Give feedback.
-
This one is done and in:
Specifically, we introduced Additionally, the following stand-alone keywords can be used as types:
The primary use case for these is with the
Note that the syntax is context sensitive; it can not appear in every single place that a type expression can appear. For example:
(As an aside: It would be possible, in most cases, to support the syntax in a context-insensitive manner, but would require fairly heavy back-tracking to do so, so for the time being we constrained the syntax.) |
Beta Was this translation helpful? Give feedback.
-
Regarding:
We have reserved the (Update: Moved to new thread) |
Beta Was this translation helpful? Give feedback.
-
An alternative syntax to consider for the
Thoughts? |
Beta Was this translation helpful? Give feedback.
-
We're pretty close to the end of the list of planned (and semi-planned) changes to the details of the language syntax. A few little changes went in this week:
The "tick bar" multi-line syntax introduction was changed to the "escape bar", as you can see here.
We finished removing the old ellipsis support from the lexer/parser. This used to be used for the
varargs
feature, but we dropped support for that some time ago.There are two
switch
related topics that we have been considering, that I would like some feedback on:We have discussed dropping the
switch ()
(the "switch ladder") construct. The main issue is that we haven't used it much, and that does point towards the construct being somewhat unnecessary. It's easier to chop things now than later, but there's no rush on this decision.(DONE) We know that we need a specialization of the
switch
statement for types, specifically to test for "isA" instead of "equals". I've mocked up quite a few ways to do this, but most of them I've eliminated for reasons of obvious ugliness. Some languages have taken thematch
keyword for this purpose, which seems reasonable. Another possibility is to use the existingis
keyword with theswitch
keyword to indicate the different use case:a = b = c
assigns the value ofc
tob
and toa
, and then further yields that value as the expression's value; Ecstasy disallows this because it is an error prone construct, and also because it conflicts with several other capabilities, such as named arguments. However, in the case that a value assignment + value yield is desired, we are considering introducing a new operator to indicate this purpose explicitly. Unfortunately, no obvious operator has volunteered for this purpose; obvious means "contains an=
operator character somewhere in the operator, and doesn't confuse people". The:=
operator, for example, is already used as the conditional assignment operator. One operator that we are considering is the<-
operator (i.e. the backwards lambda), which reads fairly well and seems fairly explicit. Unfortunately, it does not contain the=
operator character that would clearly identify the purpose of the operator. Again, there is no rush, but feedback is welcome. Consider the typical use cases, such asfoo(a, b <- c, d);
There are some other possible changes in my notes, so I'll need to go back through them to see what else is still under consideration. Type algebra is one such item that I can recall, which is particularly useful for things like forming a bespoke type for the
delegates
keyword. We also have a few type system thoughts that we haven't quite nailed down yet, that could eventually impact syntax at the edges, but most of these we've deferred for a "2.0" (i.e. 6-10 years away, since we're still years away from an actual 1.0). The one thing that I'd be willing to make some sacrifices to get in to a 1.0 (because it would require breaking changes) is a limited form of dependent type support, focused primarily on integer types, but this is worthy of a separate conversation.Ideas and feedback are welcome.
Also, if you have any particular challenges from using the current syntax, raise them now before you get used to it and you forget what bothers you!
Beta Was this translation helpful? Give feedback.
All reactions