Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add assigns functions and assign_async #22

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

RodolfoSilva
Copy link

Add support to other assign functions and add support for assign_async.


@hansihe I'm tring to add support for assing_async, but I'm facing a issue when the code is compiled:

================ INTERNAL DEFT COMPILER ERROR ================
Internal error in LiveData deft compiler while compiling `Elixir.LiveData.Test.AsyncTestingData.render/1` in `/Users/rodolfosilva/workspace/labs/live_data/test/support/data/async_testing_data.ex`.
This is a bug in LiveData. Please submit an issue at https://github.com/hansihe/live_data.
Make sure to include the source code of the function named above in the issue.
==============================================================

== Compilation error in file test/support/data/async_testing_data.ex ==
** (FunctionClauseError) no function clause matching in LiveData.Tracked.FlatAst.Expr.Fn.add_clause/6    
    
    The following arguments were given to LiveData.Tracked.FlatAst.Expr.Fn.add_clause/6:
    
        # 1
        %LiveData.Tracked.FlatAst.Expr.Fn{arity: 0, clauses: [], location: {14, nil}}
    
        # 2
        []
    
        # 3
        MapSet.new([])
    
        # 4
        nil
    
        # 5
        {:literal, 19}
    
        # 6
        {14, nil}
    
    lib/live_data/tracked/flat_ast/expr/fn.ex:27: LiveData.Tracked.FlatAst.Expr.Fn.add_clause/6
    (elixir 1.14.2) lib/enum.ex:2468: Enum."-reduce/3-lists^foldl/2-0-"/3
    lib/live_data/tracked/flat_ast/from_ast.ex:160: LiveData.Tracked.FlatAst.FromAst.from_expr/3
    (elixir 1.14.2) lib/enum.ex:1780: Enum."-map_reduce/3-lists^mapfoldl/2-0-"/3
    (elixir 1.14.2) lib/enum.ex:1780: Enum."-map_reduce/3-lists^mapfoldl/2-0-"/3
    lib/live_data/tracked/flat_ast/from_ast.ex:287: LiveData.Tracked.FlatAst.FromAst.from_expr/3
    lib/live_data/tracked/flat_ast/from_ast.ex:302: LiveData.Tracked.FlatAst.FromAst.from_expr/3
    lib/live_data/tracked/flat_ast/from_ast.ex:303: LiveData.Tracked.FlatAst.FromAst.from_expr/3

Could you help me solve this problem? Feel free to edit the PR.

@hansihe
Copy link
Owner

hansihe commented Dec 25, 2023

I would appreciate if you could open separate issues about errors like this in the future :)

The error you got should be fixed in bae8eb8

@hansihe
Copy link
Owner

hansihe commented Dec 25, 2023

As a separate point, while higher order functions like that does work in tracked functions, they are not really a good idea to use. They are a black box to the deft compiler, and disable change tracking for anything within them.

There are solutions for this on the roadmap, but there are other things that are higher priority for now.

@RodolfoSilva
Copy link
Author

Ok, thank you @hansihe. In the future I'll opena a speareted issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants