[BUG] Expression built-ins should be formalized
Describe the bug
Right now lines built-in forces user to use it with parentheses:
let var = lines(file) // OK
let var = lines file // Error: Variable 'lines' does not exist
However this does not apply to len
let var = len(file) // OK
let var = len file // OK
What should be done?
- [ ] A more precise error message saying that expression built-ins should be used with parentheses
- [ ] Set the same constraints to other expression built-ins
I found a problem with builtin statements that accept two parameters. Let's take an example of
mv. Here is how we can use move command:mv "old.txt" "new.txt"This is all fine untill we introduce a builtin that accepts two arrays for instance:
builtin variable [1] foo()The statement written above could be interpreted in both ways:
// A separate variable and a singleton array builtin variable [1] foo() // A subscript operator and function call that returns array builtin variable[1] foo()This leads me to the fact that we should require commas
,to separate the arguments:builtin variable, [1]This way we can clearly see that it's a separate argument. What are your thoughts?
_Originally posted by @Ph0enixKM in https://discord.com/channels/1235872011603939328/1243872082308366386/1382279840098684938
I think we should fix this by unifing syntax. All builtin functions should have function syntax echo("text") mv("from", "to") etc.
_Originally posted by @KrosFire in https://discord.com/channels/1235872011603939328/1243872082308366386/1382283591492309022
yes probably simplify the language, I think that we talked about it also with @hdwalters
_Originally posted by @Mte90 in https://discord.com/channels/1235872011603939328/1243872082308366386/1382287906340732978
Right... I think that ultimately this could simplify the language Because splitting builtins into statement builtins and expression builtins is an unnecessary waste of time for a new developer to get into Amber
_Originally posted by @Ph0enixKM in https://discord.com/channels/1235872011603939328/1243872082308366386/1382290650908725248