clvm icon indicating copy to clipboard operation
clvm copied to clipboard

My take on dialects, which I think is now uniform in interface with the run_program from stage_0

Open prozacchiwawa opened this issue 4 years ago • 0 comments

May be controversial.

I made cuts needed to move some constants into a place where importing them would be possible from anywhere, improving dependency congestion.

Main visible differences:

  • There is now a dialect_factories collection the end user can use to get sane dialects.
  • Configuring a dialect to be a standard chia clvm runner is now a function that most python based dialects can use.
  • A configure method on dialects allows implementation specific communication

As used in clvm_tools, it's now possible to

        ````
        backend = args.backend if args.backend is not None else "python"
        dialect = dialect_factories[backend](
            KEYWORD_TO_ATOM["q"],
            KEYWORD_TO_ATOM["a"],
            args.strict,
            to_sexp_f
        )

        cost, result = dialect.run_program(
            run_script, input_sexp, max_cost=max_cost, pre_eval_f=pre_eval_f)
        ````

The dialect object is factored out of global paths, so it at least owns all its own information.

prozacchiwawa avatar Jul 01 '21 05:07 prozacchiwawa