Re: PHP global namespace clogged up

From: Tony Marston (tony_at_NOSPAM.demon.co.uk)
Date: 09/06/04


Date: Mon, 6 Sep 2004 10:36:08 +0100


"Tim Tyler" <seemysig@cyberspace.org> wrote in message
news:2q2imbFqcghuU1@uni-berlin.de...
> 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.

So what you are saying is that PHP should drop its library of procedural
functions and replace it with a pure OO alternative? That would break
backwards compatability with all existing scripts so would be unacceptable
to the greater PHP community.

Dream on, moron.

-- 
Tony Marston
http://www.tonymarston.net
> 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.
> 


Relevant Pages

  • Re: Program compression
    ... means using tools (such as parse-tree rewrite rules or syntax ... enough keyword and/or syntax to trigger expansion back to the full ... let's say you have a text string which contains the notation ... favorite notation for nested lists is, ...
    (comp.programming)
  • Re: Ruby performance woes
    ... With PHP, I needed to set up a .HTACCESS file which enabled PHP on ... to convert either syntax to fully HTML output) ... into and out of a scriptlet to mix output generated by scriptlets ... within a single huge format string within a single call to FORMAT, ...
    (comp.lang.lisp)
  • RE: [PHP] two small issues with php mail
    ... If you had taken the breaths and calmed down when Stut wrote you, Chris would not have had to rewrite your own code to show the simple syntax flub that was partially causing your issue. ... [PHP] two small issues with php mail ... If Stut's answer does not make sense to you, google concatenate in the ... Can anyone show me where an "order of operations" for php mail might be ...
    (php.general)
  • Re: First class types and their representation
    ... It makes sense to use a common representation ... now, the notation is a little hairy, but it is possible to map much of a C ... however "i" is regarded as a single element terminating after the the ... types, but thus far this has not been needed (if I were to add a syntax, I ...
    (comp.lang.misc)
  • Re: modifying array access syntax
    ... What I had in mind is something that resembles standard notation for the field in question, ... Recall that for beginners in mathematics, the notations typically used in mathematics are by far not obvious. ... So I think the basic tradeoff is as follows: If your interest is to develop the code for your own experiments, it's probably more effective to invest some time into learning the Lisp syntax in order to forget about syntactic issues altogether in the long run. ...
    (comp.lang.lisp)