> Am 14.01.2024 um 23:58 schrieb Robert Landers :
>
> Hello Internals,
>
> After much thought and deliberation, I've updated the nameof RFC
> (https://wiki.php.net/rfc/nameof) to reflect most of this discussion
> and refine a few edge cases regarding objects. TL;DR: there are a few
> rules rega
Hello Internals,
After much thought and deliberation, I've updated the nameof RFC
(https://wiki.php.net/rfc/nameof) to reflect most of this discussion
and refine a few edge cases regarding objects. TL;DR: there are a few
rules regarding how properties of objects are addressed that I hope a
few peo
> Using a :: pseudo-constant suffix rather than a ()-based construct would help
> with the syntax clumsiness in both cases, but wouldn't entirely eliminate it.
> I don't have a really great answer here, unfortunately. I think I'd
> marginally prefer a ::name suffix at this point just for synta
On Thu, May 25, 2023, at 3:21 PM, Robert Landers wrote:
> On Tue, May 16, 2023 at 11:56 PM Larry Garfield
> wrote:
>>
>> On Sat, May 13, 2023, at 7:27 AM, Robert Landers wrote:
>> > Hello Internals,
>> >
>> > It is with much trepidation and excitement that I'd like to announce
>> > the `nameof` R
> use function \my\space\my_action_function;
> Router::addRoute(nameof(my_action_function));
> Router::addRoute(nameof(MyClass::actionMethod(...)));
My mistake, this should be:
> use function \my\space\my_action_function;
> Router::addRoute(nameof(my_action_function));
> Router::addRoute(MyClass:
On Tue, May 16, 2023 at 11:56 PM Larry Garfield wrote:
>
> On Sat, May 13, 2023, at 7:27 AM, Robert Landers wrote:
> > Hello Internals,
> >
> > It is with much trepidation and excitement that I'd like to announce
> > the `nameof` RFC (https://wiki.php.net/rfc/nameof). It has changed
> > quite a bi
On Sat, May 13, 2023, at 7:27 AM, Robert Landers wrote:
> Hello Internals,
>
> It is with much trepidation and excitement that I'd like to announce
> the `nameof` RFC (https://wiki.php.net/rfc/nameof). It has changed
> quite a bit in the last couple of days, so if you haven't seen the
> latest draf
Op ma 15 mei 2023 om 20:06 schreef Rowan Tommins :
>
> On 15 May 2023 14:07:31 BST, Lydia de Jongh wrote:
> >> ...
> >> #[SomeAttribute(callback: nameof(\Acme\bar(...))]
> >> ...
> >
> >This callback to nameof(). is really terrible 😣😣
>
> Just to be clear, the "callback:" in that example is e
> 3v4l.org is great for verifying things like this, because you can see at a
> glance if there's been a change in behaviour in previous versions, or indeed
> versions newer than you have installed. If you've got an up to date PhpStorm,
> you can actually use it directly from a scratch file. (Hug
On 15 May 2023 19:26:09 BST, Robert Landers wrote:
>php -a
>Interactive shell
>
>php > use \NoExists\Channel;
>php > echo Channel::class;
>Channel
>
>Turns out, it's a CLI specific thing
Ah, probably each line in the interactive shell is considered a separate
compilation context, like a separat
On Mon, May 15, 2023 at 8:18 PM Rowan Tommins wrote:
>
> On 15 May 2023 18:44:47 BST, Robert Landers wrote:
> >use const \NoExist\TEST;
> >use \NoExist\Channel;
> >echo TEST;
> >echo Channel::class;
> >
> >the output is:
> >
> >Undefined constant "TEST" in ...
> >Channel
>
> I'm not sure how you
On 15 May 2023 18:44:47 BST, Robert Landers wrote:
>use const \NoExist\TEST;
>use \NoExist\Channel;
>echo TEST;
>echo Channel::class;
>
>the output is:
>
>Undefined constant "TEST" in ...
>Channel
I'm not sure how you got that; according to https://3v4l.org/gltKN only PHP 5.6
has a message with
On 15 May 2023 14:07:31 BST, Lydia de Jongh wrote:
>> ...
>> #[SomeAttribute(callback: nameof(\Acme\bar(...))]
>> ...
>
>This callback to nameof(). is really terrible 😣😣
Just to be clear, the "callback:" in that example is existing syntax for named
parameters, not part of the nameof() synta
> I totally agree with Rowan. In many (most?) cases you need the fully
> qualified name.
> Even or especially for error handling! Of course mostly the error is
> somewhere else. But you want to know the starting point. An
> unqualified name gets you nowhere. Although backtrace can help you
> out.
>
(I hope it is ok that I take parts from several mails)
Op za 13 mei 2023 om 12:37 schreef Rowan Tommins :
> On 13 May 2023 10:04:39 BST, Lydia de Jongh wrote:
>
> >I prefer a magic constant like `::name` instead of a function call as it
> >can be used in a wider scope; for example as a parameter
> Conversely, namespace imports are entirely local to the current file (or even
> a namespace{} block), and it's almost impossible for running code to see
> anything other than the expanded name.
>
> That doesn't mean that there aren't good reasons to have nameof() handle both
> things in the wa
On 14 May 2023 11:59:13 BST, Robert Landers wrote:
>As someone who has had limited interaction with the engine code itself
>but has been using PHP, daily, for nearly 15 years, I'm not sure this
>technical distinction makes sense in the context of programming in
>PHP. When using traits, I don't thi
On Sun, May 14, 2023 at 11:16 AM Rowan Tommins wrote:
>
> On 13 May 2023 16:40:27 BST, Robert Landers wrote:
> > Most of the time, you want the unqualified name
> > ...
> >This is especially important when using traits and aliases:
>
> I don't think trait renaming is the same thing as aliasing a
On 13 May 2023 16:40:27 BST, Robert Landers wrote:
> Most of the time, you want the unqualified name
> ...
>This is especially important when using traits and aliases:
I don't think trait renaming is the same thing as aliasing a qualified name. In
a sense, it's actually the opposite: with a trai
On Sat, May 13, 2023 at 11:05 AM Lydia de Jongh wrote:
>
> Wow! Yess please. My mail yesterday crossed yours, I guess (thanks Claude
> for answering)
> asking for almost the same:
>
> myClass::$normalProperty::name
>
> So I would like to add my thoughts to your proposal.
>
> I prefer a magic const
On Sat, May 13, 2023 at 5:58 PM Robert Landers wrote:
>
> > Can you provide more details on what the error conditions are? I can
> > see 'non-existent static variable' and 'non-existent variable', are
> > there others?
>
> Absolutely! I'll add it to the RFC later tonight, but the gist is that
> it
On Sat, May 13, 2023 at 5:18 PM Niels Dossche wrote:
>
> On 13/05/2023 09:27, Robert Landers wrote:
> > Hello Internals,
> >
> > It is with much trepidation and excitement that I'd like to announce
> > the `nameof` RFC (https://wiki.php.net/rfc/nameof). It has changed
> > quite a bit in the last c
> Can you provide more details on what the error conditions are? I can
> see 'non-existent static variable' and 'non-existent variable', are
> there others?
Absolutely! I'll add it to the RFC later tonight, but the gist is that
it would be exactly the same as if you were to call any function with
> The one part of the RFC that surprised me was this:
>
> > When getting the name of constants and functions, the name will NOT be the
> > full name, but the lexical name. This means that if the name is use'd, it
> > will be that name. However, if the full name is used in the nameof(), the
> > f
On 13/05/2023 09:27, Robert Landers wrote:
> Hello Internals,
>
> It is with much trepidation and excitement that I'd like to announce
> the `nameof` RFC (https://wiki.php.net/rfc/nameof). It has changed
> quite a bit in the last couple of days, so if you haven't seen the
> latest draft, please ch
On Sat, 13 May 2023 at 08:27, Robert Landers wrote:
>
> Hello Internals,
>
> It is with much trepidation and excitement that I'd like to announce
> the `nameof` RFC (https://wiki.php.net/rfc/nameof).
Can you provide more details on what the error conditions are? I can
see 'non-existent static var
On 13 May 2023 10:04:39 BST, Lydia de Jongh wrote:
>I prefer a magic constant like `::name` instead of a function call as it
>can be used in a wider scope; for example as a parameter in an Attribute.
Don't confuse the syntax with the implementation: "::class" isn't actually a
constant, and the
Wow! Yess please. My mail yesterday crossed yours, I guess (thanks Claude
for answering)
asking for almost the same:
myClass::$normalProperty::name
So I would like to add my thoughts to your proposal.
I prefer a magic constant like `::name` instead of a function call as it
can be used in a wider
Hello Internals,
It is with much trepidation and excitement that I'd like to announce
the `nameof` RFC (https://wiki.php.net/rfc/nameof). It has changed
quite a bit in the last couple of days, so if you haven't seen the
latest draft, please check it out.
Essentially, it allows using `nameof()` an
29 matches
Mail list logo