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

科技回声

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

GitHubTwitter

首页

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

资源链接

HackerNews API原版 HackerNewsNext.js

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

Neut Programming Language

147 点作者 azhenley3 个月前

9 条评论

gnabgib3 个月前
Big in 2020 as a Show HN (456 points, 80 comments) <a href="https:&#x2F;&#x2F;news.ycombinator.com&#x2F;item?id=23283880">https:&#x2F;&#x2F;news.ycombinator.com&#x2F;item?id=23283880</a>
评论 #43162616 未加载
sirwhinesalot3 个月前
The Koka language uses a similar approach to track resource usage, except there they use ref counting and just remove unnecessary ref counting operations. Neat stuff.
评论 #43166397 未加载
saghm3 个月前
From glancing through a few of the pages that piqued my interest, I was somewhat surprised to see this section in &quot;How to Execute Types&quot; (<a href="https:&#x2F;&#x2F;vekatze.github.io&#x2F;neut&#x2F;how-to-execute-types.html" rel="nofollow">https:&#x2F;&#x2F;vekatze.github.io&#x2F;neut&#x2F;how-to-execute-types.html</a>):<p>&gt; Here, we&#x27;ll see how a type is translated into a function that discards&#x2F;copies the terms of the type. To see the basic idea, let&#x27;s take a simple ADT for example:<p><pre><code> data item { | New(int, int) } </code></pre> &gt; The internal representation of New(10, 20) is something like the below:<p>&gt; New(10, 20)<p><pre><code> &#x2F;&#x2F; ↓ (compile) let v = malloc({2-words}) in store(10, v[0]); store(20, v[1]); v </code></pre> I suspected that it&#x27;s not actually heap-allocating every single bit of memory in every program, and from looking around more in the docs, I _think_ the &quot;Allocation Canceling&quot; section here explains what I was missing (<a href="https:&#x2F;&#x2F;vekatze.github.io&#x2F;neut&#x2F;basis.html#allocation-canceling" rel="nofollow">https:&#x2F;&#x2F;vekatze.github.io&#x2F;neut&#x2F;basis.html#allocation-canceli...</a>):<p>&gt; When a free is required, Neut looks for a malloc that is the same size and optimizes away such a pair if one exists.<p>This is a really interesting way of automating memory management at compile time. I imagine there&#x27;s still a lot of room for different choices in this strategy (e.g. choosing to reuse part of a larger allocation rather than looking for one that&#x27;s exactly the same size and then leaving behind the remainder to re-use for a future allocation), and I&#x27;m super curious about whether this would end up encouraging different patterns than existing memory management systems. Offhand, it almost seems like it could act as a built-in allocation buffer managed by the compiler, and I&#x27;m curious if the algorithm for reusing memory is smart enough to handle something like manually allocating the maximum amount of memory needed for the lifetime of the program up front and then re-using that for the duration of the program to avoid needing to allocate anything dynamically at all (although my worry would be that this would devolve into the knapsack problem and not be feasible in practice). If this did work though, my immediate idea would be for some sort of hook where you could specify the maximum amount of memory you&#x27;d be willing to use, which could then turn &quot;using too much memory at runtime&quot; into a compiler error. My assumption is that that I&#x27;m missing something that would make all of this not work the way I&#x27;m thinking though.
评论 #43167705 未加载
评论 #43167364 未加载
asplake3 个月前
Could someone explain the “Necessity and noema” section [1] or share a reference? Looked like it might be significant but I couldn’t make much sense of it<p>[1] <a href="https:&#x2F;&#x2F;vekatze.github.io&#x2F;neut&#x2F;terms.html#necessity-and-noema" rel="nofollow">https:&#x2F;&#x2F;vekatze.github.io&#x2F;neut&#x2F;terms.html#necessity-and-noem...</a>
评论 #43164814 未加载
评论 #43164806 未加载
fuzztester3 个月前
It looks partly like OCaml, with the &quot;let ... in&quot; kind of syntax. Also the &quot;unit&quot; word. I think in OCaml it means a function that doesn&#x27;t return any value, but why is the word unit used for that?
评论 #43166449 未加载
评论 #43163671 未加载
评论 #43163526 未加载
评论 #43165134 未加载
sestep3 个月前
For &quot;How Fast is This?&quot; it links to a benchmarks page, which only shows that it&#x27;s faster than Haskell. It would be more informative to instead compare against a language that is more popular and&#x2F;or more performant than Haskell.
评论 #43165138 未加载
评论 #43165149 未加载
HackerThemAll3 个月前
3 times on HN: 4 days ago, 3 days ago, and this one 2 days ago.<p>Still no, thank you, doesn&#x27;t seem to be as compelling as Rust to me.
skulk3 个月前
I&#x27;m currently reading through the automatic memory management claims which look really cool (reminds me of linear types), but the highlighted punctuation (, : =) makes it very painful to read.
评论 #43162749 未加载
评论 #43162712 未加载
tempodox3 个月前
As a matter of personal preference, hoisted curlies drive me insane.
评论 #43163086 未加载
评论 #43162891 未加载