TE
科技回声
首页24小时热榜最新最佳问答展示工作
GitHubTwitter
首页

科技回声

基于 Next.js 构建的科技新闻平台,提供全球科技新闻和讨论内容。

GitHubTwitter

首页

首页最新最佳问答展示工作

资源链接

HackerNews API原版 HackerNewsNext.js

© 2025 科技回声. 版权所有。

Proposal for generics over primitives needs a rethink

48 点作者 StylifyYourBlog超过 10 年前

5 条评论

codeka超过 10 年前
<i>&gt; The cost of the C# approach is that existing classes could not be gradually migrated to be generic; existing collections had to be effectively deprecated and replaced, or a &quot;flag day&quot; had to be declared where all the code (library and client) changes simultaneously. These are not options for us. At the risk of being obnoxious, C# was able to get away with it because at the time, they had a very small base of existing users and code and were not yet successful enough to have to worry about compatibility.</i><p>The reason C# was able to do it is not because they had so few users that a &quot;flag day&quot; was acceptable, it was because they went with the first option and rewrote all their collections. C# did genetics right the first time, and didn&#x27;t end up in this bizarre type-erasing, half-ass world that Java find itself in today.
matt2000超过 10 年前
For reference, here&#x27;s a fairly detailed response: <a href="http://mail.openjdk.java.net/pipermail/valhalla-dev/2014-December/000475.html" rel="nofollow">http:&#x2F;&#x2F;mail.openjdk.java.net&#x2F;pipermail&#x2F;valhalla-dev&#x2F;2014-Dec...</a><p>Site note: I liked how both authors took pains to be respectful in their tones, keeps the focus on the issues at hand and avoids people getting irritated with one another.
guelo超过 10 年前
I thought the response was needlessly combatative, <a href="http://mail.openjdk.java.net/pipermail/valhalla-dev/2014-December/000475.html" rel="nofollow">http:&#x2F;&#x2F;mail.openjdk.java.net&#x2F;pipermail&#x2F;valhalla-dev&#x2F;2014-Dec...</a>
评论 #8824219 未加载
diltonm超过 10 年前
I vote for not making the language more complicated than it already is in Java 7. Oh but we have Java 8 with closures and stuff, well OK how about no more complicated than Java 8. Please? Instead maybe introduce useful things that make programmers more productive. How about implicit generics. Where this whole mess of T and Any and &lt;: extendsT&lt; gobbldygook&gt; melts away. Notice how a new class extends Object automatically? It always has. Why do I have to muck about with all the fancy and overly complex syntax. Give me the features of all of that but abstract it away so I can just write what I need to and it works implicitly. Either that or just leave the dang language alone and go make some cool libraries.
评论 #8823666 未加载
评论 #8827507 未加载
评论 #8823653 未加载
评论 #8824345 未加载
eropple超过 10 年前
The response by Brian Goetz[1] is kind of unpleasant and combative. Moreover, the ideas in it kind of encapsulate why I&#x27;m growing more and more uncomfortable with relying on the JVM to keep up with my needs in the future.<p><i>&gt; The cost of the C# approach is that existing classes could not be gradually migrated to be generic; existing collections had to be effectively deprecated and replaced, or a &quot;flag day&quot; had to be declared where all the code (library and client) changes simultaneously. These are not options for us.</i><p>This is why, despite doing it in my day job, I&#x27;m not high on the JVM&#x27;s future as it stands right now. Compatibility uber alles is <i>not</i> a virtue, even Microsoft gets that these days. Saying &quot;on 1 Jan 2017 we&#x27;re pushing Java 10, and you will need to recompile your dependencies to upgrade&quot; is not a bad thing. No, many people won&#x27;t upgrade immediately. That&#x27;s true. But <i>they already don&#x27;t</i>! It takes years for consumers to catch up with the newest version of Java (for reasons that do not reflect well on those consumers). Why should I, as a consumer, care about them? Why should I, as a consumer, continue to use your product when you would care about laggards more than me? I mean, Oracle&#x27;s welcome to, it&#x27;s their business, but why would I respond positively to that?<p>But he says that a flag day means they &quot;hate their users.&quot; No, it would mean they are going to firewall off the damage laggards can do to their environment and ecosystem. And for the sake of a healthy platform for the next decade I would think they should do exactly that, because those laggards don&#x27;t make the ecosystem and the environment better.<p>And then, at the very end:<p>&gt; And, feel free to prove us wrong! Try implementing the changes you are envisioning in the JVM, and show how they can get us to the goal!<p>Why should I, guy-who-works-for-Oracle? I&#x27;m not drawing a paycheck from Oracle, who owns Java so utterly and wants to attack and damage related tools and platforms (hi, Android), and guess what? I really don&#x27;t need Oracle to fix this because in 2015 I am going to have <i>options</i>. Microsoft is releasing an open-source CLR for OS X and Linux and it&#x27;s effectively substitutable for just about anything I care to use (and, if I had to be honest, a combination of C# and F# are probably better than even Scala for what I do). This is <i>Oracle&#x27;s</i> problem and Oracle&#x27;s ground to lose, not mine.<p>Two-thirds of my Github are C# and Ruby at this point, anyway, and I don&#x27;t even use C# for work.<p>[1] - <a href="http://mail.openjdk.java.net/pipermail/valhalla-dev/2014-December/000475.html" rel="nofollow">http:&#x2F;&#x2F;mail.openjdk.java.net&#x2F;pipermail&#x2F;valhalla-dev&#x2F;2014-Dec...</a>
评论 #8823827 未加载
评论 #8824360 未加载
评论 #8827439 未加载