Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:85865 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 25481 invoked from network); 18 Apr 2015 21:15:42 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 18 Apr 2015 21:15:42 -0000 Authentication-Results: pb1.pair.com smtp.mail=smalyshev@gmail.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=smalyshev@gmail.com; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.192.171 as permitted sender) X-PHP-List-Original-Sender: smalyshev@gmail.com X-Host-Fingerprint: 209.85.192.171 mail-pd0-f171.google.com Received: from [209.85.192.171] ([209.85.192.171:33005] helo=mail-pd0-f171.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 93/70-19122-D79C2355 for ; Sat, 18 Apr 2015 17:15:42 -0400 Received: by pdbnk13 with SMTP id nk13so164759642pdb.0 for ; Sat, 18 Apr 2015 14:15:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=message-id:date:from:user-agent:mime-version:to:subject:references :in-reply-to:content-type:content-transfer-encoding; bh=5pe4c2EGEGqllc18j6SRHs1YU2pCC7KORadAuieKxLU=; b=qdiSI7cjNf7ATecK/islcZK05bMWN4UnrEphYic9JMMLya/T9p4j5+EiHRqbRF4qPb RGQPdus0sDop2zML7vzjvDfQY37qC7dqbjtv3wmHFo8cecCzhFE2Sex6K/ZIWvuOUmiP GjZgl793b7mQPxcVCv597ouHVy4SxWmry/1cIAlkEfxiiutnkb2RE1s/b+ZeHs2hdn4R DGDZ9yeRmcbz2Hlt6f8V6Av/64t0Mk1KH7smxUVrnKuOWkz6duzKuU/S4taoSgsVc4CG +K4lAH4WICQlgO6OgO8ot0zYsFEJDy2mVTyIKP7OpRf7D9GlxFuXtsMNNUQVrHhi1LZZ D8Nw== X-Received: by 10.67.7.162 with SMTP id dd2mr15673260pad.151.1429391738401; Sat, 18 Apr 2015 14:15:38 -0700 (PDT) Received: from [192.168.2.102] (108-66-6-48.lightspeed.sntcca.sbcglobal.net. [108.66.6.48]) by mx.google.com with ESMTPSA id rd10sm13740856pbc.44.2015.04.18.14.15.37 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 18 Apr 2015 14:15:37 -0700 (PDT) Message-ID: <5532C978.7030009@gmail.com> Date: Sat, 18 Apr 2015 14:15:36 -0700 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.9; rv:31.0) Gecko/20100101 Thunderbird/31.6.0 MIME-Version: 1.0 To: georges , PHP Internals References: In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Subject: Re: [PHP-DEV] RFC: spl_autoload_register() should provide kind of entity to load From: smalyshev@gmail.com (Stanislav Malyshev) Hi! > Currently spl_autoload_register() pass the name of the class entity to the > first *Callable* argument​, but there is now way (as i far i know) to know > what kind of entity we're looking for. > -Class ? > -Interface ? > -Trait? I'm not sure it would be very useful for the engine. It is obviously useful for your particular naming scheme, but most people do not use this scheme, so this is not very common use case. I'd even argue it usually not the best practice, as class and interface names may be used interchangeably in typed parameters, return types, instanceof checks, etc. and one could convert class to interface easily without breaking anything (except your naming scheme). Also, while in the many common cases it is known which entity is required, there's no guarantee it is known in all cases and I'm pretty sure there could be cases where it's not known - in fact, zend_lookup_class() API has only the name as its input. -- Stas Malyshev smalyshev@gmail.com