Path: csiph.com!1.us.feeder.erje.net!feeder.erje.net!news.misty.com!news.iecc.com!.POSTED.news.iecc.com!nerds-end From: Christopher F Clark Newsgroups: comp.compilers Subject: Re: Languages with types like Ada Date: Sun, 23 Oct 2022 20:02:38 +0300 Organization: Compilers Central Sender: news@iecc.com Approved: comp.compilers@iecc.com Message-ID: <22-10-057@comp.compilers> References: <22-10-034@comp.compilers> <22-10-044@comp.compilers> MIME-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Injection-Info: gal.iecc.com; posting-host="news.iecc.com:2001:470:1f07:1126:0:676f:7373:6970"; logging-data="15195"; mail-complaints-to="abuse@iecc.com" Keywords: types Posted-Date: 23 Oct 2022 14:24:30 EDT X-submission-address: compilers@iecc.com X-moderator-address: compilers-request@iecc.com X-FAQ-and-archives: http://compilers.iecc.com Xref: csiph.com comp.compilers:3227 I have avoided chiming in on this topic, because I did not understand what the original author meant by parameterized types and a "real" type system. However, some of the discussion has shifted to a topic I do know something about, type compatibility. In addition to the myriad other distinctions in type systems such as: - whether variables carry types or values do - dynamic types versus static - strong versus weak types There seems to be a distinction relevant to this question: - structural types versus nominal types In a system with structural types, if two types have the same "layout", that is are composed of the same units in the same order, they are considered the same. Python's "duck typing" system is an example of this form of typing. In a system with nominal types, if you declare a new type name, it is distinct from other named types (except for specific exceptions like inheritance). C++ classes are nominal types. Each system has its advantages. Since I have been recently working with Rust, I would say its trait system is an attempt to cross the boundary. I believe named types are nominal in rust (I believe unnamed types are structural). However, you can do structural things with named types by declaring traits and implementing them on your named types. You still have to explicitly declare the associations, but you can do it post facto. -- ****************************************************************************** Chris Clark email: christopher.f.clark@compiler-resources.com Compiler Resources, Inc. Web Site: http://world.std.com/~compres 23 Bailey Rd voice: (508) 435-5016 Berlin, MA 01503 USA twitter: @intel_chris ------------------------------------------------------------------------------