XSLT 是一种函数式编程语言吗? [英] Is XSLT a functional programming language?
问题描述
关于函数式编程语言的几个问题让我开始思考 XSLT 是否是一种函数式编程语言.如果没有,缺少哪些功能?XSLT 2.0 是否缩短或缩小了差距?
Several questions about functional programming languages have got me thinking about whether XSLT is a functional programming language. If not, what features are missing? Has XSLT 2.0 shortened or closed the gap?
推荐答案
XSLT 是声明性的,而不是有状态的.
XSLT is declarative as opposed to stateful.
虽然 XSLT 是基于函数式编程思想的,但它并不是一种完整的函数式编程语言,它缺乏将函数视为第一类数据类型的能力.它具有惰性求值等元素,可减少不必要的求值,并且没有显式循环.
Although XSLT is based on functional programming ideas, it is not a full functional programming language, it lacks the ability to treat functions as a first class data type. It has elements like lazy evaluation to reduce unneeded evaluation and also the absence of explicit loops.
不过,就像函数式语言一样,我认为它可以通过跨多个处理器的自动安全多线程很好地并行化.
Like a functional language though, I would think that it can be nicely parallelized with automatic safe multi threading across several processors.
来自 XSLT 上的维基百科:
作为一种语言,XSLT 受函数式语言,以及基于文本的模式匹配语言像 SNOBOL 和 awk.它最直接前身是 DSSSL,一种语言对 SGML 执行相同的功能XSLT 对 XML 执行的操作.XSLT 可以也被认为是一个模板处理器.
As a language, XSLT is influenced by functional languages, and by text-based pattern matching languages like SNOBOL and awk. Its most direct predecessor was DSSSL, a language that performed the same function for SGML that XSLT performs for XML. XSLT can also be considered as a template processor.
这是一个使用 XSLT 作为在 FXSL 的帮助下,函数式语言.FXSL 是一个实现对高阶函数的支持的库.
Here is a great site on using XSLT as a functional language with the help of FXSL. FXSL is a library that implements support for higher-order functions.
由于 FXSL,我认为 XSLT 本身不需要完全发挥功能.也许未来 FXSL 会被纳入 W3C 标准,但我没有证据证明这一点.
Because of FXSL I don't think that XSLT has a need to be fully functional itself. Perhaps FXSL will be included as a W3C standard in the future, but I have no evidence of this.
这篇关于XSLT 是一种函数式编程语言吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!