r/ProgrammingLanguages • u/Relevant_South_1842 • Mar 17 '26
Unified calling and field lookup
I am considering unifying field lookup and calling/message passing
so instead of math.utils.max 5 6
I write math utils max 5 6
```
math :
utils :
max : [ a b | if a > b, a, b]
proto :
#call : ”if there’s a field here return the field object, if not then call”
```
Each object is callable.
Is this a terrible idea? Any prior art I can look at?
5
Upvotes
View all comments
Show parent comment
2
u/sol_runner Mar 18 '26
Take a look at SmallTalk's syntax. Messages with parameters are written differently
Usually something like
Where the message is
maxOf:and:There's 3 types of messages, and that's everything in SmallTalk.math utils)a < b)if: x > 3 then: y else: x)With commas you're just trading periods with commas.