[PHP-DEV] Migrating PHP classes to built in namespace

2015-06-03 Thread Dominic Grostate
Hi, I couldn't find any information on this elsewhere, or perhaps I didn't look hard enough. Its been bugging me a while though so I though I would ask. Has there been any discussion or consideration towards migrating or at least aliasing all built in classes to a Php vendor namespace? For aest

Re: [PHP-DEV] Migrating PHP classes to built in namespace

2015-06-03 Thread Dominic Grostate
06-03 10:33 GMT+02:00 Dominic Grostate : > >> Hi, >> >> I couldn't find any information on this elsewhere, or perhaps I didn't >> look >> hard enough. Its been bugging me a while though so I though I would ask. >> >> Has there been any discussio

Re: [PHP-DEV] Migrating PHP classes to built in namespace

2015-06-16 Thread Dominic Grostate
ould be used as a permanent alias, or only as a solution for phasing out the global namespace in preparation for PHP8 in X number of years. On 4 Jun 2015 9:02 am, "Yasuo Ohgaki" wrote: > Hi all, > > On Thu, Jun 4, 2015 at 12:07 AM, Sara Golemon wrote: > >> On We

[PHP-DEV] Output, parameter

2015-06-18 Thread Dominic Grostate
A feature I'd quite like to see is something similar to C# out arguments. Which is an argument provided empty to a function (or with a value to be ignored) that the function must write to before returning. Normally this wouldn't be necessary since you can do this anyway by passing by reference, ho

[PHP-DEV] Expanded variable hash function

2015-07-20 Thread Dominic Grostate
Hi all. I've been experimenting with creating data structures in PHP. For example I implemented a HashSet which turns out to have a higher performance on larger sets than running in_array on arrays on add. To do this I has to create a hash code generator which could hash scalar types and objects

[PHP-DEV] Concept: Custom Type Hinting

2014-10-02 Thread Dominic Grostate
Hello, I followed the instructions to mail to this address to measure the reaction of an idea before going through the process of creating an RFC, but I am sorry if this is off topic for this board. Problem: I have been looking for a solution to reduce the verbosity of my code and invoke data ty

Re: [PHP-DEV] Concept: Custom Type Hinting

2014-10-02 Thread Dominic Grostate
On 3 October 2014 00:49, Andrea Faulds wrote: > Functions in PHP cannot be autoloaded, so this would be quite inconvenient > to use. Will people bother adding an include to every file merely to use > typehints? Or are typehints classes, in which case, why not simply define > them as a class rathe

[PHP-DEV] Implementing Generics, and none scalar default properties.

2015-09-23 Thread Dominic Grostate
A couple of things that would really help me in PHP are generics and the ability to set default values of properties to instances of objects or calls to static methods or functions (expressions in general). I don't know if either of these have experimental implementations already as I couldn't fin

[PHP-DEV] Re: Implementing Generics, and none scalar default properties.

2015-09-23 Thread Dominic Grostate
> So far I only wrote up the RFC and kicked off a discussion here on the > mailing list about it. As I wrote several times already, I'd appreciate > someone tackling the implementation side to get a patch working! > Cheers, Hi Ben, I think there is something wrong with how I set up my ML subscri

[PHP-DEV] RFC: Generics

2015-09-24 Thread Dominic Grostate
Hi Ben & Internals, I spent most of today and yesterday just getting used to the parser language. I was able to implement the basic syntax on most of the constructs, just to get a partial proof of concept going. https://github.com/orolyn/php-src/commit/ee731240eab1e5986152cadaaca6d3e5b921ba7d Th

Re: [PHP-DEV] Implementing Generics, and none scalar default properties.

2015-09-25 Thread Dominic Grostate
25 Sep 2015 1:09 pm, "Johannes Schlüter" wrote: > Hi, > > Would be good to split complete different subjects to different threads > anyways: > > On Wed, 2015-09-23 at 15:53 +0100, Dominic Grostate wrote: > > the > > ability to set default values of properti

Re: [PHP-DEV] Implementing Generics, and none scalar default properties.

2015-09-25 Thread Dominic Grostate
I'm thinking primarily of the benefit to base or abstract classes. For base classes which expect certain properties be set, they are exposed to the danger of remaining unset if the derived class overrides the constructor without calling the parent. This solution is analogous to: class Foo {

Re: [PHP-DEV] Implementing Generics, and none scalar default properties.

2015-09-26 Thread Dominic Grostate
An alternative that rfc might be to add a modifier to ctor, something like. required public function __construct(); A required function cannot be final, because the intention is to allow it to be overridden, but it must be called by the child impl at some point. What do u think? On 26 Sep 2015 8:

