Skip to content

Instantly share code, notes, and snippets.

@ashmind
Created April 29, 2014 01:33
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ashmind/11388735 to your computer and use it in GitHub Desktop.
Save ashmind/11388735 to your computer and use it in GitHub Desktop.
1. Syntax of `switch`.
2. Syntax of `for`.
3. Array initializers thorugh `{}` (so now it is both `new[] {}` and `{}`)
4. Having both `delegate(..) {..}` and `(..) => ..`.
5. Reserving `*` for rarely-used pointer syntax.
@hazzik
Copy link

hazzik commented Apr 29, 2014

1,2. What is wrong with switch and for?
3. What's wrong with this again?
4. Two syntax for delegates there just because of backwards compatibility, so you can upgrade a framework by just selection a new framework version in VS.
5. What do you propose? Using IntPtr?

@ashmind
Copy link
Author

ashmind commented Apr 29, 2014

1.ancient clunky syntax -- see mandatory break for an example.
It should be something much more compact and extensible, maybe not full pattern matching, but still.

2.for -- also ancient and clunky.
Alternative would be merging for and foreach and providing a range syntax, as most for usages just go over an int range

3,4.Of course they can't remove things and that all very understandable, however the fact is that there are two different syntaxes for the same thing. I wish it started with the right one instead.

5.I would prefer not having unsafe at all, but it could have had some less useful syntax, e.g. int^ (as in C++/CLI).
Then we could have a shortcut for IEnumerable<>, for example.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment