Path: ...!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!eternal-september.org!.POSTED!not-for-mail From: Janis Papanagnou Newsgroups: comp.lang.c Subject: Re: Which code style do you prefer the most? Date: Sun, 2 Mar 2025 06:48:19 +0100 Organization: A noiseless patient Spider Lines: 53 Message-ID: References: <87frk10w51.fsf@onesoftnet.eu.org> <87o6ykw7f9.fsf@nosuchdomain.example.com> MIME-Version: 1.0 Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit Injection-Date: Sun, 02 Mar 2025 06:48:52 +0100 (CET) Injection-Info: dont-email.me; posting-host="8c02968d6ac486d6e38c8e21a5663432"; logging-data="703097"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18g9rJKLgQzhzuN+oirhZMK" User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.8.0 Cancel-Lock: sha1:Y0UeFnx3nAFP+RkaNNk5HEkCRQY= In-Reply-To: <87o6ykw7f9.fsf@nosuchdomain.example.com> Bytes: 3498 On 02.03.2025 02:24, Keith Thompson wrote: > Janis Papanagnou writes: >> On 01.03.2025 23:20, Lawrence D'Oliveiro wrote: >>> On Sat, 1 Mar 2025 21:32:59 +0100, Janis Papanagnou wrote: >>>> My guess is that this form is just an informal syntax mimicking Perl's >>>> function parameter passing ... >>> >>> The idea of passing arguments by keyword predates Perl. >> >> That wouldn't surprise me. - I know it from Perl. - Which other >> (earlier) languages do you have in mind? - What's its origin? > > For example, it exists in Ada since 1983. [...] Back these day I had just a peek into Ada, never programmed with it. (It appears to me to have it supported very nicely.) > > The syntax is IMHO much nicer than using /*...*/ comments in C. I think the "C"-comments are horrible, especially for that purpose; I'd never do it that way. (Though, I understand the individual impetus to mimic unsupported features known from other languages.) > [...] > > Perl doesn't have keyword arguments as a language feature, but it can be > mimicked by passing hash or hash reference. Yes, that's how I perceived it. As a syntax pattern it's okay, IMO. At least it's functional and not only informal (as with comments). > > If I wanted to annotate arguments with parameter names, I'd probably use > aligned // comments with the name at the end of the line: > > confection = prepare_carefully_according_to_detailed_recipe( > flat, // pan > clarified_butter, // line_with > something_yummy, // filling > lotsa_pastry, // cover_with > 90 * MINUTES // bake_for > ); > > In practice, I seldom do so unless there's direct language support. Yep. And thanks for the hint to Ada. Janis