qdk icon indicating copy to clipboard operation
qdk copied to clipboard

Backend can call callable arguments in intrinsic callables

Open msoeken opened this issue 1 year ago • 1 comments

Is your feature request related to a problem? Please describe. For an intrinsic that takes as input a callable, e.g.,

function Twice(f : Int -> Int, a : Int): Int {
    body intrinsic;
}

I cannot evaluate f within Backend::custom_intrinsic with respect to the simulator that implements Backend.

Describe the solution you'd like An argument in Backend::custom_intrinsic that allows me to evaluate f on some expression.

Describe alternatives you've considered

  • Having a mutable reference to the fir::PackageStore inside the custom backend, but the package store is immutably borrowed by eval, so this does not work.

msoeken avatar Mar 03 '24 09:03 msoeken

@swernli will follow up on this.

sezna avatar Mar 04 '24 21:03 sezna