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

emitting active fragments #2

Open
icefapper opened this issue Sep 19, 2017 · 0 comments
Open

emitting active fragments #2

icefapper opened this issue Sep 19, 2017 · 0 comments

Comments

@icefapper
Copy link
Member

icefapper commented Sep 19, 2017

it can be directly decided whether an identifier is active (i.e., unshakable.) -- all we have to do is to test whether its associated declaration target is active.
moreover, elements with an inherent scope can also be directly checked for being active, by checking whether their associated activeness-context (a scope, actually) is active.
All other random nodes are shake-able if all their constituents are shake-able.
but what if only some constituents are shake-able, while others aren't? consider:

var a, b, l, e, u;
a() - b * l() - e * u();

e and b are shake-able in the example above; others aren't. How should it be emitted?

One way is to omit the shake-able constituents, and emit the unshakable one alone:

// a() - (b * l()) - (e * u()) ->
a() - l() - u()

Another way is to omit the operations too, leaving only the active constituents:

// a() - (b * l()) - (e * u()) ->
a(), l(), u();

this way we eliminate not just the unnecessary variables, but also the operations not contributing to the overall program state.

Yet another way is to merely replace the shaken constituent with some sort of constant; this one is arguable faster, but also arguably less size-efficient:

// a() - (b * l()) -  (e * u())
a() - (b()) - (u())

The inactive constituents can even be replaced by a constant:

// a() - (b * l()) - (e * u())
a() - 1 * l() - 1 * u()

none is currently implemented.

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

1 participant