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

科技回声

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

GitHubTwitter

首页

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

资源链接

HackerNews API原版 HackerNewsNext.js

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

A Summary of the Metaclasses Proposal for C++

40 点作者 PleaseHelpMe将近 8 年前

6 条评论

mattbierner将近 8 年前
I&#x27;m torn about this proposal. One one hand, I like that the feature generalized something that you can (for the most part) already do in C++, and I like the new expressiveness metaclasses would provide.<p>On the other hand, this is kind of insane. C++ is insane. And I&#x27;m still not convinced this proposal is more than another bandaid over the fundamental problems with the language. Why do our programming languages keep ending up as terribly complicated and incomplete specifications of scheme or smalltalk?<p>I don&#x27;t have a better proposal though and do admire the thought and effort given to retrofitting C++ as a modern language
评论 #14950486 未加载
stephen82将近 8 年前
My first reaction to $class was the following: since we are talking about metaclasses, why not use that name instead, that is &quot;metaclass&quot; in place of &quot;$class&quot;?
评论 #14949990 未加载
评论 #14949602 未加载
quickben将近 8 年前
I don&#x27;t see this making it into the standard.<p>1. Interface = abstract class, already present.<p>2. Reflection, rtti is sparsely used because c++ is primarily used for speed and large teams.<p>3. Reserved words prefixed by $, etc. Well, outside of a preprocessor directives, that will be a first , if it ever happens.<p>By the look of the thing, the author wants c++ to be more like c#. But c++ isn&#x27;t restricting on patterns, we create them. Unlike c# there is no language defined way for dependency injection, interfaces etc. Well we can argue that, but c++ is more flexible on pattern creation, and this proposal wants to put two patterns inside the standard. I just don&#x27;t see it happening.
评论 #14949523 未加载
评论 #14949682 未加载
评论 #14949590 未加载
D-Coder将近 8 年前
If a metaclass is a way to make classes, can you have a meta-metaclass that makes metaclasses? Meta-meta-metaclasses to make meta-metaclasses? (etc)
joshsyn将近 8 年前
funny how D already solves all these issues.
flavio81将近 8 年前
From the article:<p>&gt; &quot;Compile-time programming consists in defining a region in the codeline where the code is meant to be executed at compile time, with the evaluation of compile time data leading to a result. &quot;<p>Wow, great. So in 2017, C++ is finally able to have a feature that Lisp had since about 1966.<p>Yes, you can call this comment &quot;smug&quot;, but my point is less smug and it&#x27;s the following:<p>C++ has been bloated <i>too much</i>. It used to be a nice OO language -perhaps not as elegant as Objective C- but, as the times advanced, good-intentioned people retrofitted more and more characteristics into C++, but the side efects of these &quot;retrofits&quot; is a chaos that is ultimately leading to more criticism of C++ and more people getting interested in alternatives like Julia and Rust.<p>Julia in particular has a very interesting OOP implementation that includes multiple dispatch, and also has good support for metaprogramming.<p>Rust, as I see it, is a good alternative to C++, and should also work for systems programming.