是否存在没有垃圾回收功能的函数式语言
或者甚至是非函数式/非内存管理语言中的重函数式样式。 有什么样的技术来处理中间垃圾等问题?在lazyniss/thunk分配的内存之后进行清理。性能(因为如果您必须跟踪其进度来释放它,则无法轻松地在不可变变量之间共享资源(智能指针?)
Or even heavily functional styles in non functional/non memory managed languages.
What sort of techniques are there to deal with problems like intermediate garbage? Cleaning up after lazynizess/thunk allocated memory. Performance(since you can't easily share resources between immutable variables if you have to track its progress to deallocate it(smart pointers?)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您可能对具有线性或唯一性类型的编程语言感兴趣,这些语言可以管理资源(特别是内存)。最近的示例:ATS 和 LinearML。
已经尝试过“基于区域的内存管理”(例如 Cyclone),但它们还没有成功——区域也允许(早期)内存回收,但它们还不够(例如,有程序当使用基于区域的内存管理运行时,将表现出不可接受的性能)。我认为这两种方案可以混合使用。
回到你的问题,一些 ATS 程序可以在没有垃圾收集的情况下运行。 (我不会说这样的程序是以“函数式”风格编写的,例如 SML,而是以命令式和一阶函数式风格的混合形式编写。)
You might be interested in programming languages with linear or uniqueness types, these can manage resources (and memory in particular). Recent examples: ATS and LinearML.
There have been attempts at "region-based memory management" (e.g. Cyclone), but they haven't lifted off just yet -- regions also allow for (earlier) memory reclamation, but they aren't enough (e.g., there are programs which, when run with region-based memory management, will exhibit unacceptable performance). The two schemes could be mixed, I think.
Back to your question, some ATS programs can run without garbage collection. (I won't say that such programs are written in "functional" style, such as in SML, but in a mix of imperative and first-order functional style.)
我能想到的唯一相关的事情是 Mlton 如何通过区域分析消除垃圾收集的重要部分。从理论上讲,应该可以实现一种编译器,它将无法管理且未注释的指针泄漏视为错误,然后就可以在完全手动的内存管理设置中使用许多函数式编程技术。
The only relevant thing I can think of is how Mlton is eliminating a significant part of garbage collection with a region analysis. It should be possible, in theory, to implement a compiler which will treat an unmanageable and un-annotated pointer leak as an error, and then one would be able to use many functional programming techniques in an entirely manual memory management setting.