Ahh, but it's not a constant, now, is it?

>> foo: does [
[      bar: "Hello"
[    ]
>> append second :foo [print bar print bar]
== [
    bar: "Hello" print bar print bar
]
>> insert skip second :foo 4 [append bar { to you!}]
== [print bar]
>> source foo
foo: func [][
    bar: "Hello" print bar append bar " to you!" print bar
]
>> foo
Hello
Hello to you!


This is a nice(ish) way to modify large already-existing functions without 
having to copy the whole source into a script.

> By "constant" I meant hard-coded, literal values. For example:
>
> foo: does [
>  bar: "Hello"
> ]
>
> Bar is a copy of "Hello", and not pointing directly to "Hello". So =? 
> would
> fail. I agree, this could cause other problems. I really do like the way
> REBOL handles this already, but it certainly took a bit to 1) find out, 
> and
> 2) remember and get used to.
>
> I didn't know that's how join worked. Thanks! That can definitely simplify
> some code. I do think that an operator would be nice just from a code
> simplication stand-point, but beauty is also in the eye of the beholder.
>
> Jeff M.
>
> --
> [EMAIL PROTECTED]
>
> On 5/2/06, Gabriele Santilli <[EMAIL PROTECTED]> wrote:
>>
>>
>> Hi Jeff,
>>
>> On Monday, May 1, 2006, 7:50:13 PM, you wrote:
>>
>> JM> 1. Make "constant" data just that - constant. Make the copy implicit
>> when
>> JM> binding a word to constant data. This would be quite easy, and would
>> solve a
>> JM> lot of headaches before they happen.
>>
>> By  constant data, you mean any LOADed data? I sense more problems
>> here than solutions. :)
>>
>> JM> 2. Have a series building operator (++ comes to mind from Haskell),
>> which
>> JM> acts as a copy + append. This is a little scarey, because I think 
>> most
>> JM> people would just use ++ instead of append, and without knowing that
>> it does
>> JM> a copy, we're back to potential O(n^2) performance issues.
>>
>> >> source join
>> join: func [
>>     "Concatenates values."
>>     value "Base value"
>>     rest "Value or block of values"
>> ][
>>     value: either series? value [copy value] [form value]
>>     repend value rest
>> ]
>>
>> So  the  only  difference is that JOIN is copy + repend instead of
>> copy + append.
>>
>> Regards,
>>    Gabriele.
>> --
>> Gabriele Santilli <[EMAIL PROTECTED]>  ---  http://www.rebol.com/
>> Colella Chiara software division --- http://www.colellachiara.com/
>>
>> --
>> To unsubscribe from the list, just send an email to
>> lists at rebol.com with unsubscribe as the subject.
>>
>>
>
> -- 
> To unsubscribe from the list, just send an email to
> lists at rebol.com with unsubscribe as the subject.
> 

-- 
To unsubscribe from the list, just send an email to 
lists at rebol.com with unsubscribe as the subject.

Reply via email to