Skip to content

Unable to deserialize object #34

Closed

Description

@srozb

Hi,
I was trying to serialize and deserialize bloom filter object, and deserialization gives me the following error during the compilation:

flatty-0.3.4/flatty.nim(171, 23) Error: for a 'var' type a variable needs to be passed; but 'uint64(x.capacity)' is immutable

code causing the issue is:

proc importFlatty*(srcPath: string): Bloom =
  result = srcPath.readFile().fromFlatty(Bloom)

and it works perfectly the opposite way (toFlatty).

Is that a bug or me doing something wrong?

Activity

  1. treeform commented on Sep 26, 2022

    @treeform
    Owner
  2. srozb commented on Sep 27, 2022

    @srozb
    Author

    Here's the minimal example:

    import flower, flatty
    
    var 
      bloom = newBloom(10, 0.01)
      bl = fromFlatty(toFlatty(bloom), Bloom)
    nim c -r test.nim
    /Users/slawek/tmp/bloombug/test.nim(5, 18) template/generic instantiation of `fromFlatty` from here
    /Users/slawek/.nimble/pkgs/flatty-0.3.4/flatty.nim(291, 4) template/generic instantiation of `fromFlatty` from here
    /Users/slawek/.nimble/pkgs/flatty-0.3.4/flatty.nim(171, 23) Error: for a 'var' type a variable needs to be passed; but 'uint64(x.capacity)' is immutable
    

    Tested with flatty [0.3.4] and flower [1.0.0]. Imports included in the same file.

  3. added 2 commits that reference this issue on Mar 24, 2023
    0201d89
    9579673
  4. treeform commented on May 25, 2026

    @treeform
    Owner

    Thank you for your issue. I have been working on flatty for a bunch of things, and I think I have fixed this in this PR: #52

    Feel free to re-open the issue if it still happens to you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions