From the docs , the not operator maps to the complement function. This function is defined in core.stanza as:
public defn complement (a:True|False) -> True|False
This makes it impossible to override the not operator. For instance:
public defstruct AST :
name:String
public defn complement (x:AST) -> AST :
AST(string-join(["not ", name(x)]))
...
val a = AST("a")
val b = not a <-- This will not compile
This generates:
Cannot call function complement of type True|False -> True|False with arguments of type (AST).
I does not seem like I can overload the complement function because it doesn't allow for defmethod style usage.
Thoughts ?
From the docs , the
not
operator maps to thecomplement
function. This function is defined incore.stanza
as:This makes it impossible to override the
not
operator. For instance:This generates:
I does not seem like I can overload the
complement
function because it doesn't allow fordefmethod
style usage. Thoughts ?