Extending Contexts (OBJECT!, MODULE!, etc)

In R3-Alpha, it is possible to append key/value pairs to objects via a block:

>> obj: make object! [a: 10]
== make object! [
   a: 10

>> append obj [b: 20 c: 30]
== make object! [
    a: 10
    b: 20
    c: 30

You can't do that in Rebol2, and Red did not carry it forward.

But in Ren-C, isotopes are not allowed in blocks. It's more powerful if there is an operation which extends the object via a block which gets evaluated... much as the block in MAKE OBJECT! is evaluated.

As a general rule, APPEND should certainly not be REDUCE-ing block arguments. So some other operation is needed

Red has an EXTEND operation, but it is "reserved for future use":

     EXTEND obj spec

     Extend an object or map value with list of key and value pairs. 
     EXTEND is a native! value.

     obj          [object! map!] 
     spec         [block! hash! map!] 

     /case        => Use case-sensitive comparison.

Given that it's not implemented, we don't know if that spec block is intended to be evaluated or not. Also, we'd assume EXTEND would create a new object (since their objects don't expand).

Anyway, APPEND to an OBJECT! is something that probably doesn't make sense.

1 Like

Interesting that Red's EXTEND differs from R3-Alpha's. I'd speculate that the spec would be REDUCED and APPENDED similar to your APPEND block there consistent with MAKE OBJECT! [...]