al, when it is used it should be
enforced. After all the user of my library has the option to dump it and go
for another library that does not force types. That is the beauty of having
options.
Tomi Kaistila
PHP Developer
--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, vis
, for the
simple fact that they are ignore by a major portion of PHP developers and to
use them would prompt a high risk of people writing bad code.
Also, now that you mentioned abstract classes, type hinting might also be
useful with interfaces.
Tomi Kaistila
PHP Developer
On Thursday 03
especially a blessing when writing library code. That way exceptions work for
the error management, instead of competing with it.
I say use E_WARNING at this stage. If there is some large redecorating with
PHP's error handling in the future, it can be changed then.
Tomi Kaistila
PHP Devel
s probably one of the simplest things they might demand
from a PHP developer.
> That's not what I am hearing here on the list.
I did not get this comment.
Tomi Kaistila
PHP Developer
--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php
value?
The one I mentioned not so long ago, or we you not paying attention? Having
the type hinted on the function declaration saves me the time and energy of
checking the type myself, which is something I have to do quite often. It, of
course not, remove the need to validate your arguments comp
> So, can we switch the mundane conversation from "should we have type
> hinting" to "why don't we have scalar type hinting if we have non-scalar
> type hinting?" That is the real conversation. Type hinting is here.
> It is not going anywhere. Let'
per cannot see
it, you risk blind-sighting him because one minute he expects only X to
happen and suddenly (usually upon discovering a bug, potentially in
production use) he notices that both X and Y happened.
Tomi Kaistila
PHP Developer
--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php
This does not invalidate
the need for either feature.
Tomi Kaistila
PHP Developer
--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php
t completely defeats the
purpose of type hinting.
Tomi Kaistila
PHP Developer
--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php
use new users, if the concept has already been approved and
implemented?
Tomi Kaistila
PHP Developer
--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php
not valid
// otherwise return a properly cast value
}
$input = $_GET['var1'];
$input = validate($input)
if(! empty($input)) {
doSomething($input);
}
This seems like a perfectly logical division of labor. The validator validates
and casts and the library class acts on the pro
r and that which occurs when it is not
a boolean. One will be a PHP error and the second will be an exception. Would
be easier on them if I do not use type hinting at all in that case.
I say, do it properly or do not do it at all.
Tomi Kaistila
PHP Developer
--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php
r way to fix this feature that was limited by
adding a seemingly useful attribute to it, but in the end still leaving the
feature limited and not really fixing anything.
Tomi Kaistila
PHP Developer
--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php
ach considered when the namespaces
were being implemented?
Tomi Kaistila
PHP Developer
--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php
mespaces can get unnecessarily confusing. After all, in PHP, the concept
of "packages" only exists in documentation.
Tomi Kaistila
PHP Developer
On Thursday 10 January 2008 11:42:29 you wrote:
> "use ProjectA;" is equivalent of "use ProjectA as ProjectA;"
>
>
Well if confusing is the goal, then yes, since this is classic Perl.
I started using PHP, instead of Perl, just so that I would not need play
around with confusing syntax.
Tomi Kaistila
PHP Developer
On Thursday 10 January 2008 15:56:54 Hannes Magnusson wrote:
> So you reject scalar t
cking as close to the old syntax
as possible is the best approach.
I would go with the choice B except instead of square brackets use round
brackets.
$a = (1, 2, 3, 4, 5);
$a = (1 => 'dharma', 2 => 'wilma');
This would be consistent with the old way of assignin
-1
Tomi Kaistila
PHP Developer
--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php
ol
structures; if(), for(), while(), which(), foreach(), etc. There is nothing
wrong with that. In my opinion, it only makes it clear and easy to catch when
you are reading code (particularly that which someone else wrote).
Tomi Kaistila
PHP Developer
--
PHP Internals - PHP Runtime Developme
ture was never about the technical merits
of it. It was just simply about some people saying "I don't like it" and thus
concluding that it should not be added.
Tomi Kaistila
PHP Developer
--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php
ial
ones but that will all be just extra. For me, it is more important to have
the basic primitive types (i.e. integer, boolean, etc.) than having generic
ones like 'object' or 'scalar'.
Tomi Kaistila
PHP Developer
--
PHP Internals - PHP Runtime Development Mailing Lis
21 matches
Mail list logo