TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

LLVM 3.0 Type System Rewrite

121 pointsby bmcnielover 13 years ago

2 comments

barrkelover 13 years ago
By a peculiar coincidence, this move to add names to what used to be structural types is almost exactly the opposite of something I want to do to Delphi (Object Pascal) for reverse reasons.<p>When you have run-time type information (RTTI) in a language it turns out that having names for types is important, for data serialization in particular. But when you also have anonymous types (as Delphi does), you can end up with versioning problems, because you need to generate names for these things - and they usually end up involving numbers of some kind.<p>So you can see a type that looks like this:<p><pre><code> type R = record X: record E: set of (a, b); end; end; </code></pre> Only R has a name; the names of the types of the field R.X, and the field R.X.E, etc. are anonymous and end up being something like ':1', ':2' etc. But change the order of declarations and you change the numbering. So probably the most robust option is a name generated from the structure of the type, a bit like a mangled C++ signature.
评论 #3282002 未加载
jmahover 13 years ago
It's great to be able to get peeks into the development of a compiler toolchain. I'm always wary if I can't dispel magic, where "magic" means guardedly opaque. Corollary: Answers to questions about magic are typically, "you don't want to know." At least, that's the mood I've found surrounding GCC.