Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:111496 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 45803 invoked from network); 12 Aug 2020 20:01:23 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 12 Aug 2020 20:01:23 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 4D0DD180550 for ; Wed, 12 Aug 2020 12:01:06 -0700 (PDT) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on php-smtp4.php.net X-Spam-Level: X-Spam-Status: No, score=-0.7 required=5.0 tests=BAYES_05,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE, SPF_PASS autolearn=no autolearn_force=no version=3.4.2 X-Spam-Virus: No X-Envelope-From: Received: from mail-ej1-f49.google.com (mail-ej1-f49.google.com [209.85.218.49]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by php-smtp4.php.net (Postfix) with ESMTPS for ; Wed, 12 Aug 2020 12:01:05 -0700 (PDT) Received: by mail-ej1-f49.google.com with SMTP id f24so3449695ejx.6 for ; Wed, 12 Aug 2020 12:01:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=etp/zj1hAfAGp31dS0RdII8+wNN3frzR8IQArVw6dpw=; b=ounfDWukREpMu3djk1S6ksAEfarCyQHA+RrseDgTlkHMbyjcNfKXXo38A2l4PDhT+U iBV/yq6lwNERkdt/qYBfMCIfLL/FElFC31AboZiu6YKZ0g/wIMhCOWQtWq9feTcq4wZL fSGN9gPH56wylavDQV9Bg1yIcPPkyJ11k2NnMTe3oEpnFlHI8DmOLZgFYwoejmdyUj2O zVkN6zVsPYSPMjN/sMmK31O74n9xll0t1Pi713WbjODPZr3iJIAgpL4axLzbopiizUQV nj+JPPVvuGDYtMvFNQ/oflc7RihUZWDuK+T7/eDbq8obj9D728/isEbNGenB/xLAw2n2 g9/Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=etp/zj1hAfAGp31dS0RdII8+wNN3frzR8IQArVw6dpw=; b=fBipPRKJ8BFqCDC5SO+ADMexh5AEfpzQJNdxFxcFLJXwjHySu877inmsoKeORIJDiQ KzaXyKPq5OmSuhPJQ0ggqdlx0mkmd1OI6u0LiSHvqO51pegBWOYrgbauIo4fGpat3lV6 ou1PxPwbW8NPZYAqGaWgTtiBK3BGqD4MqOElMOs1vwhYOiMynN6Ghp9l9s2M/0IuXyKn a8ZquY3dXPFE26DBUQ+irsXXpPB56gjEt/CWXB3J6j9jt1fg3pVgLTmQWpDgJFAwYvbI soRIl0yoIUNvRm4wmXcaB5yci3qAxp0gV+eLy+e5DXnLbt+guD+1wG/mefyoCTQNlk/G dkNA== X-Gm-Message-State: AOAM532ls+ctX3Ed3DxOb1TkjfBo5jYkn/K0KKy7bExl4z+VqTtbxj5B 6m9fY4sc5Osg6qhKWk/F4U3wNLtA X-Google-Smtp-Source: ABdhPJxQITt5Hq/dB6kvXKloflerbWi1PBJdlP3Vdnftggm6xq7qQZ+btjxlvYh/MCctCwtQP5c1Zg== X-Received: by 2002:a17:906:1911:: with SMTP id a17mr1148989eje.431.1597258860675; Wed, 12 Aug 2020 12:01:00 -0700 (PDT) Received: from claude.fritz.box ([89.249.45.14]) by smtp.gmail.com with ESMTPSA id n11sm1974326edv.39.2020.08.12.12.00.59 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Wed, 12 Aug 2020 12:00:59 -0700 (PDT) Content-Type: text/plain; charset=utf-8 Mime-Version: 1.0 (Mac OS X Mail 13.4 \(3608.120.23.2.1\)) In-Reply-To: <641541597256204@mail.yandex.com> Date: Wed, 12 Aug 2020 21:00:58 +0200 Cc: "internals@lists.php.net" Content-Transfer-Encoding: quoted-printable Message-ID: References: <641541597256204@mail.yandex.com> To: Luis - SoftSAT Sistemas X-Mailer: Apple Mail (2.3608.120.23.2.1) Subject: Re: [PHP-DEV] Nested functions From: claude.pache@gmail.com (Claude Pache) > Le 12 ao=C3=BBt 2020 =C3=A0 20:19, Luis - SoftSAT Sistemas = a =C3=A9crit : >=20 > In the effort to make PHP a better language i want to ask why not = "fix" nested functions as suggested in = (https://wiki.php.net/rfc/true-nested-function-support) or block their = usage? > The current behavior is a lot unexpected.=20 >=20 > I am new here, sorry if it was already discussed, i can't find a good = way to search the mailing history. >=20 Hi, Defining a global function inside another function is not useless. Here = is a dummy example: ```php // a.php spl_autoload_register(function ($classname) { if ($classname =3D=3D=3D 'Foo\\B') require 'foo/b.php'; }) // foo/b.php namespace Foo; class B { // ... } function some_helper(....$args) { // ... } ``` The global function `Foo\some_helper` is defined inside the function = used as autoloader. Also, from the RFC: > They exist in the global namespace. I think you meant =E2=80=9CThey exist in the global scope=E2=80=9D? = because they are defined in the namespace corresponding to the eventual = `namespace` declaration of the file. =E2=80=94Claude=