Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:103296 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 68978 invoked from network); 1 Oct 2018 17:06:30 -0000 Received: from unknown (HELO mail-io1-f66.google.com) (209.85.166.66) by pb1.pair.com with SMTP; 1 Oct 2018 17:06:30 -0000 Received: by mail-io1-f66.google.com with SMTP id y3-v6so9333073ioc.5 for ; Mon, 01 Oct 2018 06:15:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=DXOa8Ok8HkPmHS5ztBzl9dTBCkOiQC4C1i7YZyv4ujI=; b=doVEgcz1A1KY0z4bzKYck/tF+sQZEZCRICMiTrOz5lnV/18VqckvCl/guHbSqsfVg9 925pa/4oHlhL+fAmJqgY+jiN+w82mkfQHB+ZXBxN7/Pf4w0NNnp0DSbD6vzE17KSfUkJ C1DIu70jWTocQV8RMMo5D7VafgN0dDL9LcbCL25HoJsszknsuOFkmy+ESuWN9HK6+TpP o3aqNx5+xrG9qfHrfW4EZNf+TZoPeuzYfYxWVHFrCr9BcoNr0btQDsKKZ6XnY8EqsZ8B UJGrhSmC644RNrU83I0Q1PepB1CMzp3CRkAcK3/89iDEqWSMtNc6PQZYv7MlDJgKtXe9 aNag== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=DXOa8Ok8HkPmHS5ztBzl9dTBCkOiQC4C1i7YZyv4ujI=; b=FvWyu/3THJvTdviGpspND2CHYeSb/UiCy7VLMEFOlvCI+zCE61pWMHLZu14+w8b0fv 8re9/v388hCo3hL9QOY8Bk4ofFW9k8hw0Kg5DH4t+YVNMtunIRR4zxz4FEDQ3eBAqq1Z acE0lQslW8/IHjxdc82RAclAnsAv1s9noTOFPZOyk0rQMoobyUz7ezyCaXVs7jrXmd0Q EEd3pC9yLhR0huTu+zRw5al5U8wj4m/0qWaeupPe87j5SP3MutL7YqzqcYQGjD3O73st mOezqIkcNfPpjW5Xj8v5c9AwuDSAAZ3mmJpfO/wa7hQROh7hXzS5HidYbdZwSQvg+1JC tk8w== X-Gm-Message-State: ABuFfojsGSuQTeM5xizwJocTgVi3Lahnw8VYbZVMTeb3oYUedAkeO8Bp FIDO4fNV/ZEC6jrt23Fj5w3m7IWeYhfgK0oU/Xs= X-Google-Smtp-Source: ACcGV60MAI/Iw7pbIS2a8D2ygCSh2YsvKomqYs3ugerHTQNwSWUKyW1kLpz467HCWI8akBVitJ3uG70ru7mmpPKLR5g= X-Received: by 2002:a6b:900a:: with SMTP id s10-v6mr6603337iod.231.1538399752801; Mon, 01 Oct 2018 06:15:52 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: Date: Mon, 1 Oct 2018 14:15:41 +0100 Message-ID: To: marcospassos.com@gmail.com Cc: PHP internals Content-Type: multipart/alternative; boundary="000000000000c9d1dd05772a9a42" Subject: Re: [PHP-DEV] Class name resolution for \array::class From: rowan.collins@gmail.com (Rowan Collins) --000000000000c9d1dd05772a9a42 Content-Type: text/plain; charset="UTF-8" On Mon, 1 Oct 2018 at 13:24, Marcos Passos wrote: > > You can also see it as a language construct that expects a type at the > left-hand side of the name resolution operator. In that sense, primitive > types are perfectly valid. > While I can see that as an interpretation, it doesn't make a lot of sense: - the keyword "class" implies that this will always return a class name; it is the static equivalent of get_class(), which does not support non-objects - if instead it was resolving a "type", you might expect it to return the same values as gettype(), which for any object is simply the string "object" - the main purpose of the feature is to resolve namespace lookups and aliases, but basic types are not subject to namespaces; in other words, "int::class" can only ever return "int" As Marco says, if you have a use case where allowing this is helpful, please share it, and we can discuss if this, or some new related feature (e.g. "array::type"), would be worth supporting. Regards, -- Rowan Collins [IMSoP] --000000000000c9d1dd05772a9a42--