r/ProgrammingLanguages • • 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

17 comments sorted by

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

math utils maxOf: 5 and: 6

Where the message is maxOf:and: There's 3 types of messages, and that's everything in SmallTalk.

  • Unary ( math utils )
  • Binary ( a < b )
  • Keyword ( if: x > 3 then: y else: x )

With commas you're just trading periods with commas.

1

u/Relevant_South_1842 Mar 18 '26

Thank you 😊