Dr. J. J. "One Eyed CrackerJack" Harbaugh 



-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf
Of Ladislav Mecir
Sent: Friday, November 21, 2003 2:44 AM
To: [EMAIL PROTECTED]
Subject: [REBOL] Re: [data structures] (was Re:
[append][series]Appending to a series of strings)



Hi Joel and all,

Joel Neely napsal(a):

...snip...

>The design of every language with which I'm familiar reflects at
least 
>two issues:  the conceptual model used by the designer(s)  (or lack
>thereof!) and the decisions about what things to make easy for the 
>programmer using the language.
>
>Both Perl and REBOL make it easy to use a "variable" -- you just
start 
>using it and the language keeps up with what you're doing; no advance

>declaration is required.  OTOH Java makes it easy to detect errors in

>type mismatch as early as possible (at compile time), which REBOL and

>Perl can't catch until the program is running.
>
>Perl goes further and makes it easy to use data structures; if you
try 
>to modify/store data, the appropriate "place" is automagically
created 
>(and initialized to an appropriate value, depending on the operation 
>you are performing).  The Perl expression
>
>     ++$array[$n]
>
>means "add one to the nth element of array". If the array doesn't
have 
>n elements (or if the array doesn't even exist!), Perl will allocate 
>that position and and initialize it to zero before evaluating your 
>expression.
>  
>

>REBOL seems to occupy a middle-ground position on this issue; it does

>not require you to declare the existence of a data structure (as e.g.

>Java does) but it *does* require that you allocate and initialize it 
>explicitly.
>

I think, that you are describing *only* a top-down approach here. A 
bottom-up approach might lead to:

    get-value: function [
        {
            get an element of a numeric array using zero-based index,
            default value is zero
        }
        array [block!]
        index [integer!]
    ] [value] [
        value: pick array index + 1
        either value [value] [0]
    ]

    set-value: func [
        {
            set element of a numeric array using zero-based index,
            default value is zero
        }
        array [block!]
        index [integer!]
        value [number!]
    ] [
        insert/dup tail array 0 index + 1 - length? array
        poke array index + 1 value
    ]

    inc: func [
        {
            increment an element of a numeric array using zero-based
index,
            default value is zero
        }
        array [block!]
    ] [
        set-value array index 1 + get-value array index
    ]

>  REBOL certainly has some nice built-in facilities for processing 
>series data, but once you leave those you are *really* on your own.
>

In Rebol you can "teach" the language to do what you want it to,
because 
Rebol facilitates the process of the language extension.

>Language design decisions have far-reaching (and often subliminal) 
>effects on the subsequent design thinking of programmers using the
>language(s) in question.  One such issue that I find interesting is
the 
>question of when I -- as the programmer -- must commit to a decision 
>regarding the data structures used within my programs.
>
>COBOL and Pascal require that I commit to the type and size of every 
>array before submitting my programs to the compiler, and initialize
the 
>structures appropriately (at run time, but before any other use).
Java 
>requires me to commit to the type of an array, but lets me defer the 
>size committment until run-time when I actually initialize it. Newer 
>versions of Java provide the Vector class, which can be thought of as

>an array that can change size during use.  Perl and REBOL (and
Python, 
>et cetera) arrays/blocks not only let me dynamically resize during
use, 
>I don't even have to commit to a single type of data to put there!  
>Finally, (back to the original discussion) Perl will even
automatically 
>figure out when to allocate/initialize structures and elements for
me.
>  
>

What if you needed a different default value, wouldn't that leave you
on 
your own in Perl?

>Advocates of each of these languages will offer passionate arguments 
>for why the binding-time choices of their preferred language are
good. 
>As a polyglot, I'm less interested in picking sides in a political 
>debate than understanding deeply the effects on my own thinking when
I 
>begin to "think like a native" in one or more of them.
>
>-jn-
>  
>

I think, that the "effect on thinking" in Rebol may be caused more by 
inertia than by language limitations.

-L

-- 
To unsubscribe from this list, just send an email to
[EMAIL PROTECTED] with unsubscribe as the subject.


-- 
To unsubscribe from this list, just send an email to
[EMAIL PROTECTED] with unsubscribe as the subject.

Reply via email to