As a Roblox developer, it is currently very space-inefficient to create default function arguments. Currently, a minimum of three lines must be added per default argument, which can equate to a large amount of space within a library or utility. This additionally is much harder to read.
If Roblox is able to address this issue, it would improve my development experience because it would allow me to quickly, and easily declare default arguments in a function without the need for many extra lines, and would improve the readability of scripts.
I believe default argument declaration should follow this syntax, as it feels most lua-like to me, and meshes with luau type declaration:
function(argument1, argument2="abc", argument3, ...)
-- Code
end
With luau type checking it could simply follow the same syntax as variable type declarations:
local myVariable: type = "Abc"
This would be equivalent to the following:
function(argument1, argument2, argument3, ...)
if argument2 == nil then
argument2 = "abc"
end
-- Code
end
This takes up a lot of extra space, and takes longer to write. I often end up copy-pasting those three lines in a lot of my scripts, which, while it’s slightly faster, I can’t easily reserve my clipboard for other things I may need it for, and it still takes up 3 extra lines of code for this logic.