Path: csiph.com!news.swapon.de!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: Tim Rentsch
Newsgroups: comp.lang.c++
Subject: Re: Threads across programming languages
Date: Tue, 21 May 2024 19:26:11 -0700
Organization: A noiseless patient Spider
Lines: 46
Message-ID: <86msoiwpj0.fsf@linuxsc.com>
References: <20240503180102.00002f98@yahoo.com> <86ikzqtwqr.fsf@linuxsc.com> <86cyppru3q.fsf@linuxsc.com> <20240515142403.00000a7c@yahoo.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Injection-Date: Wed, 22 May 2024 04:26:13 +0200 (CEST)
Injection-Info: dont-email.me; posting-host="ef527a1f0ace8b0bcb46bd1e68f4f6ae"; logging-data="1048813"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18VS0Ff1r63AepL5BdlGeKW3FMezozmMEo="
User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.4 (gnu/linux)
Cancel-Lock: sha1:exhOEofaWGd67g2k4YIkqfM5oJ4= sha1:y19LGzGJZ/jGaSB4RaoYcwGBxeI=
Xref: csiph.com comp.lang.c++:119272
Michael S writes:
> On Tue, 14 May 2024 13:53:02 +0300
> Paavo Helde wrote:
>
>> On 14.05.2024 05:43, Tim Rentsch wrote:
[comparing lambdas and nested functions]
>>> To me that sounds like all the complications of nested functions,
>>> and more besides, and no real advantages. The choice of which
>>> variables to share is syntactic sugar, there is no difference
>>> in expressive power.
>>
>> Most of what programming languages do is syntactic sugar. For
>> just writing Turing complete code one programming language would
>> be enough.
>
> As far as I am concerned, the two most important thing that
> programming languages do are:
> 1 - helping programmer to not repeat himself
> 2 - automation of common tasks, which is also sort helping
> programmer to not repeat, but in this case to not repeat somebody
> else rather than himself
>
> These two are nutrients. The reset is sugar that can or can not
> improve productivity during later phases of maintenance, but does
> nothing to improve productivity during initial development and
> debugging. You can be right that sugar constitutes the bulk of
> the volume of programming language, but it does not make it more
> important than vital things.
Two comments. One, I think your list of two things is short
changing some other attributes that are important, but this
question is a much larger topic so for now I will leave it there.
Two, I think it's important to understand that by the term
"syntactic sugar" I mean only a thin syntactic layer over
existing functionality. To illustrate, a while() statement can
be viewed as syntactic sugar over a for() statement, but nested
functions are not just syntactic sugar over ordinary C functions,
or even over methods in C++. (I am using "nested functions" as
more or less synonymous with lambda expressions.) Whether
something is or isn't syntactic sugar is not the same as whether
it adds something useful to the language; for example, I know
that while() statements can be written using for(), but having
while() in the language still adds linguistic utility, even
though it's just syntactic sugar.