Re: Is this a missing feature?

From: Date: Mon, 05 Feb 2001 00:19:08 +0000
Subject: Re: Is this a missing feature?
References: 1 2 3 4 5 6  Groups: php.general 
Request: Send a blank email to php-general+get-38160@lists.php.net to get a copy of this message
sure here's the ruby page: http://www.ruby-lang.org/ here's another ruby site: http://www.rubycentral.com/ there's also a really good book you can find info about here: http://pragmaticprogrammer.com/ruby/index.html it's not really used much yet anywhere except japan, where it's actually overtaken python in popularity! later lux Josh G wrote:
What's this ruby? Care to send the list a URL so we can go have a look for ourselves?
Gfunk         -          http://www.gfunk007.com/
I sense much beer in you. Beer leads to intoxication, intoxication to hangovers, and hangovers to... suffering. ----- Original Message ----- From: "Lux" <me@simian.ca> To: <creinig@mayn.de> Cc: <php-general@lists.php.net> Sent: Monday, February 05, 2001 10:51 AM Subject: Re: [PHP] Is this a missing feature?
But the feature is useless :)
Here, I removed the reference, so we can stop fussing over it (it wasn't
the
question to begin with), and here's an example of a potential use for this
(a stupid example, but still...). I'm not weighing out the benefits of
references, I'm striving to achieve the cleanest and most elegant code I
can, because the larger the project, the more code you have to read, and
the uglier it can get.
That's where a language like Ruby excels. There's less syntactical crap,
it's very easy to read, and it's caused me to consider switching to eRuby
(like mod_perl, allows <% ruby this, ruby that %> in your html) because it
is structurally easier and more geared towards larger projects.
(that last statement will probably get me murdered on a PHP list)
But honestly, the only problem is finding a host running eRuby that I
don't
have to maintain myself. I'm lazy, after all.
later,
lux
<?php
    function a ($hash, $text = "") {
       $attr_text = "";
       while (list ($k, $v) = each ($hash)) {
          $attr_text .= " $k=\"$v\"";
       }
       return "<a$attr_text>$text</a>";
    }
    function img ($hash) {
       $attr_text = "";
       while (list ($k, $v) = each ($hash)) {
         $attr_text .= " $k=\"$v\"";
       }
       return "<img$attr_text />";
    }
    // works this way
    $attrs = array (
       "href" => "http://www.google.com/",
       "target" => "_blank"
    );
    echo a ($attrs, "Visit Google!");
    echo "\n\n";
    // also this way (thanx teodor!)
    echo a ($attrs = array (
         "href" => "http://www.google.com/",
         "target" => "_blank"
    ), "Visit Google!");
    // ideally, i'd like to say this though...
    // echo a (["href" => "http://www.google.com/", "target" =>
"_blank"], "Visit Google!");
    // what also doesn't work
    // echo a (array("href" => "http://www.google.com/", "target" =>
"_blank"), "Visit Google!");
    echo "\n\n";
    // another example
    echo a ($attrs = array ("href" => "http://www.google.com/"),
         img ($attrs = array (
             "src" => "http://www.google.com/images/title_homepage4.gif",
             "alt" => "Visit Google!",
             "border" => "0")
         )
    );
    /* now ideally, this could be written much more cleanly, perhaps...
    echo a(['href' => [http://www.google.com/'],
         img(['src' =>
'http://www.google.com/images/title_homepage4.gif', 'alt' => 'Visit
Google!', 'border' => '0'])
    );
    */
?> --
John Luxford
Simian Systems
w: www.simian.ca
e: lux@simian.ca
p: 204.946.5955
--
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net
For additional commands, e-mail: php-general-help@lists.php.net
To contact the list administrators, e-mail: php-list-admin@lists.php.net
-- John Luxford Simian Systems w: www.simian.ca e: lux@simian.ca p: 204.946.5955 --

« previous php.general (#38160) next »