lean4-htt/src/library
Leonardo de Moura 2610ace69d feat(library/init/io): remove init_io
In the Haskell proposal for top level mutable state
https://wiki.haskell.org/Top_level_mutable_state, they describe the
following problems with using the `IO` monad during initialization.

"A more serious problem is that there is nothing to prevent arbitrary
observable IO actions from appearing to the right of the arrow. If we
perform all actions before executing main, then import becomes a
side-effectful operation, rather than simply a way of bringing names
into scope; furthermore we must specify the order in which actions from
different modules are executed, which would appear to be difficult in
general. If we execute actions on demand (as the unsafePerformIO hack
does) then we are building an unsafe syntactic construct into the
language."

I believe this is not applicable to us. First, our imports are already
side-effectful since we update attributes and the order we import
modules already matters. Second, we have already a well-defined order
in which we import modules. Finally, all global constants are already
being initialized eagerly.

Their ACIO proposal (`init_io` in our implementation) is too restrictive
for what we want to do. For example, to implement an environment
extension mechanism like we have discussed, we would also need `io.ref.write` and
`io.ref.read`. I imagine, we would have a global table, and `register`
would update this table. These extra actions do not satisfy the ACIO restrictions
described in the Haskell proposal. From their document:
"AC stands for Affine Central.
An IO action u is affine if its effect is not indirectly observable, hence need not be performed if the result is unneeded. That is, if u >> v === v for all actions v.
It is central if its effect commutes with every other IO action. That is, if do { x <- u; y <- v; w } === do { y <- v; x <- u; w } for all actions v and w."
It feels like we would have to keep fighting with the ACIO
restrictions. As I said above, our initialization order is well
defined. So, we must document the `[init]` feature and tell users they
should be aware that the `import` is important for initialization
purposes, and that their initialization actions should be
affine central whenever possible.
2019-03-18 15:33:29 -07:00
..
compiler feat(library/init/io): remove init_io 2019-03-18 15:33:29 -07:00
constructions chore(*): meta ==> unsafe 2019-03-15 15:04:40 -07:00
equations_compiler chore(*): meta ==> unsafe 2019-03-15 15:04:40 -07:00
tactic chore(library/vm): remove interaction_state 2018-10-23 11:32:56 -07:00
vm fix(library/vm/vm_aux): remove old code 2019-03-14 16:04:10 -07:00
abstract_context_cache.cpp refactor(kernel): split declaration into declaration and constant_info 2018-08-22 17:53:11 -07:00
abstract_context_cache.h chore(library/type_context): remove "frozen local instances" 2018-09-07 13:17:37 -07:00
abstract_parser.h feat(library/compiler): add [extern] attribute 2019-02-09 18:53:44 -08:00
abstract_type_context.cpp chore(kernel): move abstract_type_context to library 2018-09-08 08:29:51 -07:00
abstract_type_context.h chore(kernel): move abstract_type_context to library 2018-09-08 08:29:51 -07:00
aliases.cpp refactor(kernel): split declaration into declaration and constant_info 2018-08-22 17:53:11 -07:00
aliases.h refactor(*): list<name> ==> obj_list<name> 2018-05-23 15:48:43 -07:00
annotation.cpp feat(library/compiler,runtime): builtin support for lean.name 2019-02-05 12:57:46 -08:00
annotation.h feat(library,frontends/lean): use mdata instead of hacky cache for position information in preterms 2018-09-02 18:08:41 -07:00
app_builder.cpp chore(library/init/core): revert ite+thunks modification 2018-09-23 19:27:06 -07:00
app_builder.h chore(library): remove relation_manager 2018-09-07 12:35:04 -07:00
attribute_manager.cpp refactor(library/attribute_manager): parse attribute data from pexpr instead of abstract_parser 2019-02-15 12:13:45 -08:00
attribute_manager.h refactor(library/attribute_manager): parse attribute data from pexpr instead of abstract_parser 2019-02-15 12:13:45 -08:00
aux_definition.cpp chore(*): meta ==> unsafe 2019-03-15 15:04:40 -07:00
aux_definition.h feat(library/compiler, library/equations_compiler): avoid rec_fn_macro in the equation and bytecode compilers 2018-05-31 17:08:12 -07:00
aux_match.cpp fix(library/compiler): we need to unfold auxiliary nested _match applications eagerly 2018-09-18 14:17:37 -07:00
aux_match.h fix(library/compiler): we need to unfold auxiliary nested _match applications eagerly 2018-09-18 14:17:37 -07:00
aux_recursors.cpp chore(*): remove unnecessary scoped_ext dependencies 2018-09-08 15:42:48 -07:00
aux_recursors.h
bin_app.cpp
bin_app.h
cache_helper.h
check.cpp chore(kernel): remove expr.quote constructor 2018-09-07 22:08:08 -07:00
check.h
class.cpp fix(library/class): is_anonymous_inst_name: ignore macro scopes 2019-01-20 21:43:35 +01:00
class.h chore(library): remove fingerprint 2018-09-07 12:54:19 -07:00
CMakeLists.txt refactor(library/module_mgr): remove 2019-01-25 20:12:11 +01:00
constants.cpp chore(runtime/object): remove iterator primitives from runtime 2019-03-12 07:09:48 -07:00
constants.h chore(runtime/object): remove iterator primitives from runtime 2019-03-12 07:09:48 -07:00
constants.txt chore(runtime/object): remove iterator primitives from runtime 2019-03-12 07:09:48 -07:00
context_cache.cpp chore(library/type_context): remove "frozen local instances" 2018-09-07 13:17:37 -07:00
context_cache.h feat(library/compiler,runtime): builtin support for lean.name 2019-02-05 12:57:46 -08:00
deep_copy.cpp feat(kernel): store structure name in proj-expressions 2018-10-02 09:23:11 -07:00
deep_copy.h
derive_attribute.cpp chore(*): meta ==> unsafe 2019-03-15 15:04:40 -07:00
derive_attribute.h feat(library/derive_attribute): temporary, hacky C++ implementation of @[derive] 2018-08-01 18:44:23 -07:00
error_msgs.cpp feat(frontends/lean/elaborator): show context of unassigned mvars 2018-10-08 09:32:41 -07:00
error_msgs.h refactor(kernel): move formatting stuff out of the kernel 2018-06-07 16:28:54 -07:00
eval_helper.cpp chore(library/tactic): reduce dependencies 2018-10-23 11:32:56 -07:00
eval_helper.h chore(library/tactic): reduce dependencies 2018-10-23 11:32:56 -07:00
exception.cpp refactor(*): use C++11 std::current_exception and std::rethrow_exception 2018-06-07 16:28:54 -07:00
exception.h chore(library/message_builder): handle nested kernel exceptions 2018-09-14 16:33:04 -07:00
explicit.cpp feat(library,frontends/lean): use mdata instead of hacky cache for position information in preterms 2018-09-02 18:08:41 -07:00
explicit.h
export_decl.cpp fix(library/export_decl): bug at export_decl_modification::perform 2018-05-31 09:16:46 -07:00
export_decl.h refactor(*): list<name> ==> obj_list<name> 2018-05-23 15:48:43 -07:00
expr_lt.cpp fix(library,kernel): the new proj_sname field must be taken into account during comparisons 2018-10-03 13:11:46 -07:00
expr_lt.h feat(library/compiler/csimp): projection to field 2018-10-28 09:38:45 -07:00
expr_pair.h feat(library/compiler,runtime): builtin support for lean.name 2019-02-05 12:57:46 -08:00
expr_pair_maps.h
expr_unsigned_map.h refactor(kernel/expr): implement expr using runtime/object 2018-06-21 16:05:33 -07:00
ext_exception.h refactor(kernel): move formatting stuff out of the kernel 2018-06-07 16:28:54 -07:00
formatter.cpp refactor(kernel): move formatting stuff out of the kernel 2018-06-07 16:28:54 -07:00
formatter.h refactor(kernel): move formatting stuff out of the kernel 2018-06-07 16:28:54 -07:00
fun_info.cpp refactor(kernel): simplify binder_info 2018-06-20 15:31:40 -07:00
fun_info.h
handle.cpp feat(library/system/io): implement io using string instead of char_buffer 2018-05-02 17:31:51 -07:00
handle.h feat(library/system/io): implement io using string instead of char_buffer 2018-05-02 17:31:51 -07:00
head_map.cpp feat(library,frontends/lean): use mdata instead of hacky cache for position information in preterms 2018-09-02 18:08:41 -07:00
head_map.h refactor(kernel): remove unnecessary expr_kind printer 2018-06-22 12:35:38 -07:00
idx_metavar.cpp refactor(kernel/expr): remove mlocal_* functions 2018-06-22 14:25:31 -07:00
idx_metavar.h
init_module.cpp refactor(library/module_mgr): remove 2019-01-25 20:12:11 +01:00
init_module.h
io_state.cpp
io_state.h refactor(kernel): move formatting stuff out of the kernel 2018-06-07 16:28:54 -07:00
io_state_stream.cpp refactor(kernel): remove unnecessary expr_kind printer 2018-06-22 12:35:38 -07:00
io_state_stream.h chore(kernel): move abstract_type_context to library 2018-09-08 08:29:51 -07:00
local_context.cpp refactor(kernel/local_ctx): simplify local_ctx 2018-10-24 10:02:38 -07:00
local_context.h refactor(kernel/local_ctx): simplify local_ctx 2018-10-24 10:02:38 -07:00
local_instances.h refactor(kernel/expr): remove mlocal_* functions 2018-06-22 14:25:31 -07:00
locals.cpp chore(kernel): remove expr.quote constructor 2018-09-07 22:08:08 -07:00
locals.h chore(kernel): univ_param vs lparam, level_param_names ==> names, and other inconsistencies 2018-09-03 13:05:42 -07:00
max_sharing.cpp chore(kernel): remove expr.quote constructor 2018-09-07 22:08:08 -07:00
max_sharing.h
message_builder.cpp fix(library/message_builder): fix output of nested kernel exceptions 2018-11-05 17:37:21 +01:00
message_builder.h refactor(*): add runtime folder 2018-05-14 14:23:56 -07:00
messages.cpp fix(shell/lean,library/messages): print messages in correct order (and immediately) when --json was not given 2019-02-01 17:10:14 +01:00
messages.h fix(library/messages): message_severity is unboxed 2019-02-14 14:07:05 -08:00
metavar_context.cpp refactor(kernel/expr): remove mlocal_* functions 2018-06-22 14:25:31 -07:00
metavar_context.h refactor(kernel/expr): remove mlocal_* functions 2018-06-22 14:25:31 -07:00
metavar_util.h refactor(kernel/expr): remove mlocal_* functions 2018-06-22 14:25:31 -07:00
module.cpp feat(library/compiler,runtime): builtin support for lean.name 2019-02-05 12:57:46 -08:00
module.h refactor(library/module_mgr): remove 2019-01-25 20:12:11 +01:00
num.cpp fix(library/num): to_num should support the new nat literals supported in the kernel 2018-09-27 11:13:50 -07:00
num.h refactor(*): add runtime folder 2018-05-14 14:23:56 -07:00
parray.cpp
parray.h refactor(*): add runtime folder 2018-05-14 14:23:56 -07:00
pattern_attribute.cpp
pattern_attribute.h
phash_map.h feat(runtime,library/compiler): add name.dec_eq builtin 2019-02-05 14:36:02 -08:00
phashtable.h
pipe.cpp refactor(*): add runtime folder 2018-05-14 14:23:56 -07:00
pipe.h
placeholder.cpp refactor(library/placeholder,library/init/lean/elaborator): encode pexpr placeholders as anonymous mvars 2018-12-21 15:53:12 +01:00
placeholder.h chore(library/placeholder): remove unused placeholder type and kinds 2018-12-21 15:52:56 +01:00
pos_info_provider.cpp fix(library/pos_info_provider): row and column were swapped 2019-01-16 19:12:40 +01:00
pos_info_provider.h feat(library,frontends/lean): use mdata instead of hacky cache for position information in preterms 2018-09-02 18:08:41 -07:00
pp_options.cpp feat(frontends/lean/pp): add pp.compact_let option 2018-09-20 12:05:48 -07:00
pp_options.h feat(frontends/lean/pp): add pp.compact_let option 2018-09-20 12:05:48 -07:00
print.cpp feat(library/init/lean): add hash functions and dbg_to_string 2019-02-13 16:19:25 -08:00
print.h refactor(kernel): move formatting stuff out of the kernel 2018-06-07 16:28:54 -07:00
private.cpp feat(library/private): more deterministic private names 2019-02-12 14:00:24 -08:00
private.h feat(library/private): more deterministic private names 2019-02-12 14:00:24 -08:00
process.cpp
process.h
profiling.cpp
profiling.h
projection.cpp feat(*): use new inductive datatype module 2018-09-06 18:09:22 -07:00
projection.h
protected.cpp
protected.h
reducible.cpp chore(library): remove fingerprint 2018-09-07 12:54:19 -07:00
reducible.h chore(library): remove fingerprint 2018-09-07 12:54:19 -07:00
replace_visitor.cpp chore(kernel): remove expr.quote constructor 2018-09-07 22:08:08 -07:00
replace_visitor.h chore(kernel): remove expr.quote constructor 2018-09-07 22:08:08 -07:00
replace_visitor_with_tc.cpp refactor(kernel): remove tag from kernel expressions 2018-06-08 10:29:22 -07:00
replace_visitor_with_tc.h
scope_pos_info_provider.cpp refactor(kernel): move formatting stuff out of the kernel 2018-06-07 16:28:54 -07:00
scope_pos_info_provider.h refactor(kernel): move formatting stuff out of the kernel 2018-06-07 16:28:54 -07:00
scoped_ext.cpp feat(library/init/lean/elaborator): pass current namespace to C++ elaborator 2019-01-06 18:10:49 +01:00
scoped_ext.h feat(library/init/lean/elaborator): pass current namespace to C++ elaborator 2019-01-06 18:10:49 +01:00
sorry.cpp feat(kernel): opaque constants 2019-03-15 15:45:06 -07:00
sorry.h chore(kernel): move abstract_type_context to library 2018-09-08 08:29:51 -07:00
string.cpp feat(library/init/data/char): use uint32 instead of nat for defining char 2019-02-15 18:07:55 -08:00
string.h chore(kernel): move abstract_type_context to library 2018-09-08 08:29:51 -07:00
time_task.cpp feat(library/init/lean/util): Lean API for profiler 2019-03-06 10:37:38 +01:00
time_task.h feat(library/time_task): do not report inclusive times 2018-11-05 17:06:32 +01:00
trace.cpp chore(kernel): move abstract_type_context to library 2018-09-08 08:29:51 -07:00
trace.h
type_context.cpp fix(library/type_context): memory access violation in the new type class inference optimization 2018-11-01 14:16:57 -07:00
type_context.h chore(library/local_context): remove user_name indexing 2018-10-17 09:24:40 -07:00
user_recursors.cpp chore(library,frontends/lean): use is_constructor, is_recursor, is_inductive helper functions 2018-09-07 20:36:42 -07:00
user_recursors.h refactor(*): list<name> ==> obj_list<name> 2018-05-23 15:48:43 -07:00
util.cpp chore(*): meta ==> unsafe 2019-03-15 15:04:40 -07:00
util.h chore(*): meta ==> unsafe 2019-03-15 15:04:40 -07:00