Nothing Special   »   [go: up one dir, main page]

[prev in list] [next in list] [prev in thread] [next in thread] 

List:       php-general
Subject:    Re: [PHP3] REBOL, New Language for the Net?
From:       Jim Winstead <jimw () php ! net>
Date:       1998-10-03 18:35:07
[Download RAW message or body]

On Oct 03, Rasmus Lerdorf wrote:
> I find these "natural language" languages extremely weird.  Natural
> languages are by definition imprecise and not all that well-structured.
> Designing a language to look like normal spoken English probably sounds
> like a good idea to some, but I have a feeling that once the novelty of
> the apparently easy learning curve wears off this syntax will actually
> start to be a hindrance.  

Having worked with such a language, I can say that is most definitely
true.  It looks like REBOL is more in the COBOL school of "natural
language" languages, though, which means it just has an arbitrarily
different and wordy syntax from other established programming languages.
(Why use square brackets as block delimiters when nearly every other
language out there uses curly brackets?)

For fun, an example of the language I used:

[ Declaration of a function to add an item to a list, keeping the list sorted. ]
To insert an item 'the_item' sorted into an item 'the_container':
    For each item 'the_place' in the_container,
        If the_item < the_place,
            Add the_item before the_place.
            Return.
    Append the_item to the_container.

Make a list named myList of { 2, 3, 7, 14}.
Insert 10 sorted into myList.
Print myList.
[ Prints 2, 3, 7, 10, 14, more or less. ]

> There may still be some ideas we can borrow from Rebol though.

Undoubtedly true. One idea worth borrowing from another language,
in my opinion, is JavaScript's for/in construct:

for (value in list) {
  do stuff;
}

Sure, that's essentially the same as:

while (list($key,$value) = each($list)) {
  do stuff;
}

But I find the for/in construct more readable. Even if you're not
familiar with the construct, it's very obvious what is going on, where
the PHP equivalent is a bit more opaque.

(And, actually, now that I take a second look at my example further
above, even the natural-language-ish language I'm talking about had
such a for/in construct. :)

Jim

--
PHP 3 Mailing List   http://www.php.net/
To unsubscribe send an empty message to php3-unsubscribe@lists.php.net
To subscribe to the digest list:  php3-digest-subscribe@lists.php.net
For help: php3-help@lists.php.net  Archive:  http://www.php.net/mailsearch.php3

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic