How would an inline module be imported?  Module descriptors are roughly
relative URLs so can refer to a JavaScript source file, but it sounds like
you'd need something more fine-grained to refer to an inline module.  Using
fragments to refer to a passage within a document instead of a location
might have unintended effects.

Also, assuming that problem is solved, does the below mean anything
if (Math.random() < 0.5) {
  module School {
    export function getPersonType() {}
  }
}

If not, if inline modules are defined eagerly, what advantages, besides
making life easier for transpiler writers, would inline modules have over
exporting frozen namespaces?



On Sun, Jun 17, 2018 at 10:34 AM Sultan <thysul...@gmail.com> wrote:

> Are there any open proposals/discussions related to creating ES modules
> inline? For example:
>
> ```
> import getPersonType from School
>
> module School {
>   export function getPersonType (person) {
>   switch (person) {
>   case 'Teacher': return 'A teacher'
>   case 'Director': return 'A director'
>   }
>   }
> }
> ```
> _______________________________________________
> es-discuss mailing list
> es-discuss@mozilla.org
> https://mail.mozilla.org/listinfo/es-discuss
>
_______________________________________________
es-discuss mailing list
es-discuss@mozilla.org
https://mail.mozilla.org/listinfo/es-discuss

Reply via email to