In recent discussions we were weighing up the options of array of and
generics came into conversation, brought forward from the Hack
language by Sara G.
I was wrong about one thing: Generics CAN have setup outside of the
type-hint, much like a collection, but it is not required. I thought
it was.
This means that array of could easily be considered "weak-generics"
and the two features can share the same syntax without confusion to
the user. A few of you said that, so sorry that I disagreed. ;)
Before we worry too much about that, the logical next question is:
Is there any interest in generics? If there is interest, then one
syntax would be preferable over the other.
With the existing proposed syntax for "array of", it looks like this:
function(Spanner[] $spanner)
Evolving that same syntax into generics would look something like this:
$tool = new Spanner[];
$tool = new int[];
That would be... less than ideal, but its nice and simple for the type hints.
Using the generics syntax for... generics:
function(array<Spanner> $spanner)
$tool = array<Spanner>();
Obviously angle-brackets are a bit new, but that same syntax works for both.
These examples are provided to make a point, and the syntax is not
definite. The point here really is that If we care about generics,
then using generic-like syntax for this feature probably makes sense.
If we don't care about generics, then there is probably no point using
this more verbose syntax for simple "array of" type-hinting, but the
syntax could still easily change.
Can you lot vote A, B, C or D to show your interest?
A) I want Array Of, but not Generics
B) I want Generics, but not Array Of
C) I want both
D) I want neither
Nothing really binding here, its more of a survey than a vote, but it
should help with the next steps.
A) I want Array Of, but not Generics
B) I want Generics, but not Array Of
C) I want both
D) I want neitherNothing really binding here, its more of a survey than a vote, but it
should help with the next
An RFC survey? This is not what this process is intended for. And these multi-option votes are rather useless. This feels like a waste of time to me.
-Rasmus
A) I want Array Of, but not Generics
B) I want Generics, but not Array Of
C) I want both
D) I want neitherNothing really binding here, its more of a survey than a vote, but it
should help with the nextAn RFC survey? This is not what this process is intended for. And these
multi-option votes are rather useless. This feels like a waste of time to
me.
I agree. I think this proposal isn't mature enough to initiate any type
of voting. I'm not a fan of how this went from proposing "arrayof" to a
comparison of generics. IMHO, if this is to proceed as a vote now, it
should simply be for the proposed syntax/functionality Yes/No only. If
generics are still being discussed, then discussions need to continue,
and a vote is a bit farther down the road.
-Rasmus
An RFC survey? This is not what this process is intended for. And these
multi-option votes are rather useless. This feels like a waste of time to
me.I agree. I think this proposal isn't mature enough to initiate any type
of voting. I'm not a fan of how this went from proposing "arrayof" to a
comparison of generics. IMHO, if this is to proceed as a vote now, it
should simply be for the proposed syntax/functionality Yes/No only. If
generics are still being discussed, then discussions need to continue,
and a vote is a bit farther down the road.
I think both of you are missing the point that "RFC" is nowhere in the
subject nor body of his message. He's just trying to further along the
discussion of which route to go.
Rasmus Lerdorf wrote:
A) I want Array Of, but not Generics
B) I want Generics, but not Array Of
C) I want both
D) I want neitherNothing really binding here, its more of a survey than a vote, but it
should help with the next
An RFC survey? This is not what this process is intended for. And these multi-option votes are rather useless. This feels like a waste of time to me.
As has been pointed out ... no mention of 'RFC' so perhaps the title should be
[Survey] rather than [VOTE].
There are a number of fundamental style changes floating around, so perhaps it
is time to have the broader discussion on some of them.
If I am reading things right, generics are called templates in C++ and just
loaded as an additional library. The same in other languages, something which is
optional and can be loaded as and if required?
We also have 'Reflections' which I still have not got my head around and I don't
think there is time to do so at my time of life. With the volume of code I have
maintained via 'docblock' commented type management I see little point in
introducing a different way of working in parallel. While my IDE setup is still
a little behind the current 'core' language structure it works fine - 'For my
style of coding'.
So please can we have the general discussion on 'PHP6' and what fundamental
changes people are prepared to put time into and stop this piecemeal nibbling at
the edges.
--
Lester Caine - G8HFL
Contact - http://lsces.co.uk/wiki/?page=contact
L.S.Caine Electronic Services - http://lsces.co.uk
EnquirySolve - http://enquirysolve.com/
Model Engineers Digital Workshop - http://medw.co.uk
Rainbow Digital Media - http://rainbowdigitalmedia.co.uk
On Fri, Jan 24, 2014 at 11:20 AM, Philip Sturgeon pjsturgeon@gmail.comwrote:
In recent discussions we were weighing up the options of array of and
generics came into conversation, brought forward from the Hack
language by Sara G.I was wrong about one thing: Generics CAN have setup outside of the
type-hint, much like a collection, but it is not required. I thought
it was.This means that array of could easily be considered "weak-generics"
and the two features can share the same syntax without confusion to
the user. A few of you said that, so sorry that I disagreed. ;)Before we worry too much about that, the logical next question is:
Is there any interest in generics? If there is interest, then one
syntax would be preferable over the other.With the existing proposed syntax for "array of", it looks like this:
function(Spanner[] $spanner)
Evolving that same syntax into generics would look something like this:
$tool = new Spanner[]; $tool = new int[];
That would be... less than ideal, but its nice and simple for the type
hints.Using the generics syntax for... generics:
function(array<Spanner> $spanner) $tool = array<Spanner>();
Obviously angle-brackets are a bit new, but that same syntax works for
both.These examples are provided to make a point, and the syntax is not
definite. The point here really is that If we care about generics,
then using generic-like syntax for this feature probably makes sense.
If we don't care about generics, then there is probably no point using
this more verbose syntax for simple "array of" type-hinting, but the
syntax could still easily change.Can you lot vote A, B, C or D to show your interest?
A) I want Array Of, but not Generics
B) I want Generics, but not Array Of
C) I want both
D) I want neither
Or you could finish up the "array of" proposal and put that to a vote.
If accepted, then A) or C) applies. If not accepted, then B) or D) applies
:)
Nothing really binding here, its more of a survey than a vote, but it
should help with the next steps.--
--
Tjerk
Can you lot vote A, B, C or D to show your interest?
A) I want Array Of, but not Generics
B) I want Generics, but not Array Of
C) I want both
D) I want neither
I would vote B, I guess. I want generics and array of, but see array
of as a subset of generic functionality, personally.
For 5.6, though, I'd vote D. We have plenty of good stuff in 5.6
already, and I think we're at the point now where I'd rather see
what's in there get stabilised than spending serious effort on rushing
major new features in before the cut off. Additionally, I think this
would be an particularly good candidate for a new major version. (More
on that later.)
Adam
Hello everybody,
I don't know if i can vote still i'm like a ghost here (newbie just
reading). But here is my mind.
I vote C. Arrays are not objects (too bad ><) so you can't add generics on
it (be logic :o). But generics can be a real interresting thing on
transversable objects for example.
It's also a very good idea to be able to type arrays....
So both: C
Have a good day.
Maxime.
Le 24 janv. 2014 07:15, "Adam Harvey" aharvey@php.net a écrit :
Can you lot vote A, B, C or D to show your interest?
A) I want Array Of, but not Generics
B) I want Generics, but not Array Of
C) I want both
D) I want neitherI would vote B, I guess. I want generics and array of, but see array
of as a subset of generic functionality, personally.For 5.6, though, I'd vote D. We have plenty of good stuff in 5.6
already, and I think we're at the point now where I'd rather see
what's in there get stabilised than spending serious effort on rushing
major new features in before the cut off. Additionally, I think this
would be an particularly good candidate for a new major version. (More
on that later.)Adam
Can you lot vote A, B, C or D to show your interest?
A) I want Array Of, but not Generics
B) I want Generics, but not Array Of
C) I want both
D) I want neither
-
Why is this a separate RFC? ...or is it?
-
That's not really what the discussion previously was about. Can we
instead have a vote on:
A) I want Foo[] syntax
B) I want Array<Foo> syntax
C) Neither
--
Andrea Faulds
http://ajf.me/
Can you lot vote A, B, C or D to show your interest?
A) I want Array Of, but not Generics
B) I want Generics, but not Array Of
C) I want both
D) I want neither
- Why is this a separate RFC? ...or is it?
Array of and Generics would be a different RFC from each other.
Array-of will go in first, Generics will come in later. I am asking
people to let me know if they give a hoot about generics, so we can
work out what is happening with the array of syntax.
- That's not really what the discussion previously was about. Can we
instead have a vote on:A) I want Foo[] syntax
B) I want Array<Foo> syntax
C) Neither
The discussion went to email between Sara G, Joe W and myself. They
brought me around and improved my understanding of generics - as I
explained it had one fatal flaw - and Sara explained that once "array
of" is in, generics would be a logical move to follow up.
We're at this point of:
"do we use "array of" syntax "Foo[]" and then later on if we want
generics do we add array<Foo> for generics, leaving the two features
available like in Java, but of course allow the rest of generic
functionality like $foo = new Tool<Spanner>();"
or
"do we use the generics syntax for this regardless, consider "array
of" to be "weak generics" then add full-on generics later on using the
same syntax"
This survey was intended to help a decision be made for the above two
statements. They actually match your A or B, but I wanted more insight
into how the group felt before trying to specifically force a syntax.
People might like the A syntax, but if that gets voted in we have
trouble down the road if people want generics, but if people dont want
generics then happy days who cares lets push A.
Can you see why insight is helpful here instead of just plowing on
into a dumb-vote? :)
Can you lot vote A, B, C or D to show your interest?
A) I want Array Of, but not Generics
B) I want Generics, but not Array Of
C) I want both
D) I want neitherNothing really binding here, its more of a survey than a vote, but it
should help with the next steps.
Long-term, I think we do need some form of "abstracted collection"
that's more capable than arrays, so I will say C. Whether that's
generics as we've been discussing them or not I'm not sure yet.
To reiterate for everyone else: This is not an RFC vote! It's a survey.
We've done a number of these "pre-vote informal survey" posts in the
Framework Interoperability Group, and they've proven extremely valuable
for determining if we have "rough consensus and working code" on a given
topic.
It's very very easy for one or two people to make it look like there's
no agreement whatsoever on a discussion thread, but when you reduce it
to "soft preferences" and get a poll with a broader cross-section of
people a very clear close-consensus often comes out of it. That can
help move the discussion forward with less debate and more hard data,
which is a good thing.
--Larry Garfield
I'd also vote C.
The general response I've had from everyone I've spoken to about this
is along the lines of C, but opinion is extremely divided over whether
typed arrays should have a syntax that echoes generics or not. At
first I was firmly in the Foo[] camp but I have come to like the idea
of array<Foo>. In the context of PHP, with an absence of "proper"
arrays, they really have no semantic difference, and it makes sense to
make them syntactically analogous.
Thanks, Chris
In recent discussions we were weighing up the options of array of and
generics came into conversation, brought forward from the Hack
language by Sara G.I was wrong about one thing: Generics CAN have setup outside of the
type-hint, much like a collection, but it is not required. I thought
it was.This means that array of could easily be considered "weak-generics"
and the two features can share the same syntax without confusion to
the user. A few of you said that, so sorry that I disagreed. ;)Before we worry too much about that, the logical next question is:
Is there any interest in generics? If there is interest, then one
syntax would be preferable over the other.With the existing proposed syntax for "array of", it looks like this:
function(Spanner[] $spanner)
Evolving that same syntax into generics would look something like this:
$tool = new Spanner[]; $tool = new int[];
That would be... less than ideal, but its nice and simple for the type hints.
Using the generics syntax for... generics:
function(array<Spanner> $spanner) $tool = array<Spanner>();
Obviously angle-brackets are a bit new, but that same syntax works for both.
These examples are provided to make a point, and the syntax is not
definite. The point here really is that If we care about generics,
then using generic-like syntax for this feature probably makes sense.
If we don't care about generics, then there is probably no point using
this more verbose syntax for simple "array of" type-hinting, but the
syntax could still easily change.Can you lot vote A, B, C or D to show your interest?
A) I want Array Of, but not Generics
B) I want Generics, but not Array Of
C) I want both
D) I want neitherNothing really binding here, its more of a survey than a vote, but it
should help with the next steps.