[PHP-DEV] Injecting structure to ZEND_NEW

2015-09-29 Thread Dominic Grostate
I'm trying to pass a new structure into the ZEND_NEW handler which will be used to change the behaviour of zend_fetch_class_by_name. The issue I'm having though is the operands won't support the new type unless I compile it to zval, but I can't use zend_execute_data to reference that in a pre-hand

Re: [PHP-DEV] Injecting structure to ZEND_NEW

2015-09-29 Thread Dominic Grostate
5 at 4:57 PM, Joe Watkins > wrote: > >> I think you are looking for opcode handlers, what you want to do is >> implement a ZEND_NEW handler ... >> >> For reference, xdebug and uopz overload handlers, as well as many other >> extensions ... >> >> C

Re: [PHP-DEV] Injecting structure to ZEND_NEW

2015-09-29 Thread Dominic Grostate
Watkins" wrote: > Sorry, I'm not able to make sense of what you are doing ... got a patch ? > > Cheers > Joe > > On Tue, Sep 29, 2015 at 5:29 PM, Dominic Grostate < > codekest...@googlemail.com> wrote: > >> Hi, ive already started working with the h

[PHP-DEV] Internal methods proposal

2015-11-24 Thread Dominic Grostate
Hi, I think this proposal has been made before maybe here or discussed elsewhere. Still, I'd like to give my input on the idea. The basic concept is when a method has the internal access modifier, it can only be called from within the same namespace. The case for this is to protect classes from

[PHP-DEV] Re: Internal methods proposal

2015-11-24 Thread Dominic Grostate
Dominic Grostate wrote on 24/11/2015 12:14: > I think this proposal has been made before maybe here or discussed > elsewhere. Still, I'd like to give my input on the idea. There have indeed been a couple of discussions of this recently. Try searching for threads on a list archive using

[PHP-DEV] Regarding type argument syntax

2016-01-26 Thread Dominic Grostate
Hello all, This concerns the RFC on generics. It isn't an extension to the proposal, a sale or anything, just hypothetical, it only regards a technicality about its implementation of syntax. The issue is the T_SR >> for nested type arguments. I understand the reason this is difficult, and I kno

[PHP-DEV] Request for Karma

2016-02-26 Thread Dominic Grostate
Hello, I would like to request karma for the wiki. I'm assisting Rasmus Schultz with the Generics RFC. Thank you, Dominic

[PHP-DEV] Re: Request for Karma

2016-02-26 Thread Dominic Grostate
Username is: orolyn On 26 Feb 2016 3:31 p.m., "Dominic Grostate" wrote: > Hello, > > I would like to request karma for the wiki. > I'm assisting Rasmus Schultz with the Generics RFC. > > Thank you, > Dominic >

Re: [PHP-DEV] Re: Request for Karma

2016-02-28 Thread Dominic Grostate
Thank you On 28 Feb 2016 9:17 a.m., "Ferenc Kovacs" wrote: > > > On Fri, Feb 26, 2016 at 4:33 PM, Dominic Grostate < > codekest...@googlemail.com> wrote: > >> Username is: orolyn >> On 26 Feb 2016 3:31 p.m., "Dominic Grostate" >> wrote:

Re: [PHP-DEV] [RFC:generics]

2016-04-19 Thread Dominic Grostate
x8qs/php_rfcgenerics_update_03_please_comment/ > >> > >> One of the most common criticisms we've heard, is that the syntax > >> would be hard to implement, a few have said "impossible" - but we feel > >> that, if generics are introduced, it's importa

Re: [PHP-DEV] [RFC:generics]

2016-04-20 Thread Dominic Grostate
I've made an amendment to the RFC to clarify on the Nested Types, which is indeed supposed to be part of the feature. Rasmus may want to reword it if it isn't very clear. Regarding union and intersections for upper (and maybe lower) bounds. Would it be appropriate to exclude these from type param

Re: [PHP-DEV] [RFC:generics]

2016-04-20 Thread Dominic Grostate
hread answering may lead to top-posting, but if it > does, I'm sorry... =\ > > Answer inline: > > On Wed, Apr 20, 2016 at 5:10 AM, Dominic Grostate < > codekest...@googlemail.com> wrote: > >> I've made an amendment to the RFC to clarify on the Nested Type

Re: [PHP-DEV] [RFC:generics]

