编写可移植的方案代码.有什么“标准"吗?超越 R5RS 本身? [英] Writing portable scheme code. Is anything "standard" beyond R5RS itself?

查看:35
本文介绍了编写可移植的方案代码.有什么“标准"吗?超越 R5RS 本身?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在学习scheme,直到现在一直在使用guile.我真的只是在学习作为自学函数式编程语言的一种方式,但我想发布某种开源项目来加强这项研究 - 不确定是什么......我是一名网络开发人员,所以可能是韦比的东西.

I'm learning scheme and until now have been using guile. I'm really just learning as a way to teach myself a functional programming language, but I'd like to publish an open source project of some sort to reenforce the study— not sure what yet... I'm a web developer, so probably something webby.

很明显,发布方案代码并不是一件容易的事,因为有所有这些不同的实现,并且没有超出语言本身核心 (R5RS) 的真正标准.例如,我几乎肯定需要在磁盘和 TCP 套接字上执行基本 IO,以及字符串操作,例如扫描/正则表达式,R5RS 似乎没有涵盖,除非我没有看到它在文件中.似乎 Scheme 更像是一个概念"而不是实用语言……这是一个公平的评估吗?如果我想学习一种更适合在开源项目中使用的函数式编程语言,也许我应该看看 Haskell 之类的东西?

It's becoming apparent that publishing scheme code isn't very easy to do, with all these different implementations and no real standards beyond the core of the language itself (R5RS). For example, I'm almost certainly going to need to do basic IO on disk and over a TCP socket, along with string manipulation, such as scanning/regex, which seems not to be covered by R5RS, unless I'm not seeing it in the document. It seems like Scheme is more of a "concept" than a practical language... is this a fair assessment? Perhaps I should look to something like Haskell if I want to learn a functional programming language that lends itself more to use in open source projects?

实际上,当您想发布一个开源项目时,不同的方案实现会带来多大的痛苦?我真的不喜欢在各种主流实现(Chicken、guile、MIT、DrRacket)下为基本的东西维护 5 个不同的函数,比如字符串操作.有多少人真正为交叉实现兼容性编写方案,而不是与只存在于他们自己方案中的库函数紧密耦合?

In reality, how much pain do the differing scheme implementations pose when you want to publish an open source project? I don't really fancy having to maintain 5 different functions for basic things like string manipulation under various mainstream implementations (Chicken, guile, MIT, DrRacket). How many people actually write scheme for cross-implementation compatibility, as opposed to being tightly coupled with the library functions that only exist in their own scheme?

我已阅读http://www.ccs.neu.edu/home/dorai/scmxlate/scheme-boston/talk.html,这让我没有信心;)

I have read http://www.ccs.neu.edu/home/dorai/scmxlate/scheme-boston/talk.html, which doesn't fill me with confidence ;)

编辑 |让我们重新定义标准"为普通".

EDIT | Let's re-define "standard" as "common".

推荐答案

难题.

大多数人决定务实.如果实现之间的可移植性很重要,他们会在标准 Scheme 中编写大部分程序,并在(小)库中隔离非标准部分.已经有各种方法来具体说明如何做到这一点.最近的一项努力是 SnowFort.

Most people decide to be pragmatic. If portability between implementations is important, they write the bulk of the program in standard Scheme and isolate non-standard parts in (smallish) libraries. There have been various approaches of how exactly to do this. One recent effort is SnowFort.

http://snow.iro.umontreal.ca/

更早的尝试是 SLIB.

An older effort is SLIB.

http://people.csail.mit.edu/jaffer/SLIB

如果您查找 - 或要求 - 正则表达式和词法分析器/解析器库,您会很快找到一些.

If you look - or ask for - libraries for regular expressions and lexer/parsers you'll quickly find some.

由于 R5RS 的理念是仅包含所有实现者都同意的语言功能,因此该标准很小 - 但也非常稳定.

Since the philosophy of R5RS is to include only those language features that all implementors agree on, the standard is small - but also very stable.

然而,对于现实世界"编程,R5RS 可能不是最合适的.因此,R6RS(和 R7RS?)包含更多现实世界"库.

However for "real world" programming R5RS might not be the best fit. Therefore R6RS (and R7RS?) include more "real world" libraries.

也就是说,如果您只需要可移植性,因为它似乎是正确的,那么请仔细考虑是否真的想要投入.我会简单地根据我最了解的实现编写我的程序.然后,如果有必要,之后再移植它.这通常比预期的要容易.

That said if you only need portability because it seems to be the Right Thing, then reconsider carefully if you really want to put the effort in. I would simply write my program on the implementation I know the best. Then if necessary port it afterwards. This often turns out to be easier than expected.

这篇关于编写可移植的方案代码.有什么“标准"吗?超越 R5RS 本身?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