... | ... | @@ -21,7 +21,7 @@ The lifetime of a `Unique` is a single invocation of GHC, i.e. they must not 'le |
|
|
Note, that "one compiler invocation" is not the same as the compilation of a single `Module`. Invocations such as `ghc --make` or `ghc --interactive` give rise to longer invocation life-times.
|
|
|
|
|
|
|
|
|
This is also the reasons why `OccName`s are *not* ordered based on the `Unique`s of their underlying `FastString`s, but rather *lexicographically* (see [compiler/basicTypes/OccName.lhs](/trac/ghc/browser/ghc/compiler/basicTypes/OccName.lhs) for details).
|
|
|
This is also the reasons why `OccName`s are *not* ordered based on the `Unique`s of their underlying `FastString`s, but rather *lexicographically* (see [compiler/basicTypes/OccName.lhs](/ghc/ghc/tree/master/ghc/compiler/basicTypes/OccName.lhs) for details).
|
|
|
|
|
|
> > **SLPJ:** I am far from sure that the Ord instance for `OccName` is ever used, so this remark is probably misleading. Try deleting it and see where it is used (if at all).
|
|
|
>
|
... | ... | @@ -37,7 +37,7 @@ A hundred or two library entities (types, classes, functions) are so-called "kno |
|
|
### Interface files
|
|
|
|
|
|
|
|
|
Entities in a interface file (.hi file) are, for the most part, stored in a symbol table, and referred to (from elsewhere in the same interface file) by an index into that table. Here are the details from [compiler/iface/BinIface.lhs](/trac/ghc/browser/ghc/compiler/iface/BinIface.lhs):
|
|
|
Entities in a interface file (.hi file) are, for the most part, stored in a symbol table, and referred to (from elsewhere in the same interface file) by an index into that table. Here are the details from [compiler/iface/BinIface.lhs](/ghc/ghc/tree/master/ghc/compiler/iface/BinIface.lhs):
|
|
|
|
|
|
```wiki
|
|
|
-- Note [Symbol table representation of names]
|
... | ... | @@ -94,7 +94,7 @@ making automatic derivation of such type class instances hard. There was already |
|
|
### Status Quo (pre redesign)
|
|
|
|
|
|
|
|
|
A `Unique` has a domain (`TyCon`, `DataCon`, `PrelName`, `Builtin`, etc.) that was codified by a character. The remainder of the `Unique` was an integer that should be unique for said domain. This **was** once guaranteed through the export list of [compiler/basicTypes/Unique.lhs](/trac/ghc/browser/ghc/compiler/basicTypes/Unique.lhs), where direct access to the domain-character was hidden, i.e.
|
|
|
A `Unique` has a domain (`TyCon`, `DataCon`, `PrelName`, `Builtin`, etc.) that was codified by a character. The remainder of the `Unique` was an integer that should be unique for said domain. This **was** once guaranteed through the export list of [compiler/basicTypes/Unique.lhs](/ghc/ghc/tree/master/ghc/compiler/basicTypes/Unique.lhs), where direct access to the domain-character was hidden, i.e.
|
|
|
|
|
|
```wiki
|
|
|
mkUnique :: Char -> Int -> Unique
|
... | ... | @@ -102,7 +102,7 @@ unpkUnique :: Unique -> (Char,Int) |
|
|
```
|
|
|
|
|
|
|
|
|
were not exported. This should have guaranteed that every domain was assigned its own unique character, because only in [compiler/basicTypes/Unique.lhs](/trac/ghc/browser/ghc/compiler/basicTypes/Unique.lhs) could those `Char`s be assigned. However, through
|
|
|
were not exported. This should have guaranteed that every domain was assigned its own unique character, because only in [compiler/basicTypes/Unique.lhs](/ghc/ghc/tree/master/ghc/compiler/basicTypes/Unique.lhs) could those `Char`s be assigned. However, through
|
|
|
|
|
|
```wiki
|
|
|
mkUniqueGrimily :: Int -> Unique
|
... | ... | @@ -110,7 +110,7 @@ mkUniqueGrimily i = MkUnique (iUnbox i) |
|
|
```
|
|
|
|
|
|
|
|
|
this separation of concerns leaked out to [compiler/basicTypes/UniqSupply.lhs](/trac/ghc/browser/ghc/compiler/basicTypes/UniqSupply.lhs), because its `Int` argument is the *entire*`Unique` and not just the integer part 'under' the domain character.
|
|
|
this separation of concerns leaked out to [compiler/basicTypes/UniqSupply.lhs](/ghc/ghc/tree/master/ghc/compiler/basicTypes/UniqSupply.lhs), because its `Int` argument is the *entire*`Unique` and not just the integer part 'under' the domain character.
|
|
|
|
|
|
> > **SLPJ** OK, but to eliminate `mkUniqueGrimily` you need to examine the calls, decide how to do it better, and document the new design.
|
|
|
>
|
... | ... | |