Electronics & Programming

develissimo

Open Source electronics development and programming

  • You are not logged in.
  • Root
  • » PHP
  • » [PHP-DEV] PDM Meeting Notes [RSS Feed]

#1 Nov. 22, 2005 17:57:54

Derick R.
Registered: 2009-11-02
Reputation: +  0  -
Profile   Send e-mail  

[PHP-DEV] PDM Meeting Notes


Hello folks!

On 11 and 12 November a bunch of us had a developers meeting in Paris,
discussing the things we want to do for PHP 6. Partly because of the
Unicode support, but we also discussed the items on "Rasmus' wishlist"
and a lot of other items. I made a report of the discussions we had and
placed the notes here:http://php.net/~derick/meeting-notes.htmlregards,
Derick
--
Derick Rethanshttp://derickrethans.nl|http://ez.no|http://xdebug.org--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit:http://www.php.net/unsub.php

Offline

#2 Nov. 22, 2005 20:23:03

Matthias P.
Registered: 2009-11-02
Reputation: +  0  -
Profile   Send e-mail  

[PHP-DEV] PDM Meeting Notes


Great, I have been waiting for this list sine Derick mentioned the
meeting in his talk at the conference :)

@Derick: There have been some questions and issues raised during your
talk... Dou you remember them? It was about reading from files with the
new unicode semantics, and you said these were some things you need to
discuss. I don't see anything that looks related... Do you remember what
it was about?

> 2.10 Dynamic class inheritance

Can someone elaborate a little on what this is supposed to be ;)?

> 5.2 Allow interfaces to specify the __construct() signature

> Discussion: We didn't see a reason why this shouldn't be allowed,
> but Andi seems to have a reason for it.
> Conclusions: Zeev asks Andi why he doesn't want constructors in
> the interface. If there is no sound reason we add this
> possibility.

I had a discussion about this with a colleague recently. IMHO specifying
construcor signature does not make sense at all in interfaces... What is
that supposed to do at all? I mean - conceptually, what does it express?

> 5.3 Implement inheritance rules for type hints
> Issue: Currently we don't check inheritance rules for type-hinted
> parameters.

Could someone please explain what exactly is/is not checked?

> 5.4 Late static binding using "this" without "$"
> (or perhaps with a different name)

Interesting feature :) I've been missing that on C# recently ;)

As to type hinting, has there ever been a discussion about allowing
string/int/... type hints? These could perform appropriate casts so you
don't need to make such checks at the beginning of every method you
write.

-mp.

--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit:http://www.php.net/unsub.php

Offline

#3 Nov. 22, 2005 20:34:41

Rasmus L.
Registered: 2009-11-02
Reputation: +  0  -
Profile   Send e-mail  

[PHP-DEV] PDM Meeting Notes


Matthias Pigulla wrote:2.10 Dynamic class inheritanceCan someone elaborate a little on what this is supposed to be ;)?Also known as runtime inheritance, or late binding. It's not a newthing, we have it today. The discussion was about whether to have a wayto disable this and force people to define their classes at thetop-level of scripts and to define them in the correct order so allbinding can be done at compile-time which is of course faster. Theconclusion was that this could be done at the opcode cache level.I had a discussion about this with a colleague recently. IMHO specifying
construcor signature does not make sense at all in interfaces... What is
that supposed to do at all? I mean - conceptually, what does it express?Just like any other signature in an instance, it tells anything thatimplements the interface that it must have a constructor and thatconstructor must meet the definition in the interface. Useful forobject factories. In most cases you don't want to force a specificconstructor in which case you wouldn't specify it in the interface, butI see no reason why you shouldn't be allowed to specify it there if youwant to.As to type hinting, has there ever been a discussion about allowing
string/int/... type hints? These could perform appropriate casts so you
don't need to make such checks at the beginning of every method you
write.Yes, a lot of folks are strongly against going down that route.

-Rasmus

--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit:http://www.php.net/unsub.php

Offline

#4 Nov. 22, 2005 20:45:42

Matthias P.
Registered: 2009-11-02
Reputation: +  0  -
Profile   Send e-mail  

[PHP-DEV] PDM Meeting Notes


Now that was a quick reply :)

> Also known as runtime inheritance, or late binding. It's not a new
> thing, we have it today. The discussion was about whether to
> have a way
...

That is, one can write
if (...) class A extends X {} else class A extends Y {}
right now? Seriously ;)?

Every now and then I'm surprised what weird sort of stuff is allowed in
PHP :), but most probably you don't really want to write this sort of
code in the first place? ;)

> Just like any other signature in an instance, it tells anything that
> implements the interface that it must have a constructor and that
> constructor must meet the definition in the interface. Useful for
> object factories. In most cases you don't want to force a specific
> constructor in which case you wouldn't specify it in the
> interface, but
> I see no reason why you shouldn't be allowed to specify it
> there if you
> want to.

