Re: PHP global namespace clogged up
From: Tim Tyler (seemysig_at_cyberspace.org)
Date: 09/06/04
- Next message: Tim Tyler: "Re: PHP global namespace clogged up"
- Previous message: Carolyn Gill: "Re: Help with rotator script error"
- In reply to: Terence: "Re: PHP global namespace clogged up"
- Next in thread: Tony Marston: "Re: PHP global namespace clogged up"
- Reply: Tony Marston: "Re: PHP global namespace clogged up"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Mon, 06 Sep 2004 08:42:37 +0100
Terence wrote:
> Tim Tyler wrote:
>> I think:
>>
>> $a = "98.6";
>> $b = $a->floor();
>>
>> ...should fail with an "unknown method" error - and would suggest using:
>>
>> $a = "98.6";
>> $b = $a->number()->floor();
>
> or perhaps
>
> $a = "98.6";
> $b = real::parse($a); // $b is a real
> $b = (int)$b->floor(); // now $b is an int
If you want an integer - rather than a number - that doesn't look
unreasonable - but it seems further modified from the original code.
> this still requires some flexibility of typing but it's hard to know
> where to draw the line.
>
> either way, you will now *REQUIRE* ALL PHP programmers to use an OO
> notation. Unless they understand even the most basic principles of OO,
> the syntax will look confusing. I personally didn't bother to check out
> the OO side of PHP for many months after I first started learning it. It
> was a few years before I took advantage of it in any serious way.
> Requiring people to understand OO concepts straight of the bat is not
> going to help it's ease of adoption for people who aren't already
> programmers before they get into the language. Remember, PHP's shining
> success is based on it's easy accessibility. While your suggested
> notation may strenghten one of PHP's weaknesses, I believe introducing a
> compulsory OO notation will undermine it's fundamental strength of easy
> adoption.
$a -> method() is really not any harder than method($a) to learn.
I can see an issue if you have to learn two ways of doing things
(rather than one) - but that would not be needed.
Beginners would be helped by by not having two learning curves
to climb - one for the procedural syntax and one for the OO syntax.
There are also things such as getting a drop-down auto-complete
list of functions when they type $a -> in their IDE - in the
case where the type of the variable can be determined analytically
before runtime.
-- __________ |im |yler http://timtyler.org/ tim@tt1lock.org Remove lock to reply.
- Next message: Tim Tyler: "Re: PHP global namespace clogged up"
- Previous message: Carolyn Gill: "Re: Help with rotator script error"
- In reply to: Terence: "Re: PHP global namespace clogged up"
- Next in thread: Tony Marston: "Re: PHP global namespace clogged up"
- Reply: Tony Marston: "Re: PHP global namespace clogged up"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|