Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.c++ > #119604 > unrolled thread

Re: Named arguments in C

Started byMichael S <already5chosen@yahoo.com>
First post2024-07-04 15:36 +0300
Last post2024-07-04 15:36 +0300
Articles 1 — 1 participant

Back to article view | Back to comp.lang.c++

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re: Named arguments in C Michael S <already5chosen@yahoo.com> - 2024-07-04 15:36 +0300

#119604 — Re: Named arguments in C

FromMichael S <already5chosen@yahoo.com>
Date2024-07-04 15:36 +0300
SubjectRe: Named arguments in C
Message-ID<20240704153640.00006c58@yahoo.com>
On Thu, 4 Jul 2024 15:02:49 +0300
Michael S <already5chosen@yahoo.com> wrote:

> On Thu, 4 Jul 2024 13:12:18 +0200
> Bonita Montero <Bonita.Montero@gmail.com> wrote:
> 
> > Am 02.07.2024 um 18:53 schrieb Ivan Farlenkov:  
> > >> I am a fan of being able to name parameters in languages that
> > >> allow it. I am quite confident that this will never come to C.
> > >> It /might/ make it into C++, but as people have been writing
> > >> proposals to do so for 20 years at least, I am not holding my
> > >> breath.    
> > > You can sort of already do it in C by using designated
> > > initializers and macros
> > > #define foo(A, B, C, ...) do{\
> > >      stuct technical technical={\
> > >          var1=default1,\
> > >          var2=default2,\
> > >          var3=default3 __VA_OPT__(,)\
> > >          __VA_ARGS__\
> > >      }\
> > >      actual_foo(A, B, C, technical.var1, technical.var2,
> > > technical.var3)\ }while(0)    
> > 
> > What an anquated language that this needs macros.
> >   
> 
> I don't suppose that somebody likes this macro stuff or takes it
> seriously. It's just a PoC.
> But at least we can imagine how named call arguments can be added to
> "antiquated language" if The Committee decides to do so. It would not
> be easy, but clash with other language features is avoidable.
> Not so with "modern language" that your like. For "modern language"
> the clash with other [mis]features will be unavoidable and fatal.
> 

On the second thought.
I can think about the way of adding named arguments to "modern
language". But the way I am thinking of is an equivalent of creation of
new declaration/call syntax in parallel with existing syntax. It would
require two new keywords. It will make every declaration and call a
word longer. 
None of that is strictly required for addition of named arguments to
"antiquated language" although addition of new keyword for declaration
(but not for calls!) is not necessarily a bad idea.

> [O.T.]
> If I am not mistaken "modern language" is so twisted that it can't
> even have proper designated initializers for struct (proper =
> arbitrary order). I don't know what is the reason for that, but the
> reason exists.
> 

[toc] | [standalone]


Back to top | Article view | comp.lang.c++


csiph-web