Path: csiph.com!news.mixmin.net!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: Mon, 13 May 2024 19:43:37 -0700
Organization: A noiseless patient Spider
Lines: 31
Message-ID: <86cyppru3q.fsf@linuxsc.com>
References: <20240503180102.00002f98@yahoo.com> <86ikzqtwqr.fsf@linuxsc.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Injection-Date: Tue, 14 May 2024 04:43:38 +0200 (CEST)
Injection-Info: dont-email.me; posting-host="d3d11a13799ca555242a3163f5585561"; logging-data="4136765"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18BWhtiwBoxGuwkG4aGCfxmXQcOqTIU8iY="
User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.4 (gnu/linux)
Cancel-Lock: sha1:BCjmGYGu45mMPO6THbH1ujSw48c= sha1:2/5rIF4YFNybYJyOJg4gddWWnWY=
Xref: csiph.com comp.lang.c++:119104
Paavo Helde writes:
> On 07.05.2024 01:13, Tim Rentsch wrote:
>
>> Paavo Helde writes:
>>
>>> On 04.05.2024 01:20, Lawrence D'Oliveiro wrote:
>>>
>>>> On Fri, 3 May 2024 18:01:02 +0300, Michael S wrote:
>>>>
>>>>> For C, I agree, mostly because C has no nested functions.
>>>>
>>>> GCC implements nested functions in the C compiler. Though
>>>> oddly, not in C++.
>>>
>>> C++ already has functions nested in namespaces, namespaces nested in
>>> namespaces, functions nested in classes (static and non-static
>>> member functions), and classes nested in classes. It's already a
>>> lot of nesting, no need to complicate the matters more.
>>
>> C++ doesn't need nested functions because it has lambdas, which
>> are effectively equivalent.
>
> Lambdas are better than nested functions as one can specify explicitly
> which variables are shared and how. One can be lazy and pass [&], but
> one doesn't have to.
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.