19 lines
1.2 KiB
Markdown
19 lines
1.2 KiB
Markdown
|
# C# Language Design Notes for Feb 2018
|
||
|
|
||
|
***Warning: These are raw notes, and still need to be cleaned up. Read at your own peril!***
|
||
|
|
||
|
Index could be a type
|
||
|
|
||
|
Then it's about syntax of how to express an Index that's either n from front or n from back.
|
||
|
|
||
|
How important is "from end"? It's definitely convenient, but its expressiveness is probably not super important.
|
||
|
|
||
|
Lots of problems with using "-", with overload resolution etc.
|
||
|
|
||
|
Let's use "^" as a strawman. That takes away some of the ambiguity.
|
||
|
|
||
|
There's still a question as to how an overloadable "^" would work in the future. It would be a unary operator that returns something different than it takes. How would it be found, if it lives on the result type? There's target typing there, but it may not have a target type, or that may in turn come from overloaded operators. It would have to be handled similarly to conversion in some ways.
|
||
|
|
||
|
A crazy idea: Use the existing `~` operator! It creates negative numbers, yes, but don't think of them as such. Think of them as integers from end. `~0` is `-1`, `~1` is `-2` etc. This is intriguing, because we'd need *no* extra language support, and just have a convention.
|
||
|
|
||
|
Quite weird though!
|