Skip to content

emitting active fragments #2

@icefapper

Description

@icefapper

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.

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