Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WISH: set OBJECT from OBJECT #2358

Open
Oldes opened this issue Jan 30, 2019 · 0 comments
Open

WISH: set OBJECT from OBJECT #2358

Oldes opened this issue Jan 30, 2019 · 0 comments

Comments

@Oldes
Copy link

Oldes commented Jan 30, 2019

It would be nice to be able set all keys in existing object from another object.
Imagine to have:

spec: object [a: b: c: none]

and data object which may looks like:

data: object [x: 3 a: 1 y: none]

and you want to make object with only fields of the spec with possible values of data object.
In Red it is possible to use set:

>> set new: copy spec data  new
== make object! [
    a: 1
    b: none
    c: none
]

In R3 it now does this nonsense:

== make object! [
    a: make object! [
        x: 3
        a: 1
        y: none
    ]
    b: make object! [
        x: 3
        a: 1
        y: none
    ]
    c: make object! [
        x: 3
        a: 1
        y: none
    ]
]
Oldes added a commit to Oldes/Rebol3 that referenced this issue Feb 1, 2019
…ge version

There is new refinement /ONLY which treat source block or object like single value (so the result is like it was in R3-alpha)

The /PAD refinement was replaced with /SOME refinement. The functionality is now reversed: when no refinement is used, it works like if there was /PAD before. If /SOME is used, there is no padding and also target value is not replaced with none value from the source, if there is any.

Related issue: metaeducation/rebol-issues#2358
Oldes added a commit to Oldes/Rebol3 that referenced this issue Feb 1, 2019
…ge version

There is new refinement /ONLY which treat source block or object like single value (so the result is like it was in R3-alpha)

The /PAD refinement was replaced with /SOME refinement. The functionality is now reversed: when no refinement is used, it works like if there was /PAD before. If /SOME is used, there is no padding and also target value is not replaced with none value from the source, if there is any.

Related issue: metaeducation/rebol-issues#2358
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants