Skip to content
This repository was archived by the owner on Nov 9, 2017. It is now read-only.
This repository was archived by the owner on Nov 9, 2017. It is now read-only.

Nested let-mutable's #7

@vitvly

Description

@vitvly

Hi!

Thank you for your open-source work!

I've recently ran into an issue with Proteus, namely that

(let-mutable [a 3
              b (let-mutable [c 1 ]
                  c)]
  b)

will yield

CompilerException java.lang.ClassCastException: java.lang.Long cannot be cast to proteus.Containers$L, compiling:(proteus.clj:123:1)

After macro-expanding it turns out that read-form gets applied twice to c. After some debugging i've figured out how to address the issue by modifying the code of read-form to

(defn- read-form [x]
  (if (not (:tag (meta x)))
    (-> (locals) (find x) key* meta ::read-form)
    nil))

It checks for the presence of :tag in local's metadata, which should only be there if it is being processed by the let-mutable macro at the current level of nesting.

It seems that a corresponding fix to write-form is not necessary.

If the above is correct and there are no stupid mistakes on my part, i can make a pull request.

Thanks again,
Vitaliy.

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