Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:91702 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 19398 invoked from network); 16 Mar 2016 17:58:20 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 16 Mar 2016 17:58:20 -0000 Authentication-Results: pb1.pair.com smtp.mail=php@fleshgrinder.com; spf=permerror; sender-id=unknown Authentication-Results: pb1.pair.com header.from=php@fleshgrinder.com; sender-id=unknown Received-SPF: error (pb1.pair.com: domain fleshgrinder.com from 212.232.25.162 cause and error) X-PHP-List-Original-Sender: php@fleshgrinder.com X-Host-Fingerprint: 212.232.25.162 mx206.easyname.com Received: from [212.232.25.162] ([212.232.25.162:42423] helo=mx206.easyname.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 6E/2A-48430-ABE99E65 for ; Wed, 16 Mar 2016 12:58:18 -0500 Received: from cable-81-173-135-2.netcologne.de ([81.173.135.2] helo=[192.168.178.20]) by mx.easyname.com with esmtpsa (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.84_2) (envelope-from ) id 1agFi3-0000YW-8r for internals@lists.php.net; Wed, 16 Mar 2016 17:58:15 +0000 Reply-To: internals@lists.php.net References: To: internals@lists.php.net Message-ID: <56E99E97.2050102@fleshgrinder.com> Date: Wed, 16 Mar 2016 18:57:43 +0100 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:38.0) Gecko/20100101 Thunderbird/38.7.0 MIME-Version: 1.0 In-Reply-To: Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="lCDqhRjGhT4e3FcpidpxJMlMXqS5inskC" X-ACL-Warn: X-DNSBL-BARRACUDACENTRAL Subject: Re: [PHP-DEV] [RFC] Libsodium (bump) From: php@fleshgrinder.com (Fleshgrinder) --lCDqhRjGhT4e3FcpidpxJMlMXqS5inskC Content-Type: multipart/mixed; boundary="5OMcKfE5vWEJHpOF9mokIwL5xqFLXg7SH" From: Fleshgrinder Reply-To: internals@lists.php.net To: internals@lists.php.net Message-ID: <56E99E97.2050102@fleshgrinder.com> Subject: Re: [PHP-DEV] [RFC] Libsodium (bump) References: In-Reply-To: --5OMcKfE5vWEJHpOF9mokIwL5xqFLXg7SH Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable On 3/15/2016 11:02 PM, Yasuo Ohgaki wrote: > Hi Scott, >=20 > On Wed, Mar 16, 2016 at 2:40 AM, Scott Arciszewski wrote: >> Question: If this extension is adopted, which syntax would you prefer?= >> >> \Sodium\func() >> Sodium::func() >> sodium_func() >=20 > I prefer both of >=20 > Sodium::func() > sodium_func() >=20 > IMO, we are better to provide both OO and procedural API which have > identical features. i.e. I prefer multi paradigm programming language. > It would be natural for PHP since PHP was born as procedural language > and evolving as OO. >=20 > Regards, >=20 > -- > Yasuo Ohgaki > yohgaki@ohgaki.net >=20 Providing both only makes sense if you receive an object on which you can perform more operations. It is a different situation if everything that the extension provides is always a function in a mathematical sense (same input produces single output). I love multi-paradigm languages but that does not mean that everything needs to provide every paradigm; you actually end up with a mess in such cases. We have good examples where it makes sense [1] and bad examples where it makes no sense [2] together in a single extension. The major reason to provide an object is to encapsulate some information and/or state that you can pass around (dependency injection) and that has some kind of behavior. This is most certainly not the case in [2] because it consists only of previously mentioned mathematical functions. [1] is different, it can be passed around, preconfigured with some state (a specific locale and pattern). It would become even more useful if one could instantiate it only with a locale and pass it around, prepared to handle multiple patterns; but that's another story. [1] https://secure.php.net/class.messageformatter [2] https://secure.php.net/class.locale TL;DR Providing Ext::fn() and ext_fn() for everything only creates a mess. Decide on one way and decide on the way that makes sense. Multi-paradigm does not mean "provide/use everything, always" it means "provide/use one paradigm as it make senses from multiple ones"; that is also where it takes its strength from. --=20 Richard "Fleshgrinder" Fussenegger --5OMcKfE5vWEJHpOF9mokIwL5xqFLXg7SH-- --lCDqhRjGhT4e3FcpidpxJMlMXqS5inskC Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 iQIcBAEBCAAGBQJW6Z6tAAoJEOKkKcqFPVVrhDsQALcui+jBxaT+QWuthWY0rUCy 8brflj4Ed/192NpnIpMwlrDbiAxVQ+bI2AVkcQguS5KKq5cM0BYYPTLPV9mtxrCg mvX3JRSW3gVyPV82hv39f+LWBGAFjVTosikrRunlY2bBGYaKSJ/euymnFO6Ni8Jd 16iAuV4iTlFrajO3bur58ysF+YVQk3LWs7OuL9qOdBlz7O9zkfp862kMpWxWxF7Y 2exJ1ew4YY+BIrDIuLlJCZMEieNT+5dp7zhfcjmv16F8SaOwNs8xJ9J+eWnE5aW8 l66rv7YfCbuMRxExt+Xn6w1Qp6wVzywv4WXoZmW1EmiAbJnBxQrZXVHFj/TzrHPG qTXfMZFcizpW9FuEf4emijHfhSXGcPfZQI6YtxA5Lx3C/PzrTU6VGLzhfVWGFGfz rRax0vNQyV7g50NTnw8b49lwtrOFHNTyX2pAOHCfuEotz/7pzxVmsNGz21DIS4wt Hp1YKuMLNuQsfK1rCT3Ivu/1PiIxGD8o9sJSUkc9ifeGyfljby0yt3pBWwK5yZX9 rndINuVXP25DEOVADt2QLUUzp2NDbgA4P236eDdZ91lMiYqaqu7PCeE2LyxmpU76 VuRQc5SnToBoHNkEfdmK8jCgheybp4zVIIIqx0ZC0yInqLBfGWnGAJ5KYj/Y4TFi +dK7UTxI8uGlPPppnRGA =S7KX -----END PGP SIGNATURE----- --lCDqhRjGhT4e3FcpidpxJMlMXqS5inskC--