-
Notifications
You must be signed in to change notification settings - Fork 1k
Closed
Description
Reading #6862 I found this behaviour:
ds = copy(datasets::iris)
x = setDT(get("ds"))
attr(ds, ".internal.selfref") # <pointer...>
ds = copy(datasets::iris)
x = setDT(get0("ds")) # note get0
attr(ds, ".internal.selfref") # NULL
Both ds's set as data.table's but in the second form, ds lacks selfref.
AFAIK setalloccol() is shallow copying ds, but then setDT fails to reassign it to the symbol ds because not recognizing 'get0' bindimg.
Arguably there is no easy way to detect the binding for every possible call that returns a data.table bound to a symbol, so I think setDT should warn when it is unable to assign it back -if a shallow copy is made-. or if ds lacks selfref before returning.
However, x does have it, and thus identical(ds, x) fails in second case.
Related perhaps #6754
Metadata
Metadata
Assignees
Labels
No labels