Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AssetReferences in ImportDeclarations #7

Open
AlicanC opened this issue Nov 17, 2018 · 1 comment
Open

AssetReferences in ImportDeclarations #7

AlicanC opened this issue Nov 17, 2018 · 1 comment

Comments

@AlicanC
Copy link

AlicanC commented Nov 17, 2018

Should these work?

// Example 1
asset reactRef from 'react';
import React, { Component } from reactRef;

// Example 2
import { reactRef } from './myRefs';
import React, { Component } from reactRef;

If they should, would they work any differently than just import React, { Component } from 'react';?

@bmeck
Copy link
Member

bmeck commented Nov 19, 2018

given that

asset reactRef from 'react';
import(reactRef);

acts the same as:

import('react');

at the very minimum it should act the same if allowed to be turned into

// Example 1
asset reactRef from 'react';
import React, { Component } from reactRef;

However, for the 2nd example it would need to ensure that the binding pointed to by reactRef is to an asset binding rather than to something like a string if we are wanting to keep static graph guarantees. This leads me to think that import() should be used in the second example instead of import...from:

import { reactRef } from './myRefs';
import(reactRef);

A notable thing here is that in order for assets to be allowed to GC they must have some level of mutation in order to remove them from the VM like #6 is trying to ensure.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants