Skip to content

Synthesizing classExpr names

icefapper edited this page Apr 11, 2017 · 1 revision

class expression names are different from fn names for various reasons:

  • they can be directly accessed (for example in properties that are computed), they have a temporal zone, and they are constants.

That they have a tdz means that, whereas an fn expression will not change the di, a named class expression will.

Name synthesis for named-clsExprs is as follows:

  • if the name has not been accessed in any way, then synthesis is not needed, otherwise,
  • a temp is allocated, its liquid is updated with the name's lors, the name is attached to the liquid, and the temp is released after the whole body has been transformed. The decision to allocate a temp rather than a whole new liquid is because the alternate name the class is going to have during the transformation will not be needed after the transform is complete, which makes it a fitting candidate for being treated like a temp. However, it is not always necessary to allocate a temp when the class has an alternate name -- if there are no yields in the class, then wrapping in an fn will do, and the alternate name can be used there without worrying about colliding names.