镜像站点 · 本页由第三方 GitHub 只读镜像提供,非 GitHub 官方站点,不接受任何登录或凭据输入。前往 github.com
Skip to content

Document side effects of := on keys #7409

Closed

Description

@ben-schwen

The use of copy() here is subtle, it might be good to describe how to approach side effects a bit better in the documentation.

Originally posted by @MichaelChirico in #7401 (comment)

This should be added to our reference semantics vignette and probably to help(':=') if its not already there.

Activity

  1. MichaelChirico commented on Nov 4, 2025

    @MichaelChirico
    Member

    Oh, in the PR, what I meant is that it looks like

    test(n, optimization=c(1, 2), copy(DT)[...], ...)

    Will run copy() for each level of optimization, so there's a lazy evaluation aspect to x when optimization= is provided that impacts how to read and write tests using the new argument. Does that make sense?

  2. ben-schwen commented on Nov 4, 2025

    @ben-schwen
    MemberAuthor

    I see. In principle it is that seem as for other tests. If multiple execution of a single test works, then the execution of different optimization levels will also work. If a tests already has side effects such that running it twice will error, then ofc running it with different optimization levels will also error.

    Hence, one could say that

    test(n, optimization=c(1, 2), ...)

    is short for

    test(n, options(datatable.optimize=1), ...)
    test(n+eps, options(datatable.optimize=2), ...)
  3. added a commit that references this issue on Nov 5, 2025
    ac0aa29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions