声明式(编程)语言是解释型语言

声明式语言包包括数据库查询语言(SQLXQuery),正则表达式,逻辑编程,函数式编程和组态管理系统。

声明式编程透过函数、推论规则或项重写(term-rewriting)规则,来描述变量之间的关系。它的语言运行器(编译器解释器)采用了一个固定的算法,以从这些关系产生结果。

https://baike.baidu.com/item/声明式编程/9939512

Aren’t We Just Hiding the Implementation?

Eventually, every piece of our code must be implemented somewhere. In declarative languages, the implementation is up to whoever interprets the code:

SQL is handled by a database engine.
A browser will interpret HTML.
A YAML configuration file could be handled by a build server.

When we apply some declarative techniques to our imperative languages, it’s up to us to provide the implementation. Even the LINQ extension methods are implemented in C#, they’re just not in our own codebase. So we’re actually just abstracting away implementation details. Then the question is: how far do we go with this abstraction? You will need to find what works best for you, but a good starting point for me is that public methods (i.e. your public API) should contain a minimum set of statements, and these should all be easily readable. The contents of your public method should tell you what is happening, not how.

Declarative Programming in Depth

Published by

风君子

独自遨游何稽首 揭天掀地慰生平

发表回复

您的邮箱地址不会被公开。 必填项已用 * 标注