扩展编程语言是如何工作的?
我没有编程经验,但有兴趣学习一门语言。
因此,阅读本节“http://wiki.freaks-unidos.net/weblogs/azul/principles-of-software#extend-your-language-to-match-your-domain”让我对编程一个单一的2种或多种语言的应用程序。
实际上是如何做到的?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
一些想法:
尽管如此,面对这一切,我还是会尝试举一个例子来类比它是如何工作的。
假设您需要与一群人一起完成某些技术任务 - 按难度对国际象棋谜题进行排名或测试棉花糖是否受到污染等。 进一步假设您团队中的一个人只会说日语,另一个人只会说葡萄牙语,第三个人只会说世界语。
拥有流利地说所有这些语言的能力,您最好的选择是编写一种专门用于手头任务的人工语言; 这称为领域特定语言(DSL)。 它应该包含您谈论骑士和白嘴鸦或硅酸盐纳米粒子或任何任务所需的所有术语,而没有太多其他术语。 将这一点教给您的每个团队成员,然后您可以同时向他们提供所有指示。 他们可以互相谈论他们正在做的事情,寻求帮助(只要与您的语言涵盖的内容相关),就好像他们都说同一种语言一样。
他大概就是这么说的。
A few thoughts:
Still, in the face of all that, I'll try to give an example of how this works by analogy.
Suppose you need to work with a group of people on some technical task--ranking chess puzzles by difficulty or testing marshmallows for contamination or something. Suppose further that one of the people on your team speaks only Japanese, another only Portuguese, and the third only Esperanto.
Being blessed with the ability to speak all of these languages fluently, your best bet is to make up an artificial language specialized to the task at hand; this is called a Domain Specific Language, or DSL. It should have all the terminology you need to talk about knights and rooks or silicate nanoparticles or whatever for the task, and not much else. Teach this to each of your team members, and then you can give them all their instructions at the same time. They can talk to each other about what they are doing, ask for help (so long as it's related to something covered by your language) as if they all spoke the same language.
That's roughly what he's talking about.
我认为您可能在学会走路之前就尝试跑步。 其中的概念可能需要一点编程经验才能开始。
这篇文章的主旨(坦率地说表达得很糟糕)是,当您编程时,您经常会遇到受益于声明性语法的任务,即您应该能够表达您想要做的事情的意图,并将实现细节留给图书馆。 一个很好的例子是查询数据库,它(通常)更具可读性,能够以声明方式描述您想要执行的操作并让某些中间件找出执行此操作的最佳方法,SQL 和 Linq 是声明式机制的 2 个示例查询数据。
这是一个非常有趣的主题,但老实说,如果您没有编程经验,它可能更像是 201 主题而不是 101 主题,请先了解基础知识。
I think you may be trying to run before you can walk. The concepts in there probably require a little programming experience to start with.
The thrust of the article (and frankly poorly expressed) is that when you are programming you often encounter tasks that benefit from a declarative syntax, i.e. you should be able to express the intent of what you want to do and leave the implementation details to a library. A good example is querying a database, it's much more readable (usually) to be able to declaratively describe what you want to do and let some middleware figure out the best way to do it, SQL and Linq are 2 examples of a declarative mechanism for querying data.
This is a very interesting topic, but honestly if you have no programming experience it's probably more of a 201 subject than a 101 subject, get your basics down first.