This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2023-02-13
Channels
- # announcements (12)
- # babashka (88)
- # beginners (60)
- # biff (10)
- # calva (56)
- # clerk (9)
- # clj-kondo (5)
- # clojure (70)
- # clojure-austin (3)
- # clojure-conj (2)
- # clojure-dev (69)
- # clojure-europe (53)
- # clojure-nl (1)
- # clojure-norway (28)
- # clojure-uk (1)
- # clojurescript (27)
- # copenhagen-clojurians (3)
- # cursive (10)
- # datascript (1)
- # datomic (10)
- # fulcro (3)
- # funcool (1)
- # garden (7)
- # helix (5)
- # holy-lambda (5)
- # hyperfiddle (39)
- # introduce-yourself (6)
- # jobs-discuss (15)
- # lsp (3)
- # malli (5)
- # membrane (19)
- # missionary (1)
- # nrepl (6)
- # off-topic (44)
- # pathom (17)
- # pomegranate (3)
- # react (7)
- # releases (1)
- # shadow-cljs (39)
- # tools-deps (16)
- # xtdb (28)
Hi, is it possible to use a schema with unique tagged values to retrieve the the corresponding field in a value that validates against that shcema? e.g.
(def Nested [:map
[:a
[:map [:b
[:map [:c
[:map [:d :string]]]]]]]])
(m/walk-and-get Nested :d {:a {:b {:c {:d "the value of d"}}}}) ;=> should return "the value of d"
I'm getting errors while loading malli.generate
, with advanced CLJS compilation via shadow-cljs, running tests in Node.
the code in question (with --pseudo-names
so they don't get shortened) is:
$CLJS.$malli$core$t_malli$0core69071$$.prototype.$malli$core$RefSchema$_ref$arity$1$ = $CLJS.$JSCompiler_unstubMethod$$(75, function() {
return null;
});
failing because $CLJS.$malli$core$t_malli$0core69071$$
is undefined
, so there's no prototype to access. I'm still debugging, but does anyone have any insight? is this supposed to work?it looks like it's a problem with reify
under CLJS advanced compilation; see this open bug https://clojure.atlassian.net/browse/CLJS-3207
here's part of the the generated code. it's pretty gnarly, but the upshot is that reify
is conditionally creating new classes only once, to make sure they don't get redefined. but that means the (would-be global) prototypes don't exist until the function containing the reify
is called at least once.
$malli$core$_val_schema$cljs$0core$0IFn$0_invoke$0arity$00$$ = function() {
if ("undefined" === typeof $CLJS.$malli$$ || "undefined" === typeof $malli$core$$ || "undefined" === typeof $CLJS.$malli$core$t_malli$0core69063$$) {
$CLJS.$malli$core$t_malli$0core69063$$ = function($meta69064$$) {
this.$meta69064$ = $meta69064$$;
this.$cljs$lang$protocol_mask$partition0$$ = 393216;
this.$cljs$lang$protocol_mask$partition1$$ = 0;
}, $CLJS.$malli$core$t_malli$0core69063$$.prototype.$cljs$core$IWithMeta$_with_meta$arity$2$ = function($_69065$$, $meta69064__$1$$) {
return new $CLJS.$malli$core$t_malli$0core69063$$($meta69064__$1$$);
}, $CLJS.$malli$core$t_malli$0core69063$$.prototype.$cljs$core$IMeta$_meta$arity$1$ = function() {
return this.$meta69064$;
}, $CLJS.$malli$core$t_malli$0core69063$$.prototype.$malli$core$AST$$ = $CLJS.$cljs$core$PROTOCOL_SENTINEL$$, $CLJS.$malli$core$t_malli$0core69063$$.prototype.$malli$core$IntoSchema$$ = $CLJS.$cljs$core$PROTOCOL_SENTINEL$$, $CLJS.$malli$core$t_malli$0core69063$$.prototype.$malli$core$IntoSchema$_type$arity$1$ = function() {
return $CLJS.$cljs$cst$keyword$malli_DOT_core_SLASH_val$$;
}, $CLJS.$malli$core$t_malli$0core69063$$.prototype.$malli$core$IntoSchema$_type_properties$arity$1$ = $CLJS.$JSCompiler_stubMethod$$(25), $CLJS.$malli$core$t_malli$0core69063$$.prototype.$malli$core$IntoSchema$_into_schema$arity$4$ = function($form$jscomp$16_parent$jscomp$56$$, $properties$jscomp$27$$, $children$jscomp$33_schema__$1$jscomp$32$$, $options$jscomp$124$$) {
var $parent__$1$jscomp$9$$ = this, $children__$1$jscomp$7$$ = $CLJS.$malli$core$_vmap$cljs$0core$0IFn$0_invoke$0arity$02$$(function($p1__69053_SHARP_$$) {
return $CLJS.$malli$core$schema$$.$cljs$core$IFn$_invoke$arity$2$ ? $CLJS.$malli$core$schema$$.$cljs$core$IFn$_invoke$arity$2$($p1__69053_SHARP_$$, $options$jscomp$124$$) : $CLJS.$malli$core$schema$$.call(null, $p1__69053_SHARP_$$, $options$jscomp$124$$);
}, $children$jscomp$33_schema__$1$jscomp$32$$);
$form$jscomp$16_parent$jscomp$56$$ = new $CLJS.$cljs$core$Delay$$(function() {
return $malli$core$_simple_form$$($parent__$1$jscomp$9$$, $properties$jscomp$27$$, $children__$1$jscomp$7$$, $CLJS.$malli$core$_form$$, $options$jscomp$124$$);
});
$children$jscomp$33_schema__$1$jscomp$32$$ = $CLJS.$cljs$core$first$$($children__$1$jscomp$7$$);
var $cache$jscomp$18$$ = $malli$core$_create_cache$$();
if ("undefined" === typeof $CLJS.$malli$$ || "undefined" === typeof $malli$core$$ || "undefined" === typeof $CLJS.$malli$core$t_malli$0core69071$$) {
$CLJS.$malli$core$t_malli$0core69071$$ = function($meta69064$jscomp$1$$, $parent$jscomp$57$$, $properties$jscomp$28$$, $children$jscomp$34$$, $options$jscomp$125$$, $form$jscomp$17$$, $schema$jscomp$2$$, $cache$jscomp$19$$, $meta69072$$) {
this.$meta69064$ = $meta69064$jscomp$1$$;
this.parent = $parent$jscomp$57$$;
this.$properties$ = $properties$jscomp$28$$;
this.children = $children$jscomp$34$$;
this.options = $options$jscomp$125$$;
I'm experimenting with adding #(:cljs ...)
code to malli.core
to touch these reify
'd classes eagerly, since that apparently prevents the issue from happening; see the linked bug.