是否有可能建立在Haskell PHP扩展? [英] Is it possible to create PHP extensions in Haskell?
问题描述
是否有可能与哈斯克尔创建PHP扩展?
Is it possible to create PHP extensions with Haskell?
通常PHP扩展使用C.写的使用哈斯克尔FFI提供存根C扩展功能可能(甚至是一个好主意)?
Usually PHP extensions are written using C. Is using Haskell FFI to provide functionality for a stub C extension possible (or even a good idea)?
什么是告诫,以这样的方法?是否Zend公司在后台执行一些魔法,将破坏这样的计划?
What are the caveats to such an approach? Does Zend perform some magic in the background that would disrupt such a scheme?
推荐答案
您肯定能做到这一点,虽然我不知道任何人都已经尽力了。哈斯克尔互操作通过其FFI机制,你可以肯定:
You can certainly do this, though I'm not sure anyone has tried. Haskell interoperates with C via its FFI mechanism, and you can certainly:
- 从C 呼叫哈斯克尔
- Call Haskell from C
所以,如果你可以从PHP调用C,而C调用Haskell中,你在企业里。
so if you can call C from PHP, and that C calls Haskell, you're in business.
你为什么要这么做?更快,更安全,更简单的code为核心算法或安全关键code,也许。或者通过哈斯克尔趁说,并行或多核服务器后端。
Why would you want to do this? Faster, safer, simple code for your core algorithms or safety-critical code, perhaps. Or to take advantage of say, a parallel or multicore server backend via Haskell.
这篇关于是否有可能建立在Haskell PHP扩展?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!