Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:105843 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 17923 invoked from network); 6 Jun 2019 10:41:55 -0000 Received: from unknown (HELO mail-lj1-f182.google.com) (209.85.208.182) by pb1.pair.com with SMTP; 6 Jun 2019 10:41:55 -0000 Received: by mail-lj1-f182.google.com with SMTP id v29so1078673ljv.0 for ; Thu, 06 Jun 2019 00:53:16 -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=b7Nhfpf3p8LHcQvZYeqztzjLT02f46BmOr7vJ83j6EE=; b=UmtNVwZr34CckXFFTqfuL2KeJoDc/ZXZ90rYli4YCbaoQXmgh0AcikytGcjSiPPRja 2CwwYAoE7EN1nvBlyLxBJGrXGjq98NKEqB1AmbcVBOUk2KJjHJgJp88rxtGd4dQZZqdb qjbu2EIPATiSNg4vkX2l0Kc3JNz5G6cPDmlAWgQ0l0yOyuSmCugLwFwQV+RrRNbT4ZIR GSx57WwoFgX2mdvPPBTCm6nnZ4FwO59hrLuwt1Af2L1eyUVV6/VOLsdG5YJHlhsqwRwG 73eyPK3WVVH7qHNz1IIYIWcSLXP01Qx4SFq8jNa1Aa9aj0JK2h047ZwIqzjI8W+35jvt 6rGQ== 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=b7Nhfpf3p8LHcQvZYeqztzjLT02f46BmOr7vJ83j6EE=; b=qz532binsFilpIkQ9XiC3DRVpMm/ZXu0fD9GnjDw1d19EFuU/eE0Dow9CHKfkaCeQW lXJLg0gfsrxBhb0mRvFh/fcYueZpWCd4JGbjsOv2SZKttSveOUhpsqriQGfzXfFUkuOJ KDwv9aGhUa2sot2O6vJm+NprVKcY0WPr7AyoJXwSdJnI/3X1aZbOi7D32P8DiLer/gSQ nJvcb1DBeYKCxkkAmBRUv1GFcTV4kAb3w98l89zvD5T2cGDrclX0H5wqEBpISqlDt6on TNuMQBUDYYZPpiAT9x1njV7tzPHqzzP/dnuNRbw2rTa2T+5/+lbbjq6flGBseh0RcGu3 pUdA== X-Gm-Message-State: APjAAAXqws7QeKkVBrTS4WjXmTfPVgOtOdnc+6erVkb/YELwMHwgINsm qeFe6ms/FjkehBO6hO0kw+owSTiWScYLyIA2sH8= X-Google-Smtp-Source: APXvYqyVgpydRNxcmerB18evgev7h1M6p5mvI1Djbx9d07uaJdRpumRHGJGtjErk8Q5b/jhETP/OUpY6fdBuBX1ZLVw= X-Received: by 2002:a2e:5dc4:: with SMTP id v65mr15622740lje.138.1559807595431; Thu, 06 Jun 2019 00:53:15 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: Date: Thu, 6 Jun 2019 09:52:57 +0200 Message-ID: To: Marco Pivetta Cc: Benjamin Morel , Steven Wade , PHP internals Content-Type: multipart/alternative; boundary="000000000000a4ccbb058aa30151" Subject: Re: [PHP-DEV] Add get_mangled_object_properties() From: nikita.ppv@gmail.com (Nikita Popov) --000000000000a4ccbb058aa30151 Content-Type: text/plain; charset="UTF-8" On Tue, May 14, 2019 at 4:45 PM Nikita Popov wrote: > On Tue, May 14, 2019 at 4:37 PM Marco Pivetta wrote: > >> >> On Tue, May 14, 2019 at 4:29 PM Benjamin Morel >> wrote: >> >>> I like the explicitness of the proposal, but only if performance is as >>> good >>> as (array) cast. One of the reasons we use casting to array in libraries >>> is >>> not only to access all properties at once, but also because it's fast as >>> it's implemented as an opcode and not a function call. Would this >>> function >>> come with its own opcode, like strlen() / gettype() / etc.? >>> >>> Ben >>> >> >> Indeed. Besides that, this is a good chance to have an explicit `object` >> parameter type. >> >> @Nikic is the return type also `array`, according to reflection? >> > > I'd prefer not to add either of them until the question of type > annotations on internal functions is solved more comprehensively in PHP 8. > In particular adding an "object" type will currently add additional cost to > the call. I hope that we'll solve this problem in PHP 8 and annotate > functions with types in a comprehensive way (including existing functions, > like get_object_vars). > > Nikita > Any more feedback on the addition of get_mangled_object_vars()? Regarding the typehints, I've added an "array" return type for get_object_vars() in PHP 8 ( https://github.com/php/php-src/commit/252216b2ded7d3808e2a909bfea1e805ee17cde5) and will do the same for this function. The argument type is still blocked on some preparatory work. Nikita --000000000000a4ccbb058aa30151--