mirror of
https://github.com/roc-lang/roc.git
synced 2025-09-28 22:34:45 +00:00
![]() This is a bit.. ugly, or at least seems suboptimal, but I can't think of a better way to do it currently aside from demanding a uniform representation, which we probably don't want to do. Another option is something like the defunctionalization we perform today, except also capturing potential uses of nested functions in the closure tag of an encompassing lambda. So for example, ``` f = \x -> \y -> 1 ``` would now record a lambdaset with the data `[Test.f [TypeOfInnerClos1]]`, where `TypeOfInnerClos1` is e.g. `[Test.f.innerClos1 I8, Test.f.innerClos1 I16]`, symbolizing that the inner closure may be specialized to take an I8 or I16. Then at the time that we create the capture set for `f`, we create a tag noting what specialization should be used for the inner closure, and apply the current defunctionalization algorithm. So effectively, the type of the inner closure becomes a capture. I'm not sure if this is any better, or if it has more problems. @folkertdev any thoughts? Closes #2322 |
||
---|---|---|
.. | ||
alias_variable.txt | ||
alias_variable_and_return_it.txt | ||
aliased_polymorphic_closure.txt | ||
branch_store_variable.txt | ||
closure_in_list.txt | ||
dict.txt | ||
empty_list_of_function_type.txt | ||
factorial.txt | ||
fst.txt | ||
guard_pattern_true.txt | ||
has_none.txt | ||
if_guard_bind_variable_false.txt | ||
if_multi_branch.txt | ||
ir_assignment.txt | ||
ir_int_add.txt | ||
ir_int_literal.txt | ||
ir_plus.txt | ||
ir_round.txt | ||
ir_two_defs.txt | ||
ir_when_idiv.txt | ||
ir_when_just.txt | ||
ir_when_maybe.txt | ||
ir_when_record.txt | ||
ir_when_these.txt | ||
is_nil.txt | ||
let_with_record_pattern.txt | ||
let_with_record_pattern_list.txt | ||
let_x_in_x.txt | ||
let_x_in_x_indirect.txt | ||
linked_list_length_twice.txt | ||
list_append.txt | ||
list_append_closure.txt | ||
list_cannot_update_inplace.txt | ||
list_get.txt | ||
list_len.txt | ||
list_pass_to_function.txt | ||
mk_pair_of.txt | ||
monomorphized_applied_tag.txt | ||
monomorphized_floats.txt | ||
monomorphized_ints.txt | ||
monomorphized_ints_aliased.txt | ||
monomorphized_list.txt | ||
monomorphized_tag.txt | ||
monomorphized_tag_with_aliased_args.txt | ||
nested_closure.txt | ||
nested_pattern_match.txt | ||
one_element_tag.txt | ||
optional_when.txt | ||
peano.txt | ||
peano1.txt | ||
peano2.txt | ||
quicksort_help.txt | ||
quicksort_swap.txt | ||
record_optional_field_function_no_use_default.txt | ||
record_optional_field_function_use_default.txt | ||
record_optional_field_let_no_use_default.txt | ||
record_optional_field_let_use_default.txt | ||
rigids.txt | ||
simple_if.txt | ||
somehow_drops_definitions.txt | ||
specialize_closures.txt | ||
specialize_lowlevel.txt | ||
when_joinpoint.txt | ||
when_nested_maybe.txt | ||
when_on_record.txt | ||
when_on_result.txt | ||
when_on_two_values.txt |