The point is that interfaces are nothing you could anything with - that
is, if you have "something" that implements an interface, it has already
been constructed. You never construct instances through an interface
(you would have to choose an implementation, the interface isn't one)...
I just cannot explain it in a better way ;) It's somewhat similar to
that you cannot make static calls on interfaces.

Maybe someone could explain what they intend to use it for and what they
suspect it to do ;)?

-mp.

--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit:http://www.php.net/unsub.php

Offline

#5 Nov. 22, 2005 20:49:40

Rasmus L.
Registered: 2009-11-02
Reputation: +  0  -
Profile   Send e-mail  

[PHP-DEV] PDM Meeting Notes


Matthias Pigulla wrote:Now that was a quick reply :)Also known as runtime inheritance, or late binding. It's not a newthing, we have it today. The discussion was about whether tohave a way...That is, one can writeif (...) class A extends X {} else class A extends Y {}right now? Seriously ;)?Every now and then I'm surprised what weird sort of stuff is allowed in
PHP :), but most probably you don't really want to write this sort of
code in the first place? ;)Well, or do a conditional include or an include_once and you end uphaving to do late binding too. It doesn't have to be as weird as yourexample, but yes, that works too.Just like any other signature in an instance, it tells anything thatimplements the interface that it must have a constructor and thatconstructor must meet the definition in the interface. Useful forobject factories. In most cases you don't want to force a specificconstructor in which case you wouldn't specify it in theinterface, butI see no reason why you shouldn't be allowed to specify itthere if youwant to.The point is that interfaces are nothing you could anything with - that
is, if you have "something" that implements an interface, it has already
been constructed. You never construct instances through an interface
(you would have to choose an implementation, the interface isn't one)...
I just cannot explain it in a better way ;) It's somewhat similar to
that you cannot make static calls on interfaces.I don't see why you can't specify that a class definition must have aconstructor. Obviously the constructor is not for the interface itself.-Rasmus

--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit:http://www.php.net/unsub.php

Offline

#6 Nov. 22, 2005 21:29:44

Matthias P.
Registered: 2009-11-02
Reputation: +  0  -
Profile   Send e-mail  

[PHP-DEV] PDM Meeting Notes


> I don't see why you can't specify that a class definition must have a
> constructor. Obviously the constructor is not for the
> interface itself.

Ok, that is, having __construct in the interface asserts that everything
you get passed (as an implementation of the interface) has been
constructed by a constructor that has a certain signature? :--/ Of
course it also doesn't make sense to call __construct on the
implementation passed along.

Luckily this is nothing I'm forced to write in my code ;).

I only wanted to utter I have a Bad Feeling(TM) if you invest time and
effort to make stuff like this work if the result is something that
seems to make no sense . And once you allow it, be sure ppl
out there use & abuse it and will complain should you ever have to
remove it again.

..

I'm just trying to make up a scenario where the above might make sense -
it could be where you have something like a factory method. It has a
type hint on it's argument to make sure what gets passed in implements a
certain interface.

That interface defines the signature of __construct, so the method can
construct instances of the "thing" - only knowing that the instances
constructed will implement the interface (?), but not knowing their
implementation.

But how should it construct instances? new INameOfTheInterface()? And
besides that, problem is again that the "thing" passed in would have to
be something representing a class, and not an instance of the class
itself. You could always (gut feeling) re-design this to work "the usual
way" by passing in something representing a class and providing
behaviour to construct instances.

I hope Andi backs me :)

-mp.

--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit:http://www.php.net/unsub.php

Offline

#7 Nov. 22, 2005 22:45:10

Marcus B.
Registered: 2009-11-02
Reputation: +  0  -
Profile   Send e-mail  

[PHP-DEV] PDM Meeting Notes


Hello Matthias,

Tuesday, November 22, 2005, 9:22:16 PM, you wrote:

>> 2.10 Dynamic class inheritance

> Can someone elaborate a little on what this is supposed to be ;)?

Binding static members at run time rather than compile time. See the notes
for an example that shows the difference. Usage example again factories.

>> 5.3 Implement inheritance rules for type hints
>> Issue: Currently we don't check inheritance rules for type-hinted
>> parameters.

> Could someone please explain what exactly is/is not checked?

From a typesystem point of view it would be perfectly leagal to change the
typehint in a derived class as long as that respects is-a relation with the
parent. Since the explanation is a bit complex, not what most people expect
we live with the simple disagreement. And since most languages do not
respect this correct or not at all anyway there is obviously no real common
usecase for it. So PHP can live without that too (imo).

Best regards,
Marcus

--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit:http://www.php.net/unsub.php

Offline

#8 Nov. 22, 2005 22:54:51

Marcus B.
Registered: 2009-11-02
Reputation: +  0  -
Profile   Send e-mail  

[PHP-DEV] PDM Meeting Notes


Hello Matthias,

Tuesday, November 22, 2005, 10:29:09 PM, you wrote:

>> I don't see why you can't specify that a class definition must have a
>> constructor. Obviously the constructor is not for the
>> interface itself.

