Just a random thought I have from reading over that:
Would it not be more 'natural' to change 'function' to indicate a
method with a variant return type, and allow e.g.
'int somefunc()' instead of 'function (int) somefunc()' to indicate an
int return?
It would be a bit more in fitting with
Robin Burchell wrote:
Just a random thought I have from reading over that:
Would it not be more 'natural' to change 'function' to indicate a
method with a variant return type, and allow e.g.
'int somefunc()' instead of 'function (int) somefunc()' to indicate an
int return?
it would break
Hmm. How would it break it?
By leaving 'function' to mean variant, it's only adding new
functionality by overriding types to replace 'function', which should
have no issue with older code, surely?
To clarify:
current method declaration:
function foo()
public static function foo()
public
On Fri, Dec 19, 2008 at 3:31 PM, Nathan Rixham nrix...@gmail.com wrote:
type hints are all ready there so adding primitives /should/ be possible
without any bc issues
PHP is loosely typed. Adding typehints to primitives would change
this. The only reason that it is working with object types, is
On Fri, Dec 19, 2008 at 2:40 PM, troels knak-nielsen troel...@gmail.com wrote:
PHP is loosely typed. Adding typehints to primitives would change
this. The only reason that it is working with object types, is because
you can't automatically coerce object types anyway.
--
troels
I'm not sure
Robin Burchell wrote:
Hmm. How would it break it?
By leaving 'function' to mean variant, it's only adding new
functionality by overriding types to replace 'function', which should
have no issue with older code, surely?
To clarify:
current method declaration:
function foo()
public static
Ugh. Apparantly I forgot to CC the list on those last two mails..
Sorry. Pasted so others stay in on the conversation:
On Fri, Dec 19, 2008 at 3:18 PM, troels knak-nielsen troel...@gmail.com wrote:
snip
That's an interesting mail, expresses a viewpoint I hadn't considered,
so, thanks for that.
On 12/19/2008 17:39, Robin Burchell wrote:
Ugh. Apparantly I forgot to CC the list on those last two mails..
Sorry. Pasted so others stay in on the conversation:
On Fri, Dec 19, 2008 at 3:18 PM, troels knak-nielsentroel...@gmail.com wrote:
snip
That's an interesting mail, expresses a
Nathan Rixham wrote:
[...]
while I'm here I may as well also ask about further adding type
hinting for the existing scalars and array.
+1, but I don't know what might have stopped it being implemented before
(time, parsing API changes, etc), so it would be interesting to look
into the history.
2008/12/18 Dave Ingram d...@dmi.me.uk
Also, what about this case:
class MyTestClass {
public function blah(Foo $f);
public function blah(Bar $b);
public function blah($v);
}
I would argue that the most specific function should be called, but how
costly would that be to determine?
2008/12/18 Dave Ingram d...@dmi.me.uk
Nathan Rixham wrote:
[...]
while I'm here I may as well also ask about further adding type
hinting for the existing scalars and array.
+1, but I don't know what might have stopped it being implemented before
(time, parsing API changes, etc), so it
Dave Ingram escribió:
class MyTestClass {
public function blah(Foo $f);
public function blah(Bar $b);
public function blah($v);
}
Looks like you are using the wrong language, you need JAVA instead.
--
We have art in order not to die of the truth - Friedrich Nietzsche
Cristian
I remember that multiple signatures was said to have a possible very
difficult implementation. However, a similar behaviour can be achieved by
some instanceof().
I thought it probably would be awkward, but we do already have some type
hinting that can also be accomplished with instanceof()
Cristian Rodríguez wrote:
class MyTestClass {
public function blah(Foo $f);
public function blah(Bar $b);
public function blah($v);
}
Looks like you are using the wrong language, you need JAVA instead.
Yes, I'll admit it does look like Java (or any C++-like OO language) -
Dave Ingram wrote:
I remember that multiple signatures was said to have a possible very
difficult implementation. However, a similar behaviour can be achieved by
some instanceof().
I thought it probably would be awkward, but we do already have some type
hinting that can also be
Dave Ingram wrote:
Cristian Rodríguez wrote:
class MyTestClass {
public function blah(Foo $f);
public function blah(Bar $b);
public function blah($v);
}
Looks like you are using the wrong language, you need JAVA instead.
Yes, I'll admit it does look like Java (or any C++-like OO
Nathan Rixham wrote:
Dave Ingram wrote:
Cristian Rodríguez wrote:
class MyTestClass {
public function blah(Foo $f);
public function blah(Bar $b);
public function blah($v);
}
Looks like you are using the wrong language, you need JAVA instead.
Yes, I'll admit it does look like
2008/12/18 Nathan Rixham nrix...@gmail.com:
Nathan Rixham wrote:
and strongly typed returns.. nearly forgot
public static function parseByte( Number $var ):bool {
or
public static function bool parseByte( Number $var ) {
or such like
Theres already an RFC for this:
Don't want to take up much of you're time, just wondered if anybody
could point me to the reason why some primitives aren't in php.
Would find it very very useful to have byte, short, long, float, double
and char in php. (primarily byte and char).
while I'm here I may as well also ask about
Hi,
I think the reason there aren't more primitive types in PHP is because of
the nature of the language. One of the main features of PHP over say, C (and
even Java), is that the memory managment is completely transparent to the
devloper. This means that it really shouldent matter to the devloper
Graham Kelly wrote:
Hi,
I think the reason there aren't more primitive types in PHP is because of
the nature of the language. One of the main features of PHP over say, C (and
even Java), is that the memory managment is completely transparent to the
devloper. This means that it really shouldent
21 matches
Mail list logo