I make semicolon keys for living and I just wanna extend my market beyond C-like languages.
Author Note: Initial joke for relaxing angry people because of the title
A good and clear interpretation of semicolon in method definitions and calls, in my opinion, is that separate what is used in dispatch from what is an optional (keyword) parameter.
My proposal is to remove the optional use of semicolon when calling methods. But arguments before the semicolon will be treated just as current positional arguments and parameters after the semicolon like current keyword arguments.
So, what changes?
Well, now you can add some requested features like
or help in situations like
function fun(a, b = 2; c = 3, d = 4) # Bla bla good and type stable code end
Im personally here because I really hate situations like:
c = 1 # more code fun(1, 3; c = c) # (1)
This is redundant.
I currently do:
c_ = 1 # more code fun(1, 3; c = c_) # (2)
To diminish the pain a little
If the semicolons are mandatory, now, because the caller will explicitly say what it is a positional or an optional parameter you will be able to have
fun calls like:
fun(1, b = 3; c = 3, d = 4) # (3) # which current equivalent is fun(1, 3 [,;] c = 3, d = 4) # (4)
[,;] means comma or semicolon
# or c = 1 # more code fun(1, 3; c) # (5) # which current equivalent is fun(1, 3 [,;] c = c) # (6)
# or fun(1) # (7) # which current equivalent is fun(1) # (8)
# or fun(b = 1, a = 2; c = 3, d = 1) # (9) # or fun(a = 1, h = 2; c = 3, d = 1) # (10) # which current equivalent is # (...)
We may discuss if the names of the positional arguments are just sugar or must match the function definition, discussion in above link.
But, in my opinion, keeping explicit that dispatch is determined by order and type is important. The semicolon will be just doing that!
In the case of
(5) being better than
(2) I’m not really open to debate
Just like rigth now, the call
g = 1 fun(1, 2; g) # (11) # which current equivalent is fun(1, 2 [,;] g = g) # (12)
Must throw a
g is not a
I know this is a breaking proposal, so, it could be included in the 2.0 Milestone. Although, automatic ways of adding or warning the missing semicolons are possible, maybe in the 0.7 equivalent for 2.0.