Hi, Greg,

Gregg Irwin wrote:
> 
> Scenario:
> 
> You have a number of words that you want initialized to "copy []" or
> some other value. Do you do it like this?
> 
>     foo: copy []
>     bar: copy []
>     baz: copy []
>     
> Or like this?
> 
>     foreach word [foo bar baz][set word copy []]
> 
> Or something else.
> 

Occasionally I might write

     foo: copy bar: copy baz: copy []

to emphasize that they're all "alike" in some way.  That also scales
well if the intial value is more complex than [] (especially if it
must be computed, but that value -- or a copy -- is needed for more
than one variable).

Otherwise, I'd probably use your first case.

 >
> Do you use a different approach for more or less words?
> 

If I had more words than the above, I'd start looking at whether I
needed to redesign so that they all were parts of a larger data
structure, rather than individual words.

 >
> Do you do things differently if you're setting words in a object?
>

When setting up an object, I usually prefer the

     foo: ...
     bar: ...
     baz: ...

format to make the members of the object very clearly visible.

> 
> Do you do something different based on the initial value?
> 
> Is there anything else you take into consideration when you do this
> kind of thing?
> 

For both of these, see above comments re scaling and number of
distinct copies.

 >
> Thanks for playing!
>         

Thanks for asking! ;-)

-- 
----------------------------------------------------------------------
Joel Neely            joelDOTneelyATfedexDOTcom           901-263-4446

Counting lines of code is to software development as
counting bricks is to urban development.


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

Reply via email to