【发布时间】:2020-02-24 17:14:18
【问题描述】:
我已经设计并实现了一种编程语言。
这种语言的一个特点是将一个函数(在示例代码中,我称之为leftBind)伪装成一个变量,这样后面的任何点符号都会作为标识符传递。
编辑:这也类似于类的访问器方法,只是这里没有使用类。相同的术语“getter”或“accessor”是否适用于此?
这种语言的目的是提供一个功能齐全的语言,但被监禁的环境,允许项目的复杂配置,但保护项目免受整个未经授权的行为。
一个例子:
/*leftbind aliases the identifier “sql” to the function “quote”
It is called leftBind, since it’s binding the left side of the parse tree to a function*/
leftBind(“sql”, “quote”);
q=“select * from foo where user=$sql.user”; // equivalent to quote(user)
这对于更复杂的任务或当您想将常用函数内联到字符串中而不需要额外的代码行时非常方便。
这种行为的术语是什么?
【问题讨论】:
标签: compiler-construction terminology software-design language-design