comp.lang.ada
 help / color / mirror / Atom feed
From: "Yannick Duchêne (Hibou57)" <yannick_duchene@yahoo.fr>
Subject: Re: Discriminated records are not the most efficient, but ...
Date: Mon, 23 Aug 2010 09:55:44 +0200
Date: 2010-08-23T09:55:44+02:00	[thread overview]
Message-ID: <op.vhvsa6tvule2fv@garhos> (raw)
In-Reply-To: 87d3t9riip.fsf@mid.deneb.enyo.de

Le Mon, 23 Aug 2010 07:43:26 +0200, Florian Weimer <fw@deneb.enyo.de> a  
écrit:
> 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 have  
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 by  
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 optionally  
functions returning T2. If T2 is defined as a record, then this definition  
may only expose some of these properties, not all. Ex. it may say the type  
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 know  
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 = Ada specification of a package or
>> 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 “structure Foo: BAR = struct ...  
end;” ?

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



  reply	other threads:[~2010-08-23  7:55 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-08-21 21:18 Discriminated records are not the most efficient, but Yannick Duchêne (Hibou57)
2010-08-21 21:57 ` Yannick Duchêne (Hibou57)
2010-08-22  5:39   ` Yannick Duchêne (Hibou57)
2010-08-22 20:40     ` Yannick Duchêne (Hibou57)
2010-08-22 20:47       ` Florian Weimer
2010-08-22 22:07         ` Yannick Duchêne (Hibou57)
2010-08-22 22:11           ` Yannick Duchêne (Hibou57)
2010-08-23  3:06           ` Peter C. Chapin
2010-08-23  3:50             ` Yannick Duchêne (Hibou57)
2010-08-23  6:25               ` J-P. Rosen
2010-08-23  8:09                 ` Yannick Duchêne (Hibou57)
2010-08-23  6:40               ` Niklas Holsti
2010-08-23  7:33                 ` Simon Wright
2010-08-23 11:44                   ` Martin
2010-08-23 13:16                     ` Georg Bauhaus
2010-08-23 13:32                       ` Martin
2010-08-23 17:02                       ` Yannick Duchêne (Hibou57)
2010-08-23  8:13                 ` Yannick Duchêne (Hibou57)
2010-08-23  1:52         ` Yannick Duchêne (Hibou57)
2010-08-23  5:14           ` Yannick Duchêne (Hibou57)
2010-08-23  5:43             ` Florian Weimer
2010-08-23  7:55               ` Yannick Duchêne (Hibou57) [this message]
2010-08-23  8:06                 ` Dmitry A. Kazakov
2010-08-23  8:26                   ` Yannick Duchêne (Hibou57)
2010-08-23  8:43                     ` Dmitry A. Kazakov
2010-09-04 18:49             ` Florian Weimer
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox