Skip to content

Multiple definitions; good design for limiting allocation? #55

@timholy

Description

@timholy

Revise can get desynchronized from the file state by the following sequence of user actions:

  1. cut the definition of foo(x::T) from fileA.jl, but do not yet save the file
  2. paste definition into fileB.jl (another file in the same package) and save the file
  3. trigger a revision
  4. save fileA.jl and trigger a revision

After item 3, there are technically duplicated definitions of the method (and if the user had quit and rebuilt the package at this point s/he would get a precompile error). After item 4, Revise will helpfully delete the method, not realizing it had been duplicated. So attempts to use the method will henceforth fail.

I used to think of this as "user error" (the user should have saved fileA.jl before triggering the first revision) but lately I've come to think it should be treated as a Revise bug. The question is how best to implement a fix. It seems the most thorough fix would involve making method_info a sig=>list-of-definitions dict rather than a sig=>definition dict. If list-of-definitions is a Vector, though, there are going to be an awful lot of vectors with just one element. Any thoughts on a better way to do this?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions