Search
30 results · page 1 of 2
-
Rowan Tommins [IMSoP] ·
Hi, This follows up on the Extension Methods / Scalar Extension Methods RFCs (currently in draft). I'd like to propose allowing extension methods on scalar values to be invoked through property-fetch syntax, with the parentheses omitted. Hi, I …
-
h4acda@qq.com ·
Hi, This follows up on the Extension Methods / Scalar Extension Methods RFCs (currently in draft). I'd like to propose allowing extension methods on scalar values to be invoked through property-fetch syntax, with the parentheses omitted. Proposal: when a …
-
Rowan Collins ·
… patch that does not include support for AST, that's a completely different feature. Arguably, with the right choice of extension methods, an implementation requiring a single scalar could be extended to support arbitrary expressions later, since "scalar" is a …
-
michal@brzuchalski.com ·
IMHO if there were possibility to provide scalar objects like in Nikic extension https://nikic.github.io/2014/03/14/Methods-on-primitive-types-in-PHP.html most of str* and many other functions could be called wythout FQN simply …
-
Larry Garfield ·
… to use day to day. Which points at a hybrid I'd actually be keen on: core provides the common scalar ops always-in-scope, extension functions handle userland/domain-specific additions with use. That keeps your extensibility and unbounded …
-
Sara Golemon ·
As you suggested initially. Don't make them objects. You can leave them scalars and still give them methods all from an extension. Not via typical APIs, granted, but the engine hooks are all in there. On Thu, Jul 19 …
-
Holly Schilling ·
Holly Le 10/07/2026 à 20:33, Holly Schilling a écrit : . As far as scalar methods goes, I hate my implementation. I’m not suggesting someone else could do better, only that the compromises necessary to implement it weren …
-
Seifeddine Gmati ·
… t model nominally: a flag that comes back as the int 1, 2 or 3 from a database or C extension, an HTTP status, or an 'asc'|'desc' that exists only at one API boundary. Enums fit when you own …
-
Robert Landers ·
… work with numbers. Can not use proper type-hinting. Can use PHP's basic type coercions. Ext-decimal: Third-party extension. Workaround: implements the Decimal class that allows basic regular math operations. Requires using class methods for the rest of …
-
Rasmus Lerdorf ·
… their code. Even if the caller has turned on strict, if you haven't added strict types to your functions/methods you are fine. Internal API and extension authors don't get this luxury. If the caller turns on strict …
-
VOTE Scalar Type Hints
Andrea Faulds ·
… a very special case and, even in this case, PHP 7 could be the occasion to replace GMP functions with methods. The imperative API may not change, but who’s to say that the objects won’t have methods added …
-
Andrea Faulds ·
… needs or usages. Yeah, I don’t like this behaviour much. I want to avoid inconsistency with the behaviour of extension functions (i.e. zend_parse_parameters) where possible, though. Since this has come up so much, I should probably …
-
Andreas Hennings ·
I think the example in the RFC is interesting, but not ideal to advertise the RFC. The example is with native scalar types and build-in operator implementations. (I don't know how GMP works internally, but for an …
-
Hamza Ahmad ·
… the function that registers a class that serves as a prototype of a built-in type. And, also provide with scalar methods for string, int, float and arrays. To get handler registering functionality added to core, there should be a …
-
Rowan Lewis ·
I don't think there's an RFC, but Nikita wrote at length about it and created a PHP extension to allow for users to define their own methods on primitive types: http://nikic.github.io/2014/03/14/Methods …
-
Brian Moon ·
… work too good anymore for it. Is the desire for named parameters to only have it for user land function/methods? If so, I am kind of -.5 on this because that would be a little WTF for a new …
-
Andreas Hennings ·
… or” vs “||”), why not make a shorthand way to write a function that calls a constructor (kinda sorta like C# extension methods)? Something kinda like: class MyClass implements Invocable { public function __construct($i) {} } MyClass($i); Where the Invocable interface defines …
-
Martin Scotta ·
… in every extension is daunting. Anybody out there have a patch along these lines? -Rasmus Glad to see pseudo-object methods for scalars/arrays brought up again. It'll improve workflow a lot. I want to ask/suggest two clarifications …
-
Terry Cullen ·
… And, the method chaining of common string/array manipulations makes for cleaner, easier to read code. I've used the scalar objects extension and found it a pleasure to use over the standard function but I can't use it …
-
Rowan Collins ·
… version of the wrapper? So kind of an extension to the "scalar objects" idea (e.g. https://github.com/nikic/scalar_objects) such that variables can have arbitrary properties / state rather than just the syntax sugar of ->methodCall() ? One problem …