Any idea how I can implement some keywords?

So that I can test them out too?

 

P. S. Sorry about so many suggestions; I had these for weeks, & only recently figured out tha std-proposals is for features other thatn library ones too.

 

From: Jason McKesson via Std-Proposals
Sent: 01 May 2022 22:00
To: std-proposals@lists.isocpp.org
Cc: Jason McKesson
Subject: Re: [std-proposals] requires keyword (new use)

 

On Sun, May 1, 2022 at 4:15 AM Abdullah Qasim via Std-Proposals
<std-proposals@lists.isocpp.org> wrote:
> int menu (/**/requires/**/ unsigned int menu_option = 0)
>
>
>
> // Called as:
>
> menu(default);
>
>
>
> // OR:
>
> menu(5)
>
>
>
> // Compiler Error: function "menu(unsigned int)" requires //unsigned int variable
>
> menu()
>
>
>
> I do not want calls like menu(), but I do want ability to call menu(default), as, in this case, going to default screen makes perfect sense.

So, you don't want the purpose of default parameters (ie: being able
to not provide an argument for that parameter), but you want certain
effects of default parameters (ie: having the function decide what the
parameter is).

So just take an `optional`:

```
int menu (std::optional<unsigned int> menu_option)
{
  if(!menu_option) menu_option = 0;
...
}
menu(std::nullopt);
menu(5);
menu(); //Does not work.
```

Also, please don't spam the list with dozens of "proposals" like this.
We would like proposals to be more considered than "here's an idea I
had". C++ is a rich and varied language with many tools. You need to
take time to understand what those tools are and how to use them
*before* you can effectively start suggesting what tools the language
ought to have.
--
Std-Proposals mailing list
Std-Proposals@lists.isocpp.org
https://lists.isocpp.org/mailman/listinfo.cgi/std-proposals