2016-04-20 Thread Dominic Grostate
Thanks for you're input everyone. So far, we have read some ideas for handling upper bounds, or multiple there of. The preferred keywords appear to be either "as" or "instanceof". class Foo {} class Foo {} We would like to know for sure then if everyone is largely against the addition of an "is"

Re: [PHP-DEV] Re: Improving PHP's type system

2016-04-20 Thread Dominic Grostate
Just a thought that crossed my mind which might satisfy both worlds. Has anyone every considered unions as a type declaration? namespace Vector/TypeDefs union Stringable { as string; as int; as float; private $value; public function __make($type) { switch (type)

Re: [PHP-DEV] [RFC:generics]

2016-04-21 Thread Dominic Grostate
Nope, it pretty much made perfect sense to me the first time. But you may get your wish in it going in with the proposal anyway as I don't think this RFC is going to make it in time for the 7.1 window. My crack at implementing it went bust when I realised I was adding too many execute globals. S

Re: [PHP-DEV] [RFC] PHP Attributes

2016-04-21 Thread Dominic Grostate
This is amazing. It would actually allow us to implement our automated assertions ourselves, as opposed to requiring it within the language. Could it also support references? <> function foo($a) { } On 21 Apr 2016 10:13 p.m., "Dmitry Stogov" wrote: > Hi, > > > I would like to present an RFC p

Re: [PHP-DEV] [RFC] PHP Attributes

2016-04-22 Thread Dominic Grostate
structor, unless someone already mentioned that. On 22 Apr 2016 12:44 a.m., "Dmitry Stogov" wrote: On 04/22/2016 02:16 AM, Dominic Grostate wrote: This is amazing. It would actually allow us to implement our automated assertions ourselves, as opposed to requiring it within the language

Re: [PHP-DEV] [RFC] Patch for Union and Intersection Types

2016-04-26 Thread Dominic Grostate
Is this RFC going to play nice with Void return types? If we get unions, then doesn't it follow that the declaration goes as this? function foo(A | B $val = null): JustChill | void {} That's a nullable typehint and a nullable return type surely. On 26 Apr 2016 4:07 p.m., "Joe Watkins" wrote: >

Re: [PHP-DEV] [RFC] Patch for Union and Intersection Types

2016-04-26 Thread Dominic Grostate
Balls.. Void my last comment.. On 26 Apr 2016 4:42 p.m., "Dominic Grostate" wrote: > Is this RFC going to play nice with Void return types? > > If we get unions, then doesn't it follow that the declaration goes as this? > > function foo(A | B $val = null): Just

Re: [PHP-DEV] [RFC] PHP Attributes

2016-04-26 Thread Dominic Grostate
Why not like C#? [Description("My Function")] function my_function() {} Without the semicolon, this wouldn't be valid in any other context. On 26 Apr 2016 8:41 a.m., "Dmitry Stogov" wrote: On 04/25/2016 11:20 PM, Stanislav Malyshev wrote: > Hi! > > No, but this is valid: >> >> @atrr(); funct

Re: [PHP-DEV] [RFC] PHP Attributes

2016-04-26 Thread Dominic Grostate
s syntax. On 26 Apr 2016 7:33 p.m., "Pierrick Charron" wrote: > And it will probably be in conflict with the Short Array Syntax ? > > On 26 April 2016 at 13:14, Dmitry Stogov wrote: > >> Just because HHVM is closer to PHP than C#. >> >> >> __

Re: [PHP-DEV] [RFC:generics]

2016-04-26 Thread Dominic Grostate
ng upper bounds, or > > >> multiple there of. > > >> The preferred keywords appear to be either "as" or "instanceof". > > >> > > >> class Foo {} > > >> class Foo {} > > >> > > >> We would like to k

[PHP-DEV] Inline functions

2016-04-28 Thread Dominic Grostate
Something in Dmitry's attribute RFC caught my attention. There is an example implying inline functions indicated by an attribute. I know that was only a potential use case for an extension. But it made me wonder how much that could improve PHPs performance if we actually had it. As I understand

Re: [PHP-DEV] Inline functions

2016-04-28 Thread Dominic Grostate
That sounds wicked. I look forward to benchmarking it and seeing how its done. On 28 Apr 2016 6:39 p.m., "Sara Golemon" wrote: > On Thu, Apr 28, 2016 at 1:21 AM, Dominic Grostate > wrote: > > As I understand it, the process by which the call stack is updated and >

Re: [PHP-DEV] Inline functions

2016-04-28 Thread Dominic Grostate
ers it has contributes a large part it. On 28 Apr 2016 7:55 p.m., "Nikita Popov" wrote: > On Thu, Apr 28, 2016 at 8:39 PM, Dominic Grostate < > codekest...@googlemail.com> wrote: > >> That sounds wicked. I look forward to benchmarking it and seeing how its >> done. >

Re: [PHP-DEV] [RFC:generics]

2016-04-29 Thread Dominic Grostate
It's not insane, it's liskov substitution. But that is an insane example, typical of Java to create a type that extends it's parent by adding value constraints.. directly violating the principle. On 29 Apr 2016 4:22 p.m., "Rowan Collins" wrote: guilhermebla...@gmail.com wrote on 29/04/2016 15:26

Re: [PHP-DEV] [RFC:generics]

2016-04-29 Thread Dominic Grostate
After reading your email again, I find myself agreeing. This is because I don't consider List to be a subtype of List. LinkedList would be a subtype of List, but inheritance doesn't really extend any further beyond that, for the reason you have illustrated. The example you gave is similar to imp

Re: [PHP-DEV] [RFC:generics]

2016-04-29 Thread Dominic Grostate
matter how it's done, both scenarios are prone to error, and the only options are to either accept that or disallow it. On 29 Apr 2016 5:11 p.m., "Rowan Collins" wrote: > Dominic Grostate wrote on 29/04/2016 16:59: > >> >> After reading your email again, I find m

Re: [PHP-DEV] [RFC:generics]

2016-04-29 Thread Dominic Grostate
ate! > > > > Also, it's crossed in the post with your next message, but I'll send > > it anyway, in case it helps anyone understand. > > > > > > Dominic Grostate wrote on 29/04/2016 16:45: > >> It's not insane, it's liskov substitution.

[PHP-DEV] Opinion on function/method name overloading

2016-06-06 Thread Dominic Grostate
Hi, As I understand it, using Java-like function overloading in PHP is undesirable due to hindrance in readability. However I'd like to get an opinion on whether it would be received more favourably if it could provide an actual performance enhancement over hand managed implementation's of detect

Re: [PHP-DEV] Opinion on function/method name overloading

2016-06-06 Thread Dominic Grostate
, a linked list allows on the fly additions and reordering when organising the overloads by restrictiveness in descending order. On 6 Jun 2016 11:03 a.m., "Derick Rethans" wrote: On Mon, 6 Jun 2016, Dominic Grostate wrote: > As I understand it, using Java-like function overload

Re: [PHP-DEV] Opinion on function/method name overloading

2016-06-06 Thread Dominic Grostate
In your example, the output may be: 0 3 float, int and string all share the same row on an upside down pyramid, with $bar, being dynamic, at the bottom. With regards to union types, it could work exactly like the latest Multi-Catch feature. On 6 Jun 2016 11:57 a.m., "Rowan Collins" wrote: > On

Re: [PHP-DEV] Opinion on function/method name overloading

2016-06-06 Thread Dominic Grostate
f512efee36d402d1fc4fbc8f0521 On 6 Jun 2016 12:19 p.m., "Rowan Collins" wrote: > On 06/06/2016 12:06, Dominic Grostate wrote: > >> float, int and string all share the same row on an upside down pyramid, >> with $bar, being dynamic, at the bottom. >> > > OK

Re: [PHP-DEV] Re: Opinion on function/method name overloading

2016-06-06 Thread Dominic Grostate
Thanks. I only wanted some quick input into whether it was worth pursing before I do something daft.. like build it :) All I wanted to know was, if the technicalities could be worked out, and a performance boost was possible, would people still dislike it. I'd still like to see it added, but I a

[PHP-DEV] Addition methods to collection classes

2016-06-24 Thread Dominic Grostate
Hi, Are there any plans to extend the functionality of the SPL collection classes? SplFixesArray for instance is a nice memory efficient list, but in order to sort it, it needs to be dumped to an array, sorted then changed back, which kind of feels like it defeats the purpose. Thanks, Dominic

[PHP-DEV] function overloading

2016-11-15 Thread Dominic Grostate
I think this may have been discussed before, but I was largely dismissed because no one though it would be possible to implement. However assuming it is possible, what is the general feeling towards function overloading, as seen in C# and Java? To me, it saves me coming up with convoluted names f

Re: [PHP-DEV] function overloading

2016-11-16 Thread Dominic Grostate
y conceivable, > at all. > > Cheers > Joe > > On Tue, Nov 15, 2016 at 4:13 PM, Dominic Grostate < > codekest...@googlemail.com> wrote: > >> I think this may have been discussed before, but I was largely dismissed >> because no one though it would be possib