Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

3
  • C# can also make use of anonymous classes. See the second and fourth examples in my answer. Commented Nov 3, 2014 at 22:21
  • @RobertHarvey: My point isn't that Scala has unique features but that there's something syntactically similar in Scala, but it isn't an initializer (something similar could be said for C#'s anonymous classes; is that what your comment means?). In your two examples, aren't the anonymous classes syntactically and semantically different from the initializers? Syntactically, the anonymous class takes the place of the constructor call; semantically, initializers don't involve the creation of an anonymous class. In Scala, the anonymous class is in addition to the constructor call. Commented Nov 3, 2014 at 23:04
  • The problem with UIS is that it introduces new ambiguity: std::vector<std::string>(1) and std::vector<std::string>{1} means the same, while std::vector<int>(1) and std::vector<int>{1} are different. For this reason, it is more confusing than helpful, and I think it is of negative value introducing it to c++11. Commented Nov 4, 2014 at 8:53