On Thu, Feb 02, 2023 at 05:28:03PM +0000, Bram Moolenaar wrote:
> 3. Add a mechanism to name the members in the call, e.g.
>       var obj = Class.new(line = 5, column = 0)
>    This is similar to 2. but puts it in one line.
>    It requires marking a method to not use positional arguments.a
> 
> Although 3. looks like a good solution, it requires implementing a new
> mechanism.  And disallowing positional arguments might be considered
> weird, I cannot think of a language that has this functionality.

Python lets you declare that a function will not accept positional
arguments:

    def fn(*, line, column, also_arg_with_a_default_value=42):
        ...

    fn(line=5, column=0)
    fn(column=0, line=5)
    fn(0, 5)    # <-- error, positional arguments not allowed
    fn(line=5)  # <-- error, 'column' argument is required

Marius Gedminas
-- 
I can barely exit nano.
        -- Christian Neukirchen

-- 
-- 
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups 
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to vim_dev+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/vim_dev/20230203115840.ok4vynyj7z724wpn%40blynas.

Attachment: signature.asc
Description: PGP signature

Raspunde prin e-mail lui