lambda-ccc icon indicating copy to clipboard operation
lambda-ccc copied to clipboard

Handle methods without code explosion

Open conal opened this issue 11 years ago • 3 comments

I've been inlining the method into a selector function and the dictionary and its methods into a large structure, then converting to nested pairs, and then reifying, resulting in enormous beta-redexes. Do the beta-reduction much sooner, but carefully.

conal avatar Apr 18 '14 20:04 conal

Addressed via reifyMethod, as part of commit https://github.com/conal/lambda-ccc/commit/8ea54bd22a192ef3e00138f71e0c2029aa22b913: given reifyEP (m d), if m is a variable and d is a dictionary, then anytd inline >>> simplify.

conal avatar Apr 20 '14 19:04 conal

Now I see that this strategy doesn't work so well when the dictionary has already been reified, which happens when it's defined in a module that's being reified (either the same module as its use or another one).

Idea: don't reify dictionaries. Then the unreified form will get inlined where used, enabling simplification.

conal avatar Apr 20 '14 20:04 conal

Oops. Make unlessDict check that the result is a dictionary. Otherwise, we inline dictionary-constructing functions, which come from instances with constraints, i.e., compound dictionaries.

conal avatar Apr 20 '14 20:04 conal