Skip to content

Dynamic import support #3919

Closed
Closed
@bobzhang

Description

@bobzhang
type xx 

type 'a promise 

external import : 
  'a  -> 
  ('a -> unit) -> 
  unit promise = "bootload" [@@bs.val]
;;  
module type LIST = module type of List  
;;
let _ : _ promise =     
    import (module List :  LIST)(fun (module List) -> 
  Js.log (List.length [1;2]);
  ()
  )

Todo:

  • Have a way to delay the generated requires for List
  • See if we can mitigate the runtime cost
  • Check to see how to ensure invariants enforced by bootload, e.g, it can only load a global module?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions