Mailing List Archive: 49091 messages
  • Home
  • Script library
  • AltME Archive
  • Mailing list
  • Articles Index
  • Site search

[REBOL] Re: Rebol vs PHP

From: rebol:techscribe at: 25-Jan-2001 1:03

Hi Justin, Graham, Graham Chiu wrote:
> I don't PHP, but I would have thought that PHP being an > Apache module would be faster, and less memory/resource > intensive.
It probably depends on what exactly you are doing. My experience with PHP is it uses up a lot of memory. I had to split some scripts up into multiple files, because I was getting an "Out of memory" message on a box that has 512MB RAM or more.
> The other point is whether you really want to use Access > databases to web serve information. It's intended use is as > a desktop database.
That's a very good point. There are plenty of very stable, commercial quality Open Source (or at least free) databases out there that are far better suited for an online application. Examples: MySQL, Interbase, FreeBase, and many more. PHP's object implementation is a little weird (look at the trouble you can get yourself into if you use the PHP XML parser from within an object, or if you try to pass the XML parser functions defined in a derived object). Iterating over associative arrays also isn't always fun. While the syntax looks simple enough: while ( list($key, $value) = each ($a_array) { do_something($key, $value); } you actually get each value listed twice: once in assoication with a key that is the index of the value, and a second time with a key that is the key you associated with the value. That's kind of relevant when you want to associate the fieldnames with the values stored in the fields. REBOL does not have the problems I just listed. You can learn REBOL much faster because the REBOL shell is interactive. You can instantly test out ideas for the same reason. REBOL has better error trapping and debugging support. The wealth of datatypes supported by REBOL and its parametric polymorphism make it alot easier to implement code that works as expected. Just compare the code needed under PHP to send an email message, and compare it to the simple REBOL code that you can enter in the REBOL shell
>> send [rebol-list--rebol--com] "Hi guys, really great programming language."
I find that REBOL enables me to express my intentions much faster and more precisely than PHP. If I'm expected to deliver PHP code, I usually prefer to write REBOL functions that will generate the PHP code, and then express my code in REBOL, or write a small dialect and implement a REBOL compiler that generates the appropriate REBOL code based on the code I write in my dialect. One reason for this approach is that PHP has many more syntactic gotchas then REBOL (the obligatory $ sign at the beginning of variables, which is occassionally forgotten, the obligatory -> operator to access object functions and variables, which occassionally ends up being -, the obligatory ; at the end of each statement, which is occassionally forgotten, it slows you down, especially together with PHP's very terse error messages.) In short, PHP is quite cool, REBOL is great. Sometimes you have to use PHP, unless you have access to REBOL/Command, because /Core has no built-in support for databases. But if you were planning to use Access, then quite possible you don't have a database intensive aplication in mind, and using REBOL plain text files will be sufficeint to store your data. Perhaps something as simple as this REBOL [] address-book: [ "Peter" "Smith" "555 5551212" "345 N. Nowhere Rd." "Noc Ity" "NO State" "Barbara" "Jones" "111 121 5555" "543 S. Somewhere Rd." "Somec Ity" Same State ] print [<HTML><HEAD></HEAD><BODY>] print <table> foreach [first-name last-name phone address city state] address-book [ print [<tr><td>] print [first-name last-name phone address city state] print [</tr></td>] ] print </table> print [</BODY></HEAD></HTML>] will do? Hope this helps, Elan