XSLT是一种功能性编程语言吗? [英] Is XSLT a functional programming language?

查看:129
本文介绍了XSLT是一种功能性编程语言吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

关于函数式编程语言的几个问题让我想到了XSLT是否是一种函数式编程语言。如果不是,缺少哪些功能? XSLT 2.0缩短了还是缩小了差距?

解决方案

XSLT是声明式的,而不是有状态的。尽管XSLT基于函数式编程思想,但它不是一种全功能的编程语言,它缺乏将函数视为一类数据类型的能力。它有像懒惰评估这样的元素来减少不必要的评估,也没有显式循环。

像一个函数式语言,我认为它可以很好地与自动并行安全的多线程处理器。



维基百科上的XSLT


作为一种语言,XSLT受
函数式语言和
基于文本的模式匹配语言
像SNOBOL和awk。它最直接的
前身是DSSSL,这是一种语言,
对XSLT为XML执行的SGML
执行相同的功能。 XSLT可以将
也视为模板
处理器。


这是使用。 FXSL是一个实现对高阶函数支持的库。



由于FXSL的原因,我认为XSLT本身并不需要完全实现功能。也许FXSL将在未来被纳入W3C标准,但我没有证据证明这一点。

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 is declarative as opposed to stateful.

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.

From Wikipedia on 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.

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.

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屋!

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