Erlang record expression ignored warning

夙愿已清 提交于 2019-12-08 09:10:42

Well, the compiler is telling you exactly what's wrong :) You create a new #tab_info record, but never bind it to any variable. The code is therefore meaningless and the compiler is telling you so. Changing the Check variable (or more correctly, creating a new one) won't have any effect unless you return it. Check is not a global variable, like it might be in imperative languages. Also, changing a variable you receive as an argument to a function, will not result in a change in how the caller sees the variable.

You want to bind the expression to some variable and then do something meaningful with it.

NewCheck = Check#tab_info{...}
{ok, Pid, NewCheck}

As a side note, if instead you did a function call and did not bind the return value to anything, the compiler would not complain as the function might have side-effects and this might be the reason you called the function in the first place.

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!