"Syntax error before: '/' " 在做 Erlang make 的时候
"Syntax error before: '/' " when doing Erlang make
当我使用我的 Erlang pjt 进行制作时,会出现一些错误,例如:memcached.erl:44:10: syntax error before: '/'
源代码:
-module(Memcached).
%% External API
-export([set/3, set/5]).
-export([add/3, add/5]).
-export([replace/3, replace/5]).
-export([get/2]).
-export([delete/3, delete/2]).
-export([stats/1]).
%%====================================================================
%% Types
%%====================================================================
%% @type hostport() = {host, string(), port, integer()}. Tuple describing a host and port to connect to
%% @type socket() = {socket, port()}. Tuple describing an existing socket
%% @type memcached_connection() = hostport() | socket().
%% @type memcached_key() = list() | atom().
-type(hostport() :: {host, string(), port, integer()}).
-type(socket() :: {socket, port()}).
-type(memcached_connection() :: hostport() | socket()).
-type(memcached_key() :: list() | atom()).
%%====================================================================
%% External API
%%====================================================================
%% @doc Associate Bytes with Key.
%% @spec set(memcached_connection(), Key::memcached_key(), Bytes::any()) ->
%% ok | {error, not_stored}
-spec(set/3::(memcached_connection(), memcached_key(), any()) ->
ok | {error, not_stored}).
set({host, Host, port, Port}, Key, Bytes) ->
set({host, Host, port, Port}, Key, 0, 0, Bytes);
set({socket, Socket}, Key, Bytes) ->
set({socket, Socket}, Key, 0, 0, Bytes).
错误位于-spec(set/3::(memcached_connection(), memcached_key(), any())
我查了很多文档试图解决它,但错误仍然存在。 Erlang 语法是否存在拼写错误或误用?
我的 erl 环境信息:
Erlang/OTP 24 [erts-12.1.5] [source] [64-bit] [smp:2:2] [ds:2:2:10] [async-threads:1]
Eshell V12.1.5 (abort with ^G)
1>
此语法已过时:
-spec(set/3::(memcached_connection(), memcached_key(), any()) ->
ok | {error, not_stored}).
当前语法是:
-spec set(memcached_connection(), memcached_key(), any()) ->
ok | {error, not_stored}.
我试图找出哪个版本的 Erlang 放弃了对旧语法的支持,但我找不到它 - 一定是很久以前的事了。
当我使用我的 Erlang pjt 进行制作时,会出现一些错误,例如:memcached.erl:44:10: syntax error before: '/'
源代码:
-module(Memcached).
%% External API
-export([set/3, set/5]).
-export([add/3, add/5]).
-export([replace/3, replace/5]).
-export([get/2]).
-export([delete/3, delete/2]).
-export([stats/1]).
%%====================================================================
%% Types
%%====================================================================
%% @type hostport() = {host, string(), port, integer()}. Tuple describing a host and port to connect to
%% @type socket() = {socket, port()}. Tuple describing an existing socket
%% @type memcached_connection() = hostport() | socket().
%% @type memcached_key() = list() | atom().
-type(hostport() :: {host, string(), port, integer()}).
-type(socket() :: {socket, port()}).
-type(memcached_connection() :: hostport() | socket()).
-type(memcached_key() :: list() | atom()).
%%====================================================================
%% External API
%%====================================================================
%% @doc Associate Bytes with Key.
%% @spec set(memcached_connection(), Key::memcached_key(), Bytes::any()) ->
%% ok | {error, not_stored}
-spec(set/3::(memcached_connection(), memcached_key(), any()) ->
ok | {error, not_stored}).
set({host, Host, port, Port}, Key, Bytes) ->
set({host, Host, port, Port}, Key, 0, 0, Bytes);
set({socket, Socket}, Key, Bytes) ->
set({socket, Socket}, Key, 0, 0, Bytes).
错误位于-spec(set/3::(memcached_connection(), memcached_key(), any())
我查了很多文档试图解决它,但错误仍然存在。 Erlang 语法是否存在拼写错误或误用?
我的 erl 环境信息:
Erlang/OTP 24 [erts-12.1.5] [source] [64-bit] [smp:2:2] [ds:2:2:10] [async-threads:1]
Eshell V12.1.5 (abort with ^G)
1>
此语法已过时:
-spec(set/3::(memcached_connection(), memcached_key(), any()) ->
ok | {error, not_stored}).
当前语法是:
-spec set(memcached_connection(), memcached_key(), any()) ->
ok | {error, not_stored}.
我试图找出哪个版本的 Erlang 放弃了对旧语法的支持,但我找不到它 - 一定是很久以前的事了。