什么是“$”运算符?
What is the '$' operator?
我在 Daml 文档中看到了一些示例,其中使用了运算符“$”,但无法完全理解其用途。
示例:
submit alice $ create User with username = alice, following = []
是否与do
相同,如:
submit alice do
create User with username = alice, following = []
?
$
运算符可替代括号。范例
submit alice $ create User with username = alice, following = []
与
相同
submit alice (create User with username = alice, following = [])
完成,do
用于声明一个代码块(多行代码):
test = scenario do
alice <- getParty "Alice"
bob <- getParty "Bob"
...
不过也可以单行代码使用:
submit alice do create User with username = alice, following = []
我在 Daml 文档中看到了一些示例,其中使用了运算符“$”,但无法完全理解其用途。
示例:
submit alice $ create User with username = alice, following = []
是否与do
相同,如:
submit alice do
create User with username = alice, following = []
?
$
运算符可替代括号。范例
submit alice $ create User with username = alice, following = []
与
相同submit alice (create User with username = alice, following = [])
完成,do
用于声明一个代码块(多行代码):
test = scenario do
alice <- getParty "Alice"
bob <- getParty "Bob"
...
不过也可以单行代码使用:
submit alice do create User with username = alice, following = []