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

科技回声

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

GitHubTwitter

首页

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

资源链接

HackerNews API原版 HackerNewsNext.js

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

Models of Generics and Metaprogramming: Go, Rust, Swift, D and More

81 点作者 trishume将近 6 年前

3 条评论

posnet将近 6 年前
Another interesting approach is Spiral Lang, which allows arbitrary staging, sort of an extension of Zig&#x2F;Terra as mentioned in the blog post.<p><a href="https:&#x2F;&#x2F;github.com&#x2F;mrakgr&#x2F;The-Spiral-Language" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;mrakgr&#x2F;The-Spiral-Language</a>
评论 #20490118 未加载
Aardappel将近 6 年前
Looks like <a href="http:&#x2F;&#x2F;strlen.com&#x2F;lobster&#x2F;" rel="nofollow">http:&#x2F;&#x2F;strlen.com&#x2F;lobster&#x2F;</a> is in the C++&#x2F;D bucket, with unconstrained template parameters.<p>The article makes it sound like &quot;errors occurring in the library code&quot; is a major problem, but forgets to mention how much that also contributes to its strength and simplicity. in Lobster I took great care to make these type errors look very readable, like a compile-time stack trace.<p>Also monomorphization does not always produce code bloat. All these copied (typically small) functions tend to get inlined, and inlining has a habit of cascading, allowing parent code to be simplified and reduced in size etc. Contrast that with boxed generics that use virtual calls, which act as a barrier to optimization since we have no idea what it will do, and which of the many methods it will call. That can result in a lot of code that is present in the compiled code that is not actually needed (which would be a bigger problem for AOT languages like Go than JIT languages like Java, since &quot;dead&quot; JVM bytecodes don&#x27;t produce code cache misses).<p>In a sense, monomorphization is a good match for AOT and expressive type systems, and boxing works better for more dynamic implementations and simple or no type system. Languages like Go straddle these the two extremes uncomfortably.
jkroso将近 6 年前
Is Julia an example of the idea in the last paragraph?
评论 #20503050 未加载