X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=ghc%2Fdocs%2Fcomm%2Fthe-beast%2Fnames.html;fp=ghc%2Fdocs%2Fcomm%2Fthe-beast%2Fnames.html;h=0000000000000000000000000000000000000000;hb=0065d5ab628975892cea1ec7303f968c3338cbe1;hp=061fae3ebfefe2723ba101993bdfafd7ace1efc9;hpb=28a464a75e14cece5db40f2765a29348273ff2d2;p=ghc-hetmet.git diff --git a/ghc/docs/comm/the-beast/names.html b/ghc/docs/comm/the-beast/names.html deleted file mode 100644 index 061fae3..0000000 --- a/ghc/docs/comm/the-beast/names.html +++ /dev/null @@ -1,169 +0,0 @@ - - - - - The GHC Commentary - The truth about names: OccNames, and Names - - - -

The GHC Commentary - The truth about names: OccNames, and Names

-

- Every entity (type constructor, class, identifier, type variable) has a - Name. The Name type is pervasive in GHC, and - is defined in basicTypes/Name.lhs. Here is what a Name - looks like, though it is private to the Name module. -

-
-
-data Name = Name {
-	      n_sort :: NameSort,	-- What sort of name it is
-	      n_occ  :: !OccName,	-- Its occurrence name
-	      n_uniq :: Unique,		-- Its identity
-	      n_loc  :: !SrcLoc		-- Definition site
-	  }
-
- - -

The NameSort of a Name

-

- There are four flavours of Name: -

-
-
-data NameSort
-  = External Module (Maybe Name)
-	-- (Just parent) => this Name is a subordinate name of 'parent'
-	-- e.g. data constructor of a data type, method of a class
-	-- Nothing => not a subordinate
- 
-  | WiredIn Module (Maybe Name) TyThing BuiltInSyntax
-	-- A variant of External, for wired-in things
-
-  | Internal		-- A user-defined Id or TyVar
-			-- defined in the module being compiled
-
-  | System		-- A system-defined Id or TyVar.  Typically the
-			-- OccName is very uninformative (like 's')
-
- - -

Occurrence names: OccName

-

- An OccName is more-or-less just a string, like "foo" or - "Tree", giving the (unqualified) name of an entity. -

-

- Well, not quite just a string, because in Haskell a name like "C" could - mean a type constructor or data constructor, depending on context. So - GHC defines a type OccName (defined in - basicTypes/OccName.lhs) that is a pair of a FastString - and a NameSpace indicating which name space the name is drawn - from: -

-
-data OccName = OccName NameSpace EncodedFS
-
-

- The EncodedFS is a synonym for FastString indicating - that the string is Z-encoded. (Details in OccName.lhs.) - Z-encoding encodes funny characters like '%' and '$' into alphabetic - characters, like "zp" and "zd", so that they can be used in object-file - symbol tables without confusing linkers and suchlike. -

-

- The name spaces are: -

- - - - -Last modified: Wed May 4 14:57:55 EST 2005 - - - - -