diff --git a/src/main/java/com/github/jlangch/venice/impl/reader/Reader.java b/src/main/java/com/github/jlangch/venice/impl/reader/Reader.java index f09617c3b..236fd471f 100644 --- a/src/main/java/com/github/jlangch/venice/impl/reader/Reader.java +++ b/src/main/java/com/github/jlangch/venice/impl/reader/Reader.java @@ -418,10 +418,19 @@ private static VncVal parseMetaData(final Reader rdr) { rdr.next(); final Token metaToken = rdr.peek(); VncVal meta = read_form(rdr); + if (Types.isVncKeyword(meta)) { - // allow ^:private is equivalent to ^{:private true} - meta = VncHashMap.of(meta, VncBoolean.True); + final String qName = ((VncKeyword)meta).getQualifiedName(); + if (qName.equals("private") || qName.equals("dynamic")) { + // allow ^:private is equivalent to ^{:private true} + // allow ^:dynamic is equivalent to ^{:dynamic true} + meta = VncHashMap.of(meta, VncBoolean.True); + } + else { + meta = VncHashMap.of(MetaUtil.TYPE, meta); + } } + if (Types.isVncMap(meta)) { final Token symToken = rdr.peek(); return read_form(rdr).withMeta(MetaUtil.mergeMeta(meta, MetaUtil.toMeta(symToken))); diff --git a/src/test/java/com/github/jlangch/venice/impl/reader/ReaderTest.java b/src/test/java/com/github/jlangch/venice/impl/reader/ReaderTest.java index 811900c35..269e98580 100644 --- a/src/test/java/com/github/jlangch/venice/impl/reader/ReaderTest.java +++ b/src/test/java/com/github/jlangch/venice/impl/reader/ReaderTest.java @@ -59,8 +59,13 @@ public void testMeta() { assertEquals(100L, new Venice().eval("(do (def ^{:a 200} x 100) x)")); assertEquals(200L, new Venice().eval("(do (def ^{:a 200} x 100) (:a (meta x)))")); assertEquals("(xx yy)", new Venice().eval("(do (def ^{:a '(\"xx\" \"yy\")} x 100) (str (:a (meta x))))")); + assertEquals(true, new Venice().eval("(do (def ^:private x 100) (:private (meta x))))")); - } + assertEquals(true, new Venice().eval("(do (ns test) (def ^:private x 100) (:private (meta x))))")); + + assertEquals(true, new Venice().eval("(do (def ^:dynamic x 100) (:dynamic (meta x))))")); + assertEquals(true, new Venice().eval("(do (ns test) (def ^:dynamic x 100) (:dynamic (meta x))))")); + } @Test public void testAtomInteger() {