From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,FREEMAIL_FROM autolearn=ham autolearn_force=no version=3.4.4 X-Google-Thread: 103376,6689542a60dbcc55 X-Google-NewGroupId: yes X-Google-Attributes: gida07f3367d7,domainid0,public,usenet X-Google-Language: ENGLISH,UTF8 Path: g2news1.google.com!news4.google.com!feeder.news-service.com!news.k-dsl.de!aioe.org!not-for-mail From: =?utf-8?Q?Yannick_Duch=C3=AAne_=28Hibou57?= =?utf-8?Q?=29?= Newsgroups: comp.lang.ada Subject: Re: Discriminated records are not the most efficient, but ... Date: Mon, 23 Aug 2010 09:55:44 +0200 Organization: Ada @ Home Message-ID: References: <874oemcr37.fsf@mid.deneb.enyo.de> <87d3t9riip.fsf@mid.deneb.enyo.de> NNTP-Posting-Host: qaSBlvV+1zCl6PWY+jYb4w.user.speranza.aioe.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed; delsp=yes Content-Transfer-Encoding: Quoted-Printable X-Complaints-To: abuse@aioe.org X-Notice: Filtered by postfilter v. 0.8.2 User-Agent: Opera Mail/10.61 (Win32) Xref: g2news1.google.com comp.lang.ada:13654 Date: 2010-08-23T09:55:44+02:00 List-Id: Le Mon, 23 Aug 2010 07:43:26 +0200, Florian Weimer a = = =C3=A9crit: > Except that ML favors structural typing, and Ada is focused strongly > on nominal typing. Yes, via pattern matching. Nominal typing implies structural typing, but= = structural typing does not implies nominal. Let say so the proper model = = would be name * structure, with the name as a kind of tag. This would = properly express the nominal typing. Suppose nominal typing more deals = with architecture and organization than with semantic. But there also ha= ve = a semantic obviously, via their structure and primitives. Properties exposed on a type T1 structurally defined as Pattern1 | = Pattern2 | ... | PatternN will also be exposed on a type T2 identified b= y = name and with the same structure as T1. If T2 is a type defined in Ada, = = the patterns may be expressed by either the type definition and optional= ly = functions returning T2. If T2 is defined as a record, then this definiti= on = may only expose some of these properties, not all. Ex. it may say the ty= pe = is recursive, but will not say How it is (as it will be part of the = implementation only). Its T1 equivalence allows to infer more about it. To be honest, patterns are still unable to tell about circularity = (unification kept apart, but unification is not part of patterns anyway,= = it expressed only at runtime). > Standard ML doesn't support functors nested in structures The difference is scope (what is the path to access from this to that), = = not semantic. Interesting point, which may leads to discuss about ways of refactoring = a = package hierarchy. Let B be a generic or none-generic child of A which is either generic or= = not generic ; let C be the set of what A and B refer to in common = (transitivity may need to be applied to get a proper C set, which is = always valid, as circular dependencies are not allowed). Turn C into a = package imported by A and B, and architectural view kept apart, you have= = the same semantic. This is not a surprise, as package are intended to manage scopes and = express architecture layout. We may just get a model of the semantic, = nothing else. The model will not be a model of the organization, rather = a = model of the dependencies (that is semantic). Think about package elaboration: defining an order of elaboration is = enough, there is no real recursivity. This could always be turned into a= = package after another, which is another way to say, there is a semantic = = equivalence which does not requite nesting, rather just reference to one= = or more previous siblings. > and higher-order functors, but both are a common extension. Unlikely to be a matter to model an imperative language. Ada does not kn= ow = about functions returning functions, except indirectly via tagged types.= = If you meant generic generating an other generic, bay be the idea above = is = an option (providing it is not erroneous). >> Definition of an ML signature =3D Ada specification of a package o= r >> generic package (formal part excluded) > > No, these two aren't equivalent. You cannot apply a specification to > a package to get a new package (with a restricted interface, as some > sort of type conversion). In Standard ML, you can. You mean the structure type ? Like in =E2=80=9Cstructure Foo: BAR =3D st= ruct ... = end;=E2=80=9D ? For the other matter: if it can do what Ada cannot do, that just suggest= = it can model Ada in that area. -- = * 3 lines of concise statements is readable, 10 pages of concise = statements is unreadable ; * 3 lines of verbose statements may looks unuseful, 10 pages of verbose = = statements will never looks too much pedantic