> Ok, that is, having __construct in the interface asserts that everything
> you get passed (as an implementation of the interface) has been
> constructed by a constructor that has a certain signature? :--/ Of
> course it also doesn't make sense to call __construct on the
> implementation passed along.

> Luckily this is nothing I'm forced to write in my code ;).

> I only wanted to utter I have a Bad Feeling(TM) if you invest time and
> effort to make stuff like this work if the result is something that
> seems to make no sense . And once you allow it, be sure ppl
> out there use & abuse it and will complain should you ever have to
> remove it again.

The patch is ready already and actually it is a single line change that was
obvious from the first place. What really causes work here is explaning this
over and over again.

> I'm just trying to make up a scenario where the above might make sense -
> it could be where you have something like a factory method. It has a
> type hint on it's argument to make sure what gets passed in implements a
> certain interface.

> That interface defines the signature of __construct, so the method can
> construct instances of the "thing" - only knowing that the instances
> constructed will implement the interface (?), but not knowing their
> implementation.

> But how should it construct instances? new INameOfTheInterface()? And
> besides that, problem is again that the "thing" passed in would have to
> be something representing a class, and not an instance of the class
> itself. You could always (gut feeling) re-design this to work "the usual
> way" by passing in something representing a class and providing
> behaviour to construct instances.

The typical way out is to completley re-design the software once reached
this need or change to reflection to at least prevent from more severe
errors.

Best regards,
Marcus

--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit:http://www.php.net/unsub.php

Offline

#9 Nov. 23, 2005 00:43:28

Bob S.
Registered: 2009-11-02
Reputation: +  0  -
Profile   Send e-mail  

[PHP-DEV] PDM Meeting Notes


5.4 Late static binding using "this" without "$" (or perhaps with a
different name)

The same example, but now with the call to "self::static2()" replaced with
"static::static2()", will then print "B::static2".


Using static::func() is a bit corny, I understand why you don't want another
new keyword so here is a few more suggestions:

class::func()
default::func()
final::func()

I personally think the class:: would be a better solution than static::,
although this:: is the best solution, can I ask why that was ruled out since
the title of the section indicates it was the first preference.

Thanks

Bob Silva



> -----Original Message-----
> From: Marcus Boerger
> Sent: Tuesday, November 22, 2005 2:45 PM
> To: Matthias Pigulla
> Cc: internals
> Subject: Re: AW: PDM Meeting Notes
>
> Hello Matthias,
>
> Tuesday, November 22, 2005, 9:22:16 PM, you wrote:
>
> >> 2.10 Dynamic class inheritance
>
> > Can someone elaborate a little on what this is supposed to be ;)?
>
> Binding static members at run time rather than compile time. See the notes
> for an example that shows the difference. Usage example again factories.
>
> >> 5.3 Implement inheritance rules for type hints
> >> Issue: Currently we don't check inheritance rules for type-hinted
> >> parameters.
>
> > Could someone please explain what exactly is/is not checked?
>
> From a typesystem point of view it would be perfectly leagal to change the
> typehint in a derived class as long as that respects is-a relation with
> the
> parent. Since the explanation is a bit complex, not what most people
> expect
> we live with the simple disagreement. And since most languages do not
> respect this correct or not at all anyway there is obviously no real
> common
> usecase for it. So PHP can live without that too (imo).
>
> Best regards,
> Marcus
>
> --
> PHP Internals - PHP Runtime Development Mailing List
> To unsubscribe, visit:http://www.php.net/unsub.php--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit:http://www.php.net/unsub.php

Offline

#10 Nov. 23, 2005 00:51:56

Marcus B.
Registered: 2009-11-02
Reputation: +  0  -
Profile   Send e-mail  

[PHP-DEV] PDM Meeting Notes


Hello Bob,

Wednesday, November 23, 2005, 1:44:53 AM, you wrote:

> 5.4 Late static binding using "this" without "$" (or perhaps with a
> different name)

> The same example, but now with the call to "self::static2()" replaced with
> "static::static2()", will then print "B::static2".


> Using static::func() is a bit corny, I understand why you don't want another
> new keyword so here is a few more suggestions:

> class::func()
> default::func()
> final::func()

I don't like default or final here. Default because there is no default
class in php and no such thing as a default class is involved here. Final
not because final has a dedicated semantics already. And that deals with
inheritance and tracks down to something that can be or should be done at
compile time and we want to find a keyword here that describes something
that should be done in run time. Class is nice though.

> I personally think the class:: would be a better solution than static::,
> although this:: is the best solution, can I ask why that was ruled out since
> the title of the section indicates it was the first preference.

Preventing confusion between $this and this to keep the code clean and
readable.

reagrds
marcus

--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit:http://www.php.net/unsub.php

Offline

  • Root
  • » PHP
  • » [PHP-DEV] PDM Meeting Notes [RSS Feed]

Board footer

Moderator control

Enjoy the 23rd of April
PoweredBy

The Forums are managed by develissimo stuff members, if you find any issues or misplaced content please help us to fix it. Thank you! Tell us via Contact Options
Leave a Message
Welcome to Develissimo Live Support