| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
|
There is an explanatory comment in Pretty.sml at line 50 which says:
I think it's useful to have the original definition commented out to indicate what the more abstract definition is intended to produce. The representation of datatypes has changed over time and there was a recent change (0694cd9) to the representation of datatypes with a single constructor with a recursive type. Having said that, though, there is a case for removing this and reverting to using a straightforward datatype in both the signature and the structure. At the time of 320ea5c bootstrapping the compiler was a one-step process. Nowadays the bootstrap process involves compiling the compiler several times so the compiler used to compile the final compiler will use the same representation. |
Sorry, something went wrong.
|
To add some further explanation: pretty and context are in effect defined in two different places. There is the definition in the PRETTY signature and Pretty structure but there is also a definition in the DATATYPE_REP functor (line 577 onwards). The former definition is used within the compiler, for example when it creates print functions for new types, and the latter definition is exported into ML code through INITIALISE_.ML and used by code compiled by the compiler e.g. user-written print functions. Clearly these need to use the same represention of the datatypes but there's no easy way to ensure that. |
Sorry, something went wrong.
| Back | FazBrowse Home | New Git URL |
Hi @dcjm,
I was reading the PRETTY signature and at first confused why the definition of the types context and pretty was commented. I then understood that the types are kept abstract with type context and type pretty and that functions (two for context and three for pretty) are provided to build values of theses types. As the functions looked the same as in the comment, I wondered why the comment was kept there. I searched the Git log and found the following:
Commit 320ea5c (2009-12-19) replaced the datatypes context and pretty by definitions based on the type address. The new definition was kept abstract in the signature PRETTY (then called PRETTYSIG). The commit messages states that this "removes the requirement that the representation of a datatype must be the same in the compiler that compiled the compiler as in the compiler itself." The original datatype declarations were kept in a comment.
Commit 10e0dd0 (2016-06-28) changed the interface of the pretty type by replacing int by FixedInt.int. This changed was not performed in the old, commented datatype declaration.
I propose to remove the comments. The code of the current definition is quite readable and, as of now, the reader must compare the commented definitions with the actual code to which point they are the same. Removing the comments also avoids the comment getting out of sync with the code.