You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Functions like aref have very generic input parameters.
aref, in particular, can return nth element of string, vector, bool-vector and char-table.
The problem is that string is not necessarily stored as lisp.Object, so we can not have func(array lisp.Object, index int) lisp.Object as a signature. More over, strings always return rune (char) as a result of indexing. This leads to func(s string, index int) rune signature.
The result is 2 duplicated comment blocks that can confuse users.
// Aref = Return the element of ARRAY at index IDX.// ARRAY may be a vector, a string, a char-table, a bool-vector,// or a byte-code object. IDX starts at 0.////goism:"Aref"->"aref"funcAref(arrayObject, idxint) Object {}
// ArefString = Return the element of ARRAY at index IDX.// ARRAY may be a vector, a string, a char-table, a bool-vector,// or a byte-code object. IDX starts at 0.////goism:"ArefString"->"aref"funcArefString(arraystring, idxint) rune {}
Proposal:
add additional syntax that supports overloaded signatures;
optionally with alternative doc-string.
Example:
(aref Aref (:object array :int idx) :object"ArefString is like Aref, but only for strings."
ArefString (:string s :int idx) :char)
The text was updated successfully, but these errors were encountered:
Functions like
aref
have very generic input parameters.aref
, in particular, can return nth element ofstring
,vector
,bool-vector
andchar-table
.The problem is that
string
is not necessarily stored aslisp.Object
, so we can not havefunc(array lisp.Object, index int) lisp.Object
as a signature. More over, strings always returnrune
(char) as a result of indexing. This leads tofunc(s string, index int) rune
signature.The result is 2 duplicated comment blocks that can confuse users.
Proposal:
add additional syntax that supports overloaded signatures;
optionally with alternative doc-string.
Example:
The text was updated successfully, but these errors were encountered: