Skip to content
This repository has been archived by the owner on Jan 28, 2019. It is now read-only.

Var metadata contracts #62

Merged
merged 6 commits into from
Feb 13, 2016
Merged

Var metadata contracts #62

merged 6 commits into from
Feb 13, 2016

Conversation

arrdem
Copy link
Collaborator

@arrdem arrdem commented Feb 13, 2016

This changeset implements #42 and provides both Var metadata property
caching (^:dynamic, ^:private etc.) and correct cache updating when
metada changes.

As a consequence of this change, it becomes necessary to patch core so
that it correctly manages Var state changes.

@arrdem
Copy link
Collaborator Author

arrdem commented Feb 13, 2016

So this works, and works well. The only real question is under what conditions should Vars emit warnings that their options/state are changing. Right now only ^:dynamic being discarded is cause for a warning. By default, vars loose ^:macro silently on redef. Maybe ^:private being changed is cause for a warning as well? Over in #60, change for ^:once should almost certainly be cause for a warning.

@arrdem arrdem force-pushed the feature/42 branch 6 times, most recently from 2681f88 to 340c397 Compare February 13, 2016 20:38
Just a quick wrapper for generating the increasingly used
file/line/column string.
This patch makes Var impement the metadata parts of AReference itself,
so that changes to metadata can be observed. This allows Var to update
the internal status flags corresponding to isPublic, isDynamic, isMacro
etc.

This deals with a class of state errors wherein the metadata of the Var
would not correctly reflect the state of the Var. For instance, since
privacy was decoupled from ^:private, it was possible for a Var to
become `{:private true}` and be .isPrivate() -> False, and vice versa.

Furthermore this patch causes Var to emit warnings when a Var looses its
^:dynamic, ^:once or ^:private bits. This helps capture a class of user
metadata update errors where the Var's metadata is simply reset.

Fixes #42
This patch deals with one instance of the Var metadata state loss
bugs. *agent* is dynamic, has a tag and metadata. Previously, its
metadata was altered in RT with .resetMeta(), which lost the ^:dynamic
flag.

This patch fixes that bug, and moves the metadata and tag initialization
of *agent* into core since it doesn't need to be in RT at all.
This patch again fixes metadata updating issues. So that tests can alter
it to access basic printing, print-initialized is supposed to be private
and dynamic. It is initially false valued, but is eventually redefined
to be true once Clojure's printing has been initialized.

This patch fixes the way that print-initialized is redefined so that
pertinent metadata is not lost.
arrdem added a commit that referenced this pull request Feb 13, 2016
@arrdem arrdem merged commit 7fe0d1e into develop Feb 13, 2016
@arrdem arrdem deleted the feature/42 branch February 13, 2016 23:52
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant