Skip to content

Dynamic import support #3919

@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
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions