Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:72577 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 64801 invoked from network); 14 Feb 2014 01:02:43 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 14 Feb 2014 01:02:43 -0000 Authentication-Results: pb1.pair.com header.from=johannes@schlueters.de; sender-id=unknown Authentication-Results: pb1.pair.com smtp.mail=johannes@schlueters.de; spf=permerror; sender-id=unknown Received-SPF: error (pb1.pair.com: domain schlueters.de from 217.114.215.10 cause and error) X-PHP-List-Original-Sender: johannes@schlueters.de X-Host-Fingerprint: 217.114.215.10 mail.experimentalworks.net Received: from [217.114.215.10] ([217.114.215.10:46467] helo=mail.experimentalworks.net) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id BB/20-09050-23B6DF25 for ; Thu, 13 Feb 2014 20:02:43 -0500 Received: from [192.168.2.31] (ppp-88-217-65-62.dynamic.mnet-online.de [88.217.65.62]) (using TLSv1 with cipher ECDHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) (Authenticated sender: johannes@schlueters.de) by mail.experimentalworks.net (Postfix) with ESMTPSA id C09683FE91; Fri, 14 Feb 2014 02:03:19 +0100 (CET) To: Kevin Ingwersen Cc: Nikita Popov , internals In-Reply-To: <60CCD000-56E9-400D-A1AF-029E45B4338B@googlemail.com> References: <1392332641.3990.109.camel@guybrush> <60CCD000-56E9-400D-A1AF-029E45B4338B@googlemail.com> Content-Type: text/plain; charset="UTF-8" Date: Fri, 14 Feb 2014 02:02:37 +0100 Message-ID: <1392339757.3990.130.camel@guybrush> Mime-Version: 1.0 X-Mailer: Evolution 2.30.3 Content-Transfer-Encoding: 8bit Subject: Re: [PHP-DEV] When will the extension and embedding APIs ever be cleaned or documented? From: johannes@schlueters.de (Johannes =?ISO-8859-1?Q?Schl=FCter?=) On Fri, 2014-02-14 at 01:17 +0100, Kevin Ingwersen wrote: > Am Fr. Feb. 14 2014 00:04:01 schrieb Johannes Schlüter: > > Mind: "Compatibility is a feature." (Bjarne Stroustrup) The fact that 10 > > years old extensions can be used with php git master with quite little > > work is not only a help for old users but also promise to new users that > > their investment won't be lost easily. > > But what if there was something like a wrapper above the old api, to > give it a cleaner appearance, so people could choose to work with the > newer, or older, API? Well, there wasn't a satisfiable API proposed, yet. The current "API" is quite wide making it hard to wrap without requiring too much "escape points". There are projects like https://github.com/moriyoshi/boost.php though. (Last change 4 years ago ...) In the end: Once people are used to it it isnot toooo much of a urden to use the existing interface in most cases. > BTW, in the API „book“, I dont find what I am looking for; storing a > forgein thing into the object. Like if I was to write a PHP module > that exports a PHP class, I would like to create a class instance to a > C++ class, and store that instance within the php object (struct?). > Like: > > zval* this = getThis(); > MyClass* mc = (MyClass*)get_pointer_from_zvalthis); > > And, well, vice-versa. Maybe this helps: http://talks.somabo.de/200903_montreal_php_extension_writing.pdf starting ca. slide 89. Mind that this might be a bit outdated, property handling changed a tiny bit, the UPRADING.INTERNALS file in a recent PHP distribution should have details if you run into issues ... ignore the comment on the UPGRADING file ... I can't seem to find the relevant reference .. damn ... notably direct manipulation of properties via zend_hash_copy as on slide 90 is to be replaced with object_properties_init(), if you hit issues there please ask again and I (or maybe/hopefully somebody else) can dig deeper and help more. > Otherwise, that phpinternalsbook is very detailed, and I like how its > written :) > > Although its no real PHP project - why not just link it in the php.net > docs? o.o That probably might be done, I'd prefer integration so more people can update it ... I myself wasn't aware of the existence before. johannes