简体   繁体   English

Elixir中逗号的用途是什么?

[英]What is the use of comma in Elixir?

I am new to elixir and was going through sample chat application written in it using phoenix framework. 我是elixir的新手,正在使用凤凰框架编写使用它编写的示例聊天应用程序。 I am not able to understand meaning of this line 我无法理解这条线的含义

channel "rooms:*", Chat.RoomChannel

I searched online for this type of syntax but could not got the answer I was looking for. 我在网上搜索这种语法,但无法得到我想要的答案。 I know that Chat.RoomChannel is a module and channel follows a string which identifies type of room under consideration 我知道Chat.RoomChannel是一个模块, channel跟随一个字符串,该字符串标识所考虑的房间类型

I want to know how that syntax works 我想知道该语法是如何工作的

The comma seperates the argument list. 逗号分隔参数列表。

I guess you are getting confused that this is a function call. 我想你很困惑这是一个函数调用。 In elixir when calling a function its optional to give paranthesis. 在elixir中调用函数时,它是可选的,以提供paranthesis。 So 所以

channel "rooms:*", Chat.RoomChannel

Is equivalent to 相当于

channel("rooms:*", Chat.RoomChannel)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM