Zulip Chat Archive

Stream: lean4

Topic: Environment extensions


Evgenia Karunus (Nov 09 2022 at 15:54):

I'm trying to run the code from github.com/leanprover/lean4/~/UserExt/FooExt.lean e.g. with def hi := 5; insert_foo hi; show_foo_set;, and I get:

Lean server printed an error: libc++abi: terminating with uncaught exception of type lean::exception: cannot evaluate [init] declaration 'fooExtension' in the same module

Why does this happen/how to properly run these? (@Mario Carneiro?)

Mario Carneiro (Nov 09 2022 at 15:55):

that's what happens when you use an environment extension in the same module (aka file) that declares it

Mario Carneiro (Nov 09 2022 at 15:57):

that's why the usage code https://github.com/leanprover/lean4/blob/master/tests/pkg/user_ext/UserExt/Tst1.lean is a separate file

Evgenia Karunus (Nov 09 2022 at 16:02):

Is this because of the initialize keyword?


Last updated: Dec 20 2023 at 11:08 UTC