(cross posting my discord post) ![]()
I have said it a few times already and probably nothing will change but I will not give up yet so here we go:
obj[...]syntax is “legacy” and should be removed!

Please repeat with me ![]()
obj[...]syntax is “legacy” and should be removedobj[...]syntax is “legacy” and should be removedobj[...]syntax is “legacy” and should be removed
Reasons
it is confusing for developers (collision with mojo function parameters)
it is confusing for AI (which will probably write most of the code in the future)- deviation from the official mojo function anatomy
The anatomy of a mojo function is
def hello[params](args)
which can be used as:
hello[3]("world")hello("world")hello()
Note: [...]is always a parameter and (...) is always an argument and required to call a function!
We programmers we have many principles/best pratices and designs like “keep it simple”, “consistency” and more but then create
data[idx]

which violates everything
[idx]argument used where parameters should be!
()actual function call missing
- Additional side note: Terrible IDE support (same for most/all other langs). Not discoverable with the other functions (hitting
.and exploring). No hover documentation. Not autocomplete…
At the moment is feels like a second, separate function world is created which IMO is very unfortunate and confusing:
data[123]data[abc=5]data[x=-1]- …
Suggestion
Use the defined anatomy of a mojo function call everywhere and consistently!
data[0]→data.get(0)
Don’t worry about the extra 4 letters. Instead we get in return- consistent mojo function syntax!!!
- better IDE support (discoverability, docs, autocomplete, …)
- AI will write most of the code anyways
