From: | George Neuner <gneuner2@comcast.net> |
Newsgroups: | comp.compilers |
Date: | Thu, 30 Dec 2010 16:06:08 -0500 |
Organization: | A noiseless patient Spider |
References: | 10-12-040 10-12-052 |
Keywords: | storage, design |
Posted-Date: | 30 Dec 2010 23:02:10 EST |
On Mon, 27 Dec 2010 13:58:47 -0500, noitalmost <noitalmost@cox.net>
wrote:
>I suppose I have an initial prejudice against variant records. They
>seem to me to be a potential source of hard to find bugs (for the
>user programmer, I mean, not the compiler designer). Am I wrong about
>this? Is it possible for the compiler to always know which type is
>active in the variant, like say through a hidden compiler-generated
>variable in the record?
It isn't always possible to know statically which alternation is
active ... but it is possible to make certain the code covers all
cases and to optimize paths for which the correct alternation is
known. The ML family of languages (ML, SML, Caml, Ocaml, etc.)
guarantee to cover all cases and (usually) also can optimize the
different alternation paths.
George
Return to the
comp.compilers page.
Search the
comp.compilers archives again.