It's annoying that in I can't declare an interface with very general terms (e.g. a class that handles some kind of variable, type unspecified, in various ways) and then implement it with more specific terms (e.g. this class handles strings in the same ways, this other class handles objects of a certain class family...).

· · Web · 1 · 0 · 0

@panigrc Those enforce types in the same way.

The documentation claims they don't, but my experiments indicate otherwise.


Got an idea, though (which I am not going to attempt to implement now -- no, fingers, don't even think about mucking with the internal API yet again, we need to get this thing working):

Have the interface consist of member-variables which are actually closures (functions assigned to variables).

The only problem there, I think, is that then you can't constrain the function arguments at all.

I'm now finding myself wanting to write a PHP preprocessor, just so I can add language features. >.>

Sign in to participate in the conversation

The social network of the future: No ads, no corporate surveillance, ethical design, and decentralization! Own your data with Mastodon!