Skip to end of metadata
Go to start of metadata

ambrosebs

On the topic of generating assertions from types.

22:13

ambrosebs

The biggest issue is what if types change?

22:14

ambrosebs

currently types are only collected during type checking.

22:14

ambrosebs

that's mainly to have complete control over types and dictate behaviour on when they change.

22:14

ambrosebs

obviously that control is completely lost if I use var metadata to store types, so that's out.

22:15

ambrosebs

I'm thinking something like defonce semantics for types, but with errors if types change.

22:15

ambrosebs

then check-ns or similar will clear all types collected if you want to change them.

22:16

ambrosebs

That should emulate the current approach.

aambrosebs

the cost is REPL development is a bit more awkward.

22:17

ambrosebs

but the advantage is we can generate predicates based on def-alias's without worrying about if types change.

22:17

ambrosebs

(def-alias Foo '{:a Number})

22:17

ambrosebs

(typed-predicate Foo? Foo)

22:18

ambrosebs

that's how I'd imagine predicate generation to look. That means by the time we macroexpand the second expression, we probably have to know a stable type for Foo.

Labels: