lundi 17 avril 2023

Accessing nested items through reflection

Given the following F# code

namespace NS

type A() =
    let agent = MailboxProcessor.Start(fun mbx ->
        let mutable field: int = 0
        
        let f1() = 5

        let rec loop () = async {
            try 
                match! mbx.Receive() with
                | _ ->
                    let f2() = 6
                    ()
            with | _ -> ()
            
            return! loop() }

        loop ())

module B = 
    let a = A()

how to reach 'field', 'f1' and 'f2' through reflection starting from 'a' (or typeof<A>)?





Aucun commentaire:

Enregistrer un commentaire