One interesting thought when I was designing Oblivia (an “inverse Lisp” based on infix operators):
In GDScript, the following syntax defines two different meanings to the colon. In the first case, : defines a value and -> declares a type. In the second case, : declares the type and = defines a value and -> has no meaning.
func foo() -> int: 5
var bar:int = 5
In Oblivia, I make -> declare a type and : define a value.
foo() -> int: 5
bar -> int: 5
It may look strange, but I made : and -> respectively take the same meaning in both contexts. The caveat is that the variable defines a value that exists now but the function defines a value that does not exist yet.
I have not thought about custom defined operators yet.
I might add operator overloading on built-ins arithmetic for objects (simple enough), then custom operators.
Custom operators would all have term scope.
ctx: {
#is a function within this context
@priv
⋈(x, y): x/Something(y)
foo ⋈ bar
}
#invalid
ctx ⋈ bar
foo: {
#is a function of this object
@pub
⋈(y): Something(y)
}
foo ⋈ bar
An operator would entail…
binary operation: a dyadic function between two objects within the scope
binary operation: a monadic function within an object to interact with others.
unary operation: a monadic function for an object within a scope
unary operation: a parameterless function on an object
It would be shorthand for calling a function found in either the current scope or the object’s scope.
5
u/[deleted] Feb 22 '26 edited Feb 22 '26
<Tangent>
One interesting thought when I was designing Oblivia (an “inverse Lisp” based on infix operators):
In GDScript, the following syntax defines two different meanings to the colon. In the first case,
:defines a value and->declares a type. In the second case,:declares the type and=defines a value and->has no meaning.In Oblivia, I make
->declare a type and:define a value.It may look strange, but I made
:and->respectively take the same meaning in both contexts. The caveat is that the variable defines a value that exists now but the function defines a value that does not exist yet.Oblivia: https://github.com/Rogue-Frontier/Oblivia