Writing a simple Core evaluator, having trouble with name lookups

Ben Gamari ben at well-typed.com
Fri Nov 30 18:20:33 UTC 2018


Csaba Hruska <csaba.hruska at gmail.com> writes:

> Hi Ben,
>
> I thought that it is possible to rely on unique values *in case of non
> exported Ids* because they are local to a specific module and can not
> appear in expressions in other modules because they are not exported.
> Do I miss something?
>
Uniques should be treated as being non-reproducible across compiler
sessions.

To make this more concrete: if GHC compiles the same module twice it
will not necessarily assign the same uniques to the module's Names.
Uniques are derived from local UniqSupplies conjured up at a variety of
points in the compilation pipeline (search from mkSplitUniqSupply).

These supplies are themselves derived from an impure global counter (see
compiler/cbits/genSym.c). The state of this counter (and consequently
the uniques derived from it) should be treated as being entirely
unpredictable.

Cheers,

- Ben
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 487 bytes
Desc: not available
URL: <http://mail.haskell.org/pipermail/ghc-devs/attachments/20181130/17bdfc0f/attachment.sig>


More information about the ghc-devs mailing list