什么是语言绑定?
My good friend, Wikipedia, didn't give me a very good response to that question. So:
- What are language bindings?
- How do they work?
Specifically accessing functions from code written in language X of a library written in language Y.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
在 Flex (Actionscript 3) 中。 源
数据绑定将一个对象中的属性值复制到另一个对象中的属性。 您可以绑定以下对象的属性:Flex 组件、Flex 数据模型和 Flex 数据服务。
提供数据的对象属性称为源属性。 接收数据的对象属性称为目标属性。
以下示例将 TextInput 组件的文本属性(源属性)绑定到 Label 组件的文本属性(目标属性),以便在 TextInput 组件中输入的文本由 Label 组件显示:
数据绑定通常是简单的将模型绑定到用户界面组件的方法。 例如,您有一个具有 FirstName 属性的类。 在 Flex 中,您可以通过将文本框的值设置为 {Object.FirstName} 来轻松将该属性绑定到文本框。 然后,每次 FirstName 属性发生更改时,文本框都会更新,而无需您编写任何代码来监视该属性的更改。
希望有帮助。
马特
In Flex (Actionscript 3). Source
A data binding copies the value of a property in one object to a property in another object. You can bind the properties of following objects: Flex components, Flex data models, and Flex data services.
The object property that provides the data is known as the source property. The object property that receives the data is known as the destination property.
The following example binds the text property of a TextInput component (the source property) to the text property of a Label component (the destination property) so that text entered in the TextInput component is displayed by the Label component:
Data binding is usually a simple way to bind a model to user interface components. For example, you have a class with a FirstName property. In flex you could easily bind that property to a textbox by setting the value of the textbox to {Object.FirstName}. Then, every time that FirstName property changes, the textbox will be updated without requiring you to write any code to monitor that property for changes.
Hope that helps.
Matt
好的,现在问题已经澄清了,这并不真正相关,所以我将其移至 一个新问题
绑定通常指的是一个事物到另一个事物的映射 - 即数据源到表示对象。 它通常指将数据库或类似源(XML 文件、Web 服务等)中的数据绑定到演示控件或元素 - 想想 HTML 中的列表或表格、组合框或桌面软件中的数据网格。
...如果您对这种绑定感兴趣,请继续阅读...
您通常必须将表示元素绑定到数据源,而不是相反。 这将涉及某种映射 - 即您希望数据源中的哪些字段出现在输出中。
有关多种环境的更多信息,请参阅:
Okay, now the question has been clarified, this isn't really relevant so I'm moving it to a new question
Binding generally refers to a mapping of one thing to another - i.e. a datasource to a presentation object. It can typically refer to binding data from a database, or similar source (XML file, web service etc) to a presentation control or element - think list or table in HTML, combo box or data grid in desktop software.
...If that's the kind of binding you're interested in, read on...
You generally have to bind the presentation element to the datasource, not the other way around. This would involve some kind of mapping - i.e. which fields from the datasource do you want to appear in the output.
For more information in a couple of environments see:
假设您创建了一个 C 库来将内容发布到 stackoverflow。 现在您希望能够使用 Python 中的相同库。 在这种情况下,您将为您的库编写 Python 绑定。
另请参阅 SWIG:http://www.swig.org
Let's say you create a C library to post stuff to stackoverflow. Now you want to be able to use the same library from Python. In this case, you will write Python bindings for your library.
Also see SWIG: http://www.swig.org
在代码库的上下文中,绑定是在两种编程语言之间桥接的包装库,以便为一种语言编写的库也可以在另一种语言中隐式使用。
例如,libsvn 是 Subversion 的 API,是用 C 语言编写的。如果您想从 Java 代码中访问 Subversion,您可以使用 libsvn-java。 libsvn-java 依赖于安装的 libsvn,因为 libsvn-java 只是 Java 编程语言和 libsvn 之间的桥梁,提供仅调用 libsvn 函数来完成实际工作的 API。
In the context of code libraries, bindings are wrapper libraries that bridge between two programming languages so that a library that was written for one language can also be implicitly used in another language.
For example, libsvn is the API for Subversion and was written in C. If you want to access Subversion from within Java code you can use libsvn-java. libsvn-java depends on libsvn being installed because libsvn-java is a mere bridge between the Java programming language and libsvn, providing an API that merely calls functions of libsvn to do the real work.