comp.lang.ada
 help / color / mirror / Atom feed
* Do people who use Ada also use ocaml or F#?
@ 2010-10-29  2:27 Chad  R. Meiners
  2010-10-29  2:58 ` Yannick Duchêne (Hibou57)
  2010-10-29  7:53 ` Dmitry A. Kazakov
  0 siblings, 2 replies; 78+ messages in thread
From: Chad  R. Meiners @ 2010-10-29  2:27 UTC (permalink / raw)


Hi,

I have always found the type system of Ada to be beautiful.  I,
however, have not been programming in Ada since 2004.  I have chosen
languages that support generics because quite frankly after learning
Ada, any statically typed language that does not support generics is
not a suitable language for developing anything of substance.

A friend of mine (who also learn Ada at university and liked it)
introduced me to ocaml (for which I learned F#), which also has a
beautiful type system.  I am love the elegance of static typing
without explicit type declarations, but I still linger with the desire
to declare types when I program in F#.  (I realize that explicit type
declarations are desirable for safety critical applications.)

Do any other Ada programmers also use functional languages like
these?  If so, has anyone given any thoughts on how to incorporate the
nice features of both languages?



^ permalink raw reply	[flat|nested] 78+ messages in thread

* Re: Do people who use Ada also use ocaml or F#?
  2010-10-29  2:27 Do people who use Ada also use ocaml or F#? Chad  R. Meiners
@ 2010-10-29  2:58 ` Yannick Duchêne (Hibou57)
  2010-10-30  1:32   ` Chad  R. Meiners
  2010-10-30 12:14   ` Florian Weimer
  2010-10-29  7:53 ` Dmitry A. Kazakov
  1 sibling, 2 replies; 78+ messages in thread
From: Yannick Duchêne (Hibou57) @ 2010-10-29  2:58 UTC (permalink / raw)


Le Fri, 29 Oct 2010 04:27:40 +0200, Chad  R. Meiners  
<chad.rmeiners@gmail.com> a écrit:
> I am love the elegance of static typing
> without explicit type declarations
Type inference may seems appealing due to its conciseness. Just that as  
source become bigger, you do not enjoy it any more.

> Do any other Ada programmers also use functional languages like
> these?  If so, has anyone given any thoughts on how to incorporate the
> nice features of both languages?
Ada 2012 introduced something looking like coroutines with the yield  
function (formally, generators), which is a famous feature of functional  
paradigm languages (gonna be great for kinds of streams of any kind of  
data or iterators).

However, adding this and that “cool” feature of that language A in this  
language B, is easier said than done (you guess?), although this may be a  
popular topic.

Cannot reply this question unless you precisely say which feature and for  
what reason. A lot of job is done by the maintainers (and in some part,  
the Ada community), to preserve Ada language definition's soundness. Too  
much risky to talk about adding features just because it sounds cool and  
buzzy without more reasons (this is not a target). So the question : what  
feature and for which reason ?

Honestly, I feel just a few things are missing to Ada, and this have  
nothing to deal with functional paradigm (which is one among numerous  
others), as these are more subtilities related to what Ada is already,  
like the topic of extendable enumerations which pops-up again a few days  
ago.

I personally enjoy the paradigm of functional programing (and many others  
do, the Ada community is open-mind and enjoy to learn to understand), but  
this is clearly not Ada's target and its principle of least-surprise  
(predictability). Functional programming better express a modal than a  
concrete implementation. As I suppose you know, there are many talks about  
the ability of this/that xML compiler to produce efficient binary  
application. Ada clearly has nothing to deal with this kind of question,  
as talks about Ada compilers even goes the opposite way, and more talks  
about “does that compiler really compiles the input it gets without any  
error or bad alterations ?”. What you may understand, is that this do  
exactly the opposite of what a functional programming language compiler is  
expected to do.

In shorter words : yes, many people in the Ada world know about FP, its  
part of their culture; if they use Ada instead of FP (for some things),  
that is not because they do not know enough about FP; and last, Ada is not  
and will never be an FP language (but feel free to create an FP compiler  
targeting Ada).

If Ada tends to integrate some features, these are more the one suggested  
by SPARK users expectations (SPARK is a language intended to run formal  
proofs of correctness on an Ada program) or by some Ada profiles for  
short-memory systems, short time response systems, etc. FP does not really  
help here (well, FP is in some way related to formal proofs, but only in  
its own language area… adding FP features to Ada will not help to make Ada  
designs easier to prove).

Still feel free to tell about your concrete ideas.


-- 
Si les chats miaulent et font autant de vocalises bizarres, c’est pas pour  
les chiens.



^ permalink raw reply	[flat|nested] 78+ messages in thread

* Re: Do people who use Ada also use ocaml or F#?
  2010-10-29  2:27 Do people who use Ada also use ocaml or F#? Chad  R. Meiners
  2010-10-29  2:58 ` Yannick Duchêne (Hibou57)
@ 2010-10-29  7:53 ` Dmitry A. Kazakov
  2010-10-29 17:10   ` Yannick Duchêne (Hibou57)
                     ` (3 more replies)
  1 sibling, 4 replies; 78+ messages in thread
From: Dmitry A. Kazakov @ 2010-10-29  7:53 UTC (permalink / raw)


On Thu, 28 Oct 2010 19:27:40 -0700 (PDT), Chad  R. Meiners wrote:

> I have chosen
> languages that support generics because quite frankly after learning
> Ada, any statically typed language that does not support generics is
> not a suitable language for developing anything of substance.

I don't see any connection between static typing and parametric
polymorphism (AKA generics), except that both are static.

In any case I would like to see Ada without generics, which cause a messy
design, are fundamentally non-testable and unmaintainable.

-- 
Regards,
Dmitry A. Kazakov
http://www.dmitry-kazakov.de



^ permalink raw reply	[flat|nested] 78+ messages in thread

* Re: Do people who use Ada also use ocaml or F#?
  2010-10-29  7:53 ` Dmitry A. Kazakov
@ 2010-10-29 17:10   ` Yannick Duchêne (Hibou57)
  2010-10-29 19:10     ` Dmitry A. Kazakov
  2010-10-29 22:16   ` Jeffrey Carter
                     ` (2 subsequent siblings)
  3 siblings, 1 reply; 78+ messages in thread
From: Yannick Duchêne (Hibou57) @ 2010-10-29 17:10 UTC (permalink / raw)


Le Fri, 29 Oct 2010 09:53:51 +0200, Dmitry A. Kazakov  
<mailbox@dmitry-kazakov.de> a écrit:
> In any case I would like to see Ada without generics, which cause a messy
> design, are fundamentally non-testable and unmaintainable.
Please, do you know a link with further reading on that topic ? I mostly  
like generics as you know, but I still would like to understand that story  
you are always coming back with, and that's not easy to follow such a  
topic on a Usenet (topic scattered).

Any online document appreciated.

-- 
Si les chats miaulent et font autant de vocalises bizarres, c’est pas pour  
les chiens.



^ permalink raw reply	[flat|nested] 78+ messages in thread

* Re: Do people who use Ada also use ocaml or F#?
  2010-10-29 17:10   ` Yannick Duchêne (Hibou57)
@ 2010-10-29 19:10     ` Dmitry A. Kazakov
  0 siblings, 0 replies; 78+ messages in thread
From: Dmitry A. Kazakov @ 2010-10-29 19:10 UTC (permalink / raw)


On Fri, 29 Oct 2010 19:10:38 +0200, Yannick Duch�ne (Hibou57) wrote:

> Le Fri, 29 Oct 2010 09:53:51 +0200, Dmitry A. Kazakov  
> <mailbox@dmitry-kazakov.de> a �crit:
>> In any case I would like to see Ada without generics, which cause a messy
>> design, are fundamentally non-testable and unmaintainable.
> Please, do you know a link with further reading on that topic ? I mostly  
> like generics as you know, but I still would like to understand that story  
> you are always coming back with, and that's not easy to follow such a  
> topic on a Usenet (topic scattered).
> 
> Any online document appreciated.

I don't have any. I just have been heavily using generics (and templates)
for decades.

-- 
Regards,
Dmitry A. Kazakov
http://www.dmitry-kazakov.de



^ permalink raw reply	[flat|nested] 78+ messages in thread

* Re: Do people who use Ada also use ocaml or F#?
  2010-10-29  7:53 ` Dmitry A. Kazakov
  2010-10-29 17:10   ` Yannick Duchêne (Hibou57)
@ 2010-10-29 22:16   ` Jeffrey Carter
  2010-10-30  0:01     ` Vinzent Hoefler
  2010-10-30  7:41     ` Dmitry A. Kazakov
  2010-10-30  2:07   ` Chad  R. Meiners
  2010-10-30 12:18   ` Florian Weimer
  3 siblings, 2 replies; 78+ messages in thread
From: Jeffrey Carter @ 2010-10-29 22:16 UTC (permalink / raw)


On 10/29/2010 12:53 AM, Dmitry A. Kazakov wrote:
>
> In any case I would like to see Ada without generics, which cause a messy
> design, are fundamentally non-testable and unmaintainable.

I'd like to see Ada without any features for programming by extension.

I doubt if either of us will get what we want.

-- 
Jeff Carter
"Whatever it is, I'm against it."
Horse Feathers
46



^ permalink raw reply	[flat|nested] 78+ messages in thread

* Re: Do people who use Ada also use ocaml or F#?
  2010-10-29 22:16   ` Jeffrey Carter
@ 2010-10-30  0:01     ` Vinzent Hoefler
  2010-10-30  2:07       ` Chad  R. Meiners
  2010-10-30  7:41     ` Dmitry A. Kazakov
  1 sibling, 1 reply; 78+ messages in thread
From: Vinzent Hoefler @ 2010-10-30  0:01 UTC (permalink / raw)


On Sat, 30 Oct 2010 00:16:03 +0200, Jeffrey Carter <spam.jrcarter.not@spam.not.acm.org> wrote:

> On 10/29/2010 12:53 AM, Dmitry A. Kazakov wrote:
>>
>> In any case I would like to see Ada without generics, which cause a messy
>> design, are fundamentally non-testable and unmaintainable.
>
> I'd like to see Ada without any features for programming by extension.

Hmm, "pragma Restrictions (No_Dispatch)" is not good enough?


Vinzent.

-- 
There is no signature.



^ permalink raw reply	[flat|nested] 78+ messages in thread

* Re: Do people who use Ada also use ocaml or F#?
  2010-10-29  2:58 ` Yannick Duchêne (Hibou57)
@ 2010-10-30  1:32   ` Chad  R. Meiners
  2010-10-30  2:22     ` Yannick Duchêne (Hibou57)
  2010-10-30 12:15     ` Georg Bauhaus
  2010-10-30 12:14   ` Florian Weimer
  1 sibling, 2 replies; 78+ messages in thread
From: Chad  R. Meiners @ 2010-10-30  1:32 UTC (permalink / raw)


On Oct 28, 10:58 pm, Yannick Duchêne (Hibou57)
<yannick_duch...@yahoo.fr> wrote:
> Le Fri, 29 Oct 2010 04:27:40 +0200, Chad  R. Meiners  
> <chad.rmein...@gmail.com> a écrit:> I am love the elegance of static typing
> > without explicit type declarations
>
> Type inference may seems appealing due to its conciseness. Just that as  
> source become bigger, you do not enjoy it any more.

That is the work of a good IDE.  Visual studios does an excellent job
of giving me the type of any variable in F#.  Plus you can also
constrain the parameters ( let x (y : #foo) = ... ) when you want to
prevent certain types of automatic generalization.  Learning Ada's
type system was an excellent introduction how to think about type
systems.

I don't really agree that when the source becomes bigger that type
inference is a problem.  Modules and functors allow you to break up
the system's code so that each piece is understandable, but more
importantly, less work is needed to compose data structures and
functions.

> > Do any other Ada programmers also use functional languages like
> > these?  If so, has anyone given any thoughts on how to incorporate the
> > nice features of both languages?
>
> Ada 2012 introduced something looking like coroutines with the yield  
> function (formally, generators), which is a famous feature of functional  
> paradigm languages (gonna be great for kinds of streams of any kind of  
> data or iterators).
>
> However, adding this and that “cool” feature of that language A in this  
> language B, is easier said than done (you guess?), although this may be a  
> popular topic.

I don't want to add cool features to Ada.  I was thinking more of how
concepts from ML based languages and Ada could be combined to create a
nice statically typed language that would preferably have formal
semantics.  The structural typing of ML makes stuff like

type foo is new Integer range 0..255;

very difficult.   This sort of strong typing with constraints is
something I miss when programming in ML-based languages.  However,
sometimes the verbosity of Ada programs tends towards the
monotonous.   In many cases, the repetition of type assertion is a
desirable sanity check; however, ML-based languages allows for the
functionally to be more efficiently expressed in some cases.  Take
pattern matching and automatic generalization for an example

let reduce foo =
  let rec go carry = function
    | [] -> carry
    | value :: tail -> go (foo carry value) tail
  in go

the equivalent Ada would be (don't have an Ada compiler accessible)

generic
  type t is private;
  type t_list is limited private;
  with function foo(Left : t; Right : t) return t;
  with function head(item : t_list) return t;
  with function tail(item : t_list) return t_list;
  with function isNull(item : t_list) return Boolean;
function reduce(carry : t; list : t_list) return t is
begin
  if isNull(list) then
    return carry;
  else
    return reduce(foo(carry, head(list)), tail(list));
  end if;
end reduce;

It seems to me others may want to combine the nice traits in each
language.  I build research algorithms, conciseness is very desirable
because I want to be able to fit complete algorithms on a page and I
do not want to commit to specific implementations.  However, I want
the compiler to check my type in a rigorous manner so it is easier to
make sure the implementations are correct.

> Cannot reply this question unless you precisely say which feature and for  
> what reason. A lot of job is done by the maintainers (and in some part,  
> the Ada community), to preserve Ada language definition's soundness. Too  
> much risky to talk about adding features just because it sounds cool and  
> buzzy without more reasons (this is not a target). So the question : what  
> feature and for which reason ?

I do not want to change Ada.  I haven't programmed in Ada since 2004.
I might start programming in it again sometime though.

> Honestly, I feel just a few things are missing to Ada, and this have  
> nothing to deal with functional paradigm (which is one among numerous  
> others), as these are more subtilities related to what Ada is already,  
> like the topic of extendable enumerations which pops-up again a few days  
> ago.

Well you can write functional programs in Ada.  It can actually be
quite fun.

> I personally enjoy the paradigm of functional programing (and many others  
> do, the Ada community is open-mind and enjoy to learn to understand), but  
> this is clearly not Ada's target and its principle of least-surprise  
> (predictability). Functional programming better express a modal than a  
> concrete implementation. As I suppose you know, there are many talks about  
> the ability of this/that xML compiler to produce efficient binary  
> application. Ada clearly has nothing to deal with this kind of question,  
> as talks about Ada compilers even goes the opposite way, and more talks  
> about “does that compiler really compiles the input it gets without any  
> error or bad alterations ?”. What you may understand, is that this do  
> exactly the opposite of what a functional programming language compiler is  
> expected to do.

I know the comp.lang.ada is filled with wise and open minded people.
This is why I asked if these wise people have thought of combining
nice features from both languages.

> In shorter words : yes, many people in the Ada world know about FP, its  
> part of their culture; if they use Ada instead of FP (for some things),  
> that is not because they do not know enough about FP; and last, Ada is not  
> and will never be an FP language (but feel free to create an FP compiler  
> targeting Ada).

I know that people here know more than Ada.

> If Ada tends to integrate some features, these are more the one suggested  
> by SPARK users expectations (SPARK is a language intended to run formal  
> proofs of correctness on an Ada program) or by some Ada profiles for  
> short-memory systems, short time response systems, etc. FP does not really  
> help here (well, FP is in some way related to formal proofs, but only in  
> its own language area… adding FP features to Ada will not help to make Ada  
> designs easier to prove).

I know.  I have used SPARK before, and I have built model checker
generator in Ada.  I know a little bit about formal methods ;-p

> Still feel free to tell about your concrete ideas.

I was asking for others' vague and concrete ideas.  It is pretty
difficult to figure out how ML feature and Ada features can be
combined.  I am working on a gut feeling that the combination could be
pretty awesome.  t'class would be pretty nice in an ML language.





^ permalink raw reply	[flat|nested] 78+ messages in thread

* Re: Do people who use Ada also use ocaml or F#?
  2010-10-30  0:01     ` Vinzent Hoefler
@ 2010-10-30  2:07       ` Chad  R. Meiners
  2010-10-30 23:02         ` Jeffrey Carter
  0 siblings, 1 reply; 78+ messages in thread
From: Chad  R. Meiners @ 2010-10-30  2:07 UTC (permalink / raw)


On Oct 29, 8:01 pm, "Vinzent Hoefler" <nntp-2010...@t-
domaingrabbing.de> wrote:
> On Sat, 30 Oct 2010 00:16:03 +0200, Jeffrey Carter <spam.jrcarter....@spam.not.acm.org> wrote:
> > On 10/29/2010 12:53 AM, Dmitry A. Kazakov wrote:
>
> >> In any case I would like to see Ada without generics, which cause a messy
> >> design, are fundamentally non-testable and unmaintainable.
>
> > I'd like to see Ada without any features for programming by extension.
>
> Hmm, "pragma Restrictions (No_Dispatch)" is not good enough?
>
> Vinzent.
>
> --
> There is no signature.

Being able to disable a feature is not the same as denying everyone
the feature  ;-p



^ permalink raw reply	[flat|nested] 78+ messages in thread

* Re: Do people who use Ada also use ocaml or F#?
  2010-10-29  7:53 ` Dmitry A. Kazakov
  2010-10-29 17:10   ` Yannick Duchêne (Hibou57)
  2010-10-29 22:16   ` Jeffrey Carter
@ 2010-10-30  2:07   ` Chad  R. Meiners
  2010-10-30  2:29     ` Yannick Duchêne (Hibou57)
  2010-10-30  7:49     ` Dmitry A. Kazakov
  2010-10-30 12:18   ` Florian Weimer
  3 siblings, 2 replies; 78+ messages in thread
From: Chad  R. Meiners @ 2010-10-30  2:07 UTC (permalink / raw)


On Oct 29, 3:53 am, "Dmitry A. Kazakov" <mail...@dmitry-kazakov.de>
wrote:
> On Thu, 28 Oct 2010 19:27:40 -0700 (PDT), Chad  R. Meiners wrote:
>
> > I have chosen
> > languages that support generics because quite frankly after learning
> > Ada, any statically typed language that does not support generics is
> > not a suitable language for developing anything of substance.
>
> I don't see any connection between static typing and parametric
> polymorphism (AKA generics), except that both are static.
>
> In any case I would like to see Ada without generics, which cause a messy
> design, are fundamentally non-testable and unmaintainable.
>
> --
> Regards,
> Dmitry A. Kazakovhttp://www.dmitry-kazakov.de

I suspect that generics are subject to false expectations.   Testing
should be done at instantiation.  You deceiving yourself when you
think that writing generic code that is correct for any instantiation
is easy.   Instantiation is the other half of the deal with generics,
and with C++ and Ada it is in some way too easy.

vector<int> foo;

and

package int_list is new list(Integer);

Create the illusion that instantiation is also automatic.  However,
the thought into whether or not the instantiation is correct is often
ignored.   In my opinion, the way that ML based language make all
function generic by default leads to the programming reasoning about
the correction of instantiation because the language eliminates the
verbiage above.

Type parameterization are a good feature of type systems.  Perhaps the
main problem is the lack of formal contracts for generic parameters?



^ permalink raw reply	[flat|nested] 78+ messages in thread

* Re: Do people who use Ada also use ocaml or F#?
  2010-10-30  1:32   ` Chad  R. Meiners
@ 2010-10-30  2:22     ` Yannick Duchêne (Hibou57)
  2010-10-30  3:44       ` Chad  R. Meiners
  2010-10-30 12:15     ` Georg Bauhaus
  1 sibling, 1 reply; 78+ messages in thread
From: Yannick Duchêne (Hibou57) @ 2010-10-30  2:22 UTC (permalink / raw)


Le Sat, 30 Oct 2010 03:32:53 +0200, Chad  R. Meiners  
<chad.rmeiners@gmail.com> a écrit:
> let reduce foo =
>   let rec go carry = function
>     | [] -> carry
>     | value :: tail -> go (foo carry value) tail
>   in go
>
> the equivalent Ada would be (don't have an Ada compiler accessible)
>
> generic
>   type t is private;
>   type t_list is limited private;
>   with function foo(Left : t; Right : t) return t;
>   with function head(item : t_list) return t;
>   with function tail(item : t_list) return t_list;
>   with function isNull(item : t_list) return Boolean;
> function reduce(carry : t; list : t_list) return t is
> begin
>   if isNull(list) then
>     return carry;
>   else
>     return reduce(foo(carry, head(list)), tail(list));
>   end if;
> end reduce;

This would not be automatic generalization any more, but depending on the  
objects, tagged types may help here. And if the object type is always the  
same, there is even no need for a generic or a tagged type.

That where ML and Ada differs : the fist required analysis is not the  
same. With ML you do not have to know what will be the type(s) of the  
object, with Ada you must. That is one of the reason why I said ML is  
better at modeling, with Ada, the model is supposed to be known and not to  
be later discovered.

The example, although it is a good one, simply does not apply.

If you want both : model with ML, when the model is stable enough, design  
with Ada (and by the way you may discover and fix some flaws which was not  
visible with the ML view).

> It seems to me others may want to combine the nice traits in each
> language.  I build research algorithms, conciseness is very desirable
> because *I want to be able to fit complete algorithms on a page*
Fitting all on a page, Ada is not made for that. A modeling language is ;)

> I know.  I have used SPARK before, and I have built model checker
> generator in Ada.  I know a little bit about formal methods ;-p
You are experienced so, I am not so much (I just learned and played with  
SPARK).

> I was asking for others' vague and concrete ideas.  It is pretty
> difficult to figure out how ML feature and Ada features can be
> combined.  I am working on a gut feeling that the combination could be
> pretty awesome.  t'class would be pretty nice in an ML language.
Combined together in a whole and large process, from idea to  
implementation and deployment, certainly, but not combined at the language  
level, neither from Ada to ML or the opposite (by the way, I prefer one of  
the originals ML, which seems more pure to me, than OCaml and peers :p ).

> I was asking for others' vague and concrete ideas.
Hope you will get many

Have a nice day and enjoy your research


-- 
Si les chats miaulent et font autant de vocalises bizarres, c’est pas pour  
les chiens.



^ permalink raw reply	[flat|nested] 78+ messages in thread

* Re: Do people who use Ada also use ocaml or F#?
  2010-10-30  2:07   ` Chad  R. Meiners
@ 2010-10-30  2:29     ` Yannick Duchêne (Hibou57)
  2010-10-30  3:55       ` Chad  R. Meiners
  2010-10-30  7:49     ` Dmitry A. Kazakov
  1 sibling, 1 reply; 78+ messages in thread
From: Yannick Duchêne (Hibou57) @ 2010-10-30  2:29 UTC (permalink / raw)


Le Sat, 30 Oct 2010 04:07:21 +0200, Chad  R. Meiners  
<chad.rmeiners@gmail.com> a écrit:
> Instantiation is the other half of the deal with generics,
That is the awesome quote of the day this one

> Type parameterization are a good feature of type systems.  Perhaps the
> main problem is the lack of formal contracts for generic parameters?
This question indeed frequently raised (SPARK still not support generics,  
nowadays no more than in 2004).

And if you wish to ask Dmitry to tell more, please do… I am interested too.

-- 
Si les chats miaulent et font autant de vocalises bizarres, c’est pas pour  
les chiens.



^ permalink raw reply	[flat|nested] 78+ messages in thread

* Re: Do people who use Ada also use ocaml or F#?
  2010-10-30  2:22     ` Yannick Duchêne (Hibou57)
@ 2010-10-30  3:44       ` Chad  R. Meiners
  0 siblings, 0 replies; 78+ messages in thread
From: Chad  R. Meiners @ 2010-10-30  3:44 UTC (permalink / raw)


On Oct 29, 10:22 pm, Yannick Duchêne (Hibou57)
<yannick_duch...@yahoo.fr> wrote:
> Le Sat, 30 Oct 2010 03:32:53 +0200, Chad  R. Meiners  
> <chad.rmein...@gmail.com> a écrit:
>
>
>
>
>
>
>
>
>
> > let reduce foo =
> >   let rec go carry = function
> >     | [] -> carry
> >     | value :: tail -> go (foo carry value) tail
> >   in go
>
> > the equivalent Ada would be (don't have an Ada compiler accessible)
>
> > generic
> >   type t is private;
> >   type t_list is limited private;
> >   with function foo(Left : t; Right : t) return t;
> >   with function head(item : t_list) return t;
> >   with function tail(item : t_list) return t_list;
> >   with function isNull(item : t_list) return Boolean;
> > function reduce(carry : t; list : t_list) return t is
> > begin
> >   if isNull(list) then
> >     return carry;
> >   else
> >     return reduce(foo(carry, head(list)), tail(list));
> >   end if;
> > end reduce;
>
> This would not be automatic generalization any more, but depending on the  
> objects, tagged types may help here. And if the object type is always the  
> same, there is even no need for a generic or a tagged type.

This is an interesting point.   F# implements reduce as a .Net
generic.  This is why you can do an apple to apple comparison with ML
to Ada.  Tagged types while cool are not needed.

val reduce : ('a -> 'b -> 'a) -> ('a -> 'b list -> 'a)

> That where ML and Ada differs : the fist required analysis is not the  
> same. With ML you do not have to know what will be the type(s) of the  
> object, with Ada you must. That is one of the reason why I said ML is  
> better at modeling, with Ada, the model is supposed to be known and not to  
> be later discovered.

This is not true.  With generics, the types are not known either, they
are discovered during instantiation, which is also later.  ML just
saves you the verbiage.  I do agree that the philosophy of Ada tends
to extract constraints better.  It is what I learned, and guess I try
to "program in Ada" in other languages.

> The example, although it is a good one, simply does not apply.
>
> If you want both : model with ML, when the model is stable enough, design  
> with Ada (and by the way you may discover and fix some flaws which was not  
> visible with the ML view).

There is a misunderstanding here.  I value your input.  However, I am
not trying to change Ada. I am trying to get other viewpoints (like
your).

ML is not a modeling language and neither is Ada.  If I want to
specify something, I will use Z, B or Alloy.  If I want to model
behavior, then I would use LOTOS or Promela, or make a custom model
checker.

Ada does not discover flaws that modeling does.  The type system is
nice, but not that nice.

> > It seems to me others may want to combine the nice traits in each
> > language.  I build research algorithms, conciseness is very desirable
> > because *I want to be able to fit complete algorithms on a page*
>
> Fitting all on a page, Ada is not made for that. A modeling language is ;)

No, this is common misunderstanding.  Modeling languages describe
behavior denotationally. Let me put it this way, when you model
something, you want the specification the be satisfied by a large
number of possible implementations.  When your specification can only
be satisfied by a specific implementation, your have specified an
implementation instead of the requirements, which is not desirable
because the latter are must harder to validate.

> > I know.  I have used SPARK before, and I have built model checker
> > generator in Ada.  I know a little bit about formal methods ;-p
>
> You are experienced so, I am not so much (I just learned and played with  
> SPARK).
>
> > I was asking for others' vague and concrete ideas.  It is pretty
> > difficult to figure out how ML feature and Ada features can be
> > combined.  I am working on a gut feeling that the combination could be
> > pretty awesome.  t'class would be pretty nice in an ML language.
>
> Combined together in a whole and large process, from idea to  
> implementation and deployment, certainly, but not combined at the language  
> level, neither from Ada to ML or the opposite (by the way, I prefer one of  
> the originals ML, which seems more pure to me, than OCaml and peers :p ).

I have friend who think ocaml could benefit from Ada features.  Is
this wrong?  I don't think so. We need to build on the shoulders of
giants.  We need to engage the designers of the language.  They my not
be able to make the changes their languages, but they can pass on
their opinions and experience, which benefit other latter on.

> > I was asking for others' vague and concrete ideas.
>
> Hope you will get many
>
> Have a nice day and enjoy your research

I hope I will too ;-p   I have enjoyed your responses.  This isn't
research, btw.  It is open dialog.





^ permalink raw reply	[flat|nested] 78+ messages in thread

* Re: Do people who use Ada also use ocaml or F#?
  2010-10-30  2:29     ` Yannick Duchêne (Hibou57)
@ 2010-10-30  3:55       ` Chad  R. Meiners
  0 siblings, 0 replies; 78+ messages in thread
From: Chad  R. Meiners @ 2010-10-30  3:55 UTC (permalink / raw)


On Oct 29, 10:29 pm, Yannick Duchêne (Hibou57)
<yannick_duch...@yahoo.fr> wrote:
> Le Sat, 30 Oct 2010 04:07:21 +0200, Chad  R. Meiners  
> <chad.rmein...@gmail.com> a écrit:> Instantiation is the other half of the deal with generics,
>
> That is the awesome quote of the day this one

;-p  Well I can't take full credit.  There have been a bunch of
researchers that tried to tackle the problems of composing software
components.  It has been my observation that it is difficult to
compose.

>
> > Type parameterization are a good feature of type systems.  Perhaps the
> > main problem is the lack of formal contracts for generic parameters?
>
> This question indeed frequently raised (SPARK still not support generics,  
> nowadays no more than in 2004).
>
> And if you wish to ask Dmitry to tell more, please do… I am interested too.

I am always curious to read what Dmitry writes.   I have learned a lot
by reading some of his post to CLA.

I also agree that is sad that SPARK does not support generics.  Maybe
there is something difficult in such support.  I haven't kept up on my
formal methods research so I don't know what the hold up is.  But the
Praxis people are pretty smart, I bet generics might have a couple
rock that get thrown in the cog of the formal machinery.



^ permalink raw reply	[flat|nested] 78+ messages in thread

* Re: Do people who use Ada also use ocaml or F#?
  2010-10-29 22:16   ` Jeffrey Carter
  2010-10-30  0:01     ` Vinzent Hoefler
@ 2010-10-30  7:41     ` Dmitry A. Kazakov
  2010-10-30 23:08       ` Jeffrey Carter
  1 sibling, 1 reply; 78+ messages in thread
From: Dmitry A. Kazakov @ 2010-10-30  7:41 UTC (permalink / raw)


On Fri, 29 Oct 2010 15:16:03 -0700, Jeffrey Carter wrote:

> On 10/29/2010 12:53 AM, Dmitry A. Kazakov wrote:
>>
>> In any case I would like to see Ada without generics, which cause a messy
>> design, are fundamentally non-testable and unmaintainable.
> 
> I'd like to see Ada without any features for programming by extension.

That is not same. For all type extension does not lock your design as
generics do. Once generic, forever generic.

-- 
Regards,
Dmitry A. Kazakov
http://www.dmitry-kazakov.de



^ permalink raw reply	[flat|nested] 78+ messages in thread

* Re: Do people who use Ada also use ocaml or F#?
  2010-10-30  2:07   ` Chad  R. Meiners
  2010-10-30  2:29     ` Yannick Duchêne (Hibou57)
@ 2010-10-30  7:49     ` Dmitry A. Kazakov
  1 sibling, 0 replies; 78+ messages in thread
From: Dmitry A. Kazakov @ 2010-10-30  7:49 UTC (permalink / raw)


On Fri, 29 Oct 2010 19:07:21 -0700 (PDT), Chad  R. Meiners wrote:

> On Oct 29, 3:53�am, "Dmitry A. Kazakov" <mail...@dmitry-kazakov.de>

> I suspect that generics are subject to false expectations.

Certainly. In the context of Ada they were expected to be a decent tool for
solid software design, what a pity! (:-))

> Testing should be done at instantiation.

Compare: testing of a procedure must be done at each call point.

Procedure is a software decomposition vehicle. It, in particular, saves you
work of testing each instance of its outputs for a given set of inputs.
Parametrically polymorphic body (generics) is supposed to serve same
purpose. It fails miserably.

> Type parameterization are a good feature of type systems.

Absolutely, and Ada has type parameterization in more advanced,
controllable, comfortable and safe forms: discriminants and type tags.

> Perhaps the
> main problem is the lack of formal contracts for generic parameters?

Partially yes, but that is a consequence. The real problem is that generics
is a meta language. What is the reason in building another language upon
the object one? Is it because the object one cannot be fixed? Then why
people are so sure they could fix these problems in the meta language? The
"Ada proper" language is statically typed with user-defined types etc. The
language of Ada formal generic specifications is a half-baked ugly weakly
typed language. C++'s templates formal language is not even typed. And to
implement this horror was so much efforts that nobody ever cared about
user-defined formal generic types! It took decades of hard work to make Ada
95 generics working in GNAT! And this meta language is lightyears distant
from the point where the problems of the object language could become
noticeable. It is such a mess that we will never arrive there. You cannot
implement with generics anything near close in complexity, any layman
programmer does at daily basis with the object language. So, what was the
reason? Isn't it time for some reflection? BTW, it is too late for generics
anyway. Their place was taken by the software tools.

-- 
Regards,
Dmitry A. Kazakov
http://www.dmitry-kazakov.de



^ permalink raw reply	[flat|nested] 78+ messages in thread

* Re: Do people who use Ada also use ocaml or F#?
  2010-10-29  2:58 ` Yannick Duchêne (Hibou57)
  2010-10-30  1:32   ` Chad  R. Meiners
@ 2010-10-30 12:14   ` Florian Weimer
  2010-10-30 12:46     ` Yannick Duchêne (Hibou57)
  1 sibling, 1 reply; 78+ messages in thread
From: Florian Weimer @ 2010-10-30 12:14 UTC (permalink / raw)


* Yannick Duch�ne (Hibou57):

> Ada 2012 introduced something looking like coroutines with the yield
> function (formally, generators), which is a famous feature of
> functional  paradigm languages (gonna be great for kinds of streams of
> any kind of  data or iterators).

Is this AI05-166? I don't see how this leads to generators.



^ permalink raw reply	[flat|nested] 78+ messages in thread

* Re: Do people who use Ada also use ocaml or F#?
  2010-10-30  1:32   ` Chad  R. Meiners
  2010-10-30  2:22     ` Yannick Duchêne (Hibou57)
@ 2010-10-30 12:15     ` Georg Bauhaus
  1 sibling, 0 replies; 78+ messages in thread
From: Georg Bauhaus @ 2010-10-30 12:15 UTC (permalink / raw)


On 10/30/10 3:32 AM, Chad R. Meiners wrote:
>  In many cases, the repetition of type assertion is a
> desirable sanity check; however, ML-based languages allows for the
> functionally to be more efficiently expressed in some cases.  Take
> pattern matching and automatic generalization for an example
>
> let reduce foo =
>    let rec go carry = function
>      | [] ->  carry
>      | value :: tail ->  go (foo carry value) tail
>    in go

Interestingly, Guido van Rossum has let list comprehensions
into Python 3 but has reduced `reduce` in rank. He reminds
programmers that Python is a programming language and
that they should please use a for loop!  ;-)

Indeed, leaving currying (and fun?) aside, one wouldn't
necessarily want to pass ever new lists around:

generic
    type T is private;
    Zero : in T;
    with function Op (Left, Right: T) return T;
    type Index is (<>);
    with function Element (Position : Index) return T;
function Reduce (First, Last: Index) return T;

function Reduce (First, Last: Index) return T is
    Result : T;
begin
    Result := Zero;
    for K in First .. Last loop
       Result := Op (Result, Element(K));
    end loop;
    return Result;
end Reduce;

The odd thing is that the type of functions in functional
languages is essentially composite.  Whereas the idea of
a function is one thing!  Hence I'd expect it worth a type that
is not just a consequence of the type of arguments in the
function table's columns (such as 'a -> 'b -> 'a).  Is
functional abstraction not more than a cross product of data?

But I understand that mathematical paper writing suggest a formalism
for expressing ideas that is closer to the mathematical ideal of
not stating what is deemed obvious in the target group
(and acceptable, viz. expected and fashionable).   Alas,
results usually need to be re-worked into simply constructed
and memory-efficient programs for real computers.
Even when using a functional language...  :-)


-- Georg



^ permalink raw reply	[flat|nested] 78+ messages in thread

* Re: Do people who use Ada also use ocaml or F#?
  2010-10-29  7:53 ` Dmitry A. Kazakov
                     ` (2 preceding siblings ...)
  2010-10-30  2:07   ` Chad  R. Meiners
@ 2010-10-30 12:18   ` Florian Weimer
  2010-10-30 12:59     ` Dmitry A. Kazakov
  3 siblings, 1 reply; 78+ messages in thread
From: Florian Weimer @ 2010-10-30 12:18 UTC (permalink / raw)


* Dmitry A. Kazakov:

> On Thu, 28 Oct 2010 19:27:40 -0700 (PDT), Chad  R. Meiners wrote:
>
>> I have chosen languages that support generics because quite frankly
>> after learning Ada, any statically typed language that does not
>> support generics is not a suitable language for developing anything
>> of substance.
>
> I don't see any connection between static typing and parametric
> polymorphism (AKA generics), except that both are static.

For me, it's the realization that without generics, a static type
systems tends to disallow too many useful programs.



^ permalink raw reply	[flat|nested] 78+ messages in thread

* Re: Do people who use Ada also use ocaml or F#?
  2010-10-30 12:14   ` Florian Weimer
@ 2010-10-30 12:46     ` Yannick Duchêne (Hibou57)
  2010-10-30 13:59       ` Florian Weimer
  2010-10-30 14:12       ` Niklas Holsti
  0 siblings, 2 replies; 78+ messages in thread
From: Yannick Duchêne (Hibou57) @ 2010-10-30 12:46 UTC (permalink / raw)


Le Sat, 30 Oct 2010 14:14:52 +0200, Florian Weimer <fw@deneb.enyo.de> a  
écrit:

> * Yannick Duchêne (Hibou57):
>
>> Ada 2012 introduced something looking like coroutines with the yield
>> function (formally, generators), which is a famous feature of
>> functional  paradigm languages (gonna be great for kinds of streams of
>> any kind of  data or iterators).
>
> Is this AI05-166? I don't see how this leads to generators.
I will not believe I am the only one who expect to use it for that  
purpose. This would be incredible.
I like it for iterators and every thing which is close or less close to  
streams in the large. I use to talk about “coroutine” here, while the real  
coroutine is more than that. But I don't mind, as I was not expecting more.

What I like with it, is that it allow clean separation of the behavior and  
usage. You simply have one or more yield points, instead of returning from  
a procedure or function and having ugly control structure to go to the  
resume point when the function is invoked again. This allow to give  
control where the control should be given : weither the method is  
controlling or is controlled, you have the same algorithm in both case,  
expressed the same way. Otherwise, a simulation of Yield simply make every  
thing less clear, as half of what you write is dedicated to this Yield  
simulation.

There is no real need for real coroutine (which would just be a kind of  
green-thread), I believe Yield is enough, and this will probably not be a  
nightmare for implementors (I may be wrong, well, I hope).

-- 
Si les chats miaulent et font autant de vocalises bizarres, c’est pas pour  
les chiens.



^ permalink raw reply	[flat|nested] 78+ messages in thread

* Re: Do people who use Ada also use ocaml or F#?
  2010-10-30 12:18   ` Florian Weimer
@ 2010-10-30 12:59     ` Dmitry A. Kazakov
  2010-10-30 19:12       ` Yannick Duchêne (Hibou57)
  0 siblings, 1 reply; 78+ messages in thread
From: Dmitry A. Kazakov @ 2010-10-30 12:59 UTC (permalink / raw)


On Sat, 30 Oct 2010 14:18:09 +0200, Florian Weimer wrote:

> * Dmitry A. Kazakov:
> 
>> On Thu, 28 Oct 2010 19:27:40 -0700 (PDT), Chad  R. Meiners wrote:
>>
>>> I have chosen languages that support generics because quite frankly
>>> after learning Ada, any statically typed language that does not
>>> support generics is not a suitable language for developing anything
>>> of substance.
>>
>> I don't see any connection between static typing and parametric
>> polymorphism (AKA generics), except that both are static.
> 
> For me, it's the realization that without generics, a static type
> systems tends to disallow too many useful programs.

This requires further explanations. Since generics are themselves static,
the problem is not in types being static, but in something else.

Actually, the question is whether a static type system should be extended
by means of generics or by other means. I saw no discussion why this should
be done with generics, as well as any discussion about the power and
desired properties of a static type system.

To me it is obvious that a type system serves reuse. The property of being
static is aimed at correctness checks/proofs. In this context generics look
quite disappointing.

-- 
Regards,
Dmitry A. Kazakov
http://www.dmitry-kazakov.de



^ permalink raw reply	[flat|nested] 78+ messages in thread

* Re: Do people who use Ada also use ocaml or F#?
  2010-10-30 12:46     ` Yannick Duchêne (Hibou57)
@ 2010-10-30 13:59       ` Florian Weimer
  2010-10-30 14:12       ` Niklas Holsti
  1 sibling, 0 replies; 78+ messages in thread
From: Florian Weimer @ 2010-10-30 13:59 UTC (permalink / raw)


* Yannick Duch�ne (Hibou57):

> Le Sat, 30 Oct 2010 14:14:52 +0200, Florian Weimer <fw@deneb.enyo.de>
> a �crit:
>
>> * Yannick Duch�ne (Hibou57):
>>
>>> Ada 2012 introduced something looking like coroutines with the yield
>>> function (formally, generators), which is a famous feature of
>>> functional  paradigm languages (gonna be great for kinds of streams of
>>> any kind of  data or iterators).
>>
>> Is this AI05-166? I don't see how this leads to generators.

> I will not believe I am the only one who expect to use it for that
> purpose. This would be incredible.

Are you really talking about AI05-166 here?  I can't see how it is
relevant to generators.  What can you do with it which can't be done
with an accept statement with an out parameter?



^ permalink raw reply	[flat|nested] 78+ messages in thread

* Re: Do people who use Ada also use ocaml or F#?
  2010-10-30 12:46     ` Yannick Duchêne (Hibou57)
  2010-10-30 13:59       ` Florian Weimer
@ 2010-10-30 14:12       ` Niklas Holsti
  2010-10-30 18:58         ` Yannick Duchêne (Hibou57)
  1 sibling, 1 reply; 78+ messages in thread
From: Niklas Holsti @ 2010-10-30 14:12 UTC (permalink / raw)


Yannick Duchêne (Hibou57) wrote:
> Le Sat, 30 Oct 2010 14:14:52 +0200, Florian Weimer <fw@deneb.enyo.de> a 
> écrit:
> 
>> * Yannick Duchêne (Hibou57):
>>
>>> Ada 2012 introduced something looking like coroutines with the yield
>>> function (formally, generators), which is a famous feature of
>>> functional  paradigm languages (gonna be great for kinds of streams of
>>> any kind of  data or iterators).
>>
>> Is this AI05-166? I don't see how this leads to generators.
> I will not believe I am the only one who expect to use it for that 
> purpose. This would be incredible.
> I like it for iterators and every thing which is close or less close to 
> streams in the large. I use to talk about “coroutine” here, while the 
> real coroutine is more than that. But I don't mind, as I was not 
> expecting more.
> 
> What I like with it, is that it allow clean separation of the behavior 
> and usage. You simply have one or more yield points, instead of 
> returning from a procedure or function and having ugly control structure 
> to go to the resume point when the function is invoked again. This allow 
> to give control where the control should be given : weither the method 
> is controlling or is controlled, you have the same algorithm in both 
> case, expressed the same way. Otherwise, a simulation of Yield simply 
> make every thing less clear, as half of what you write is dedicated to 
> this Yield simulation.

I hesitate to say so, Yannick, but what you say above makes we wonder if 
you really know what sort of "yield" is proposed for Ada 2012. As I 
understand the proposed Ada 2012 Yield procedures, they are meant for 
low-level control of task scheduling, not as an "incremental" return 
statement that returns an element in an stream, for which the name 
"yield" is sometimes used in other languages and, in particular, for 
iterator-like operations.

A call of the Ada 2010 Yield is simply a dispatching point at which the 
running (calling) task is put back into the "ready" queue(s) and a new 
(or the same) task is chosen for running.

You can, of course, use Ada tasks to build the equivalent of coroutines, 
but you must then use inter-task communication methods (rendez-vous or 
protected objects) to transfer data between the tasks that simulate 
coroutines. You can do this without using the new Yield procedures, in 
which case normal Ada task scheduling interleaves the tasks/coroutines. 
The new Yield procedures would only help you to enforce a task switch 
when it would not necessarily occur automatically -- for example, 
between ready tasks of equal priority.

-- 
Niklas Holsti
Tidorum Ltd
niklas holsti tidorum fi
       .      @       .



^ permalink raw reply	[flat|nested] 78+ messages in thread

* Re: Do people who use Ada also use ocaml or F#?
  2010-10-30 14:12       ` Niklas Holsti
@ 2010-10-30 18:58         ` Yannick Duchêne (Hibou57)
  2010-10-30 19:20           ` Georg Bauhaus
  2010-10-30 23:11           ` Jeffrey Carter
  0 siblings, 2 replies; 78+ messages in thread
From: Yannick Duchêne (Hibou57) @ 2010-10-30 18:58 UTC (permalink / raw)


Le Sat, 30 Oct 2010 16:12:44 +0200, Niklas Holsti  
<niklas.holsti@tidorum.invalid> a écrit:
> I hesitate to say so, Yannick, but what you say above makes we wonder if  
> you really know what sort of "yield" is proposed for Ada 2012. As I  
> understand the proposed Ada 2012 Yield procedures, they are meant for  
> low-level control of task scheduling
Oops, not the Yield I know :(
Sorry everyones for the Oops (doubly disappointed)

(seems I miss-understood Randy when he talked about this Yield some days  
ago)

-- 
Si les chats miaulent et font autant de vocalises bizarres, c’est pas pour  
les chiens.



^ permalink raw reply	[flat|nested] 78+ messages in thread

* Re: Do people who use Ada also use ocaml or F#?
  2010-10-30 12:59     ` Dmitry A. Kazakov
@ 2010-10-30 19:12       ` Yannick Duchêne (Hibou57)
  2010-10-30 19:37         ` Dmitry A. Kazakov
  0 siblings, 1 reply; 78+ messages in thread
From: Yannick Duchêne (Hibou57) @ 2010-10-30 19:12 UTC (permalink / raw)


Le Sat, 30 Oct 2010 14:59:47 +0200, Dmitry A. Kazakov  
<mailbox@dmitry-kazakov.de> a écrit:
> To me it is obvious that a type system serves reuse. The property of  
> being
> static is aimed at correctness checks/proofs. In this context generics  
> look
> quite disappointing.
I do not see how this could be less safe than a design process itself.  
Generics are like building something with a pattern, and this pattern is  
checked for consistency in Ada. This is not more not less safe than any  
other composition process. I agree with Chad when he/she talked about the  
need of a validation for each instantiations (at least, by parameter set).  
Static type system also apply with generic, this is just that it cannot be  
proved universally valid. Even static type checking cannot guarantee to  
always produce something correct, this goal needs more (like contracts).

Still true generics can be no fun when (as an example) instantiation  
hierarchy comes, but this is another story which has nothing to do with  
proof of correctness.

-- 
Si les chats miaulent et font autant de vocalises bizarres, c’est pas pour  
les chiens.



^ permalink raw reply	[flat|nested] 78+ messages in thread

* Re: Do people who use Ada also use ocaml or F#?
  2010-10-30 18:58         ` Yannick Duchêne (Hibou57)
@ 2010-10-30 19:20           ` Georg Bauhaus
  2010-10-30 23:11           ` Jeffrey Carter
  1 sibling, 0 replies; 78+ messages in thread
From: Georg Bauhaus @ 2010-10-30 19:20 UTC (permalink / raw)


On 10/30/10 8:58 PM, Yannick Duchêne (Hibou57) wrote:
> Le Sat, 30 Oct 2010 16:12:44 +0200, Niklas Holsti <niklas.holsti@tidorum.invalid> a écrit:
>> I hesitate to say so, Yannick, but what you say above makes we wonder if you really know what sort of "yield" is proposed for Ada 2012. As I understand the proposed Ada 2012 Yield procedures, they are meant for low-level control of task scheduling
> Oops, not the Yield I know :(
> Sorry everyones for the Oops (doubly disappointed)
>
> (seems I miss-understood Randy when he talked about this Yield some days ago)
>

For programming an "'incremental' return statement", as
Niklas Holsti has put it, I find the original, 30 years old
"architectural" notion of task quite well suited.

Forget about number of processors, task switching, or
anything "heavy" for a moment.  Let a task just be some
sequential process that computes something incrementally.
The task object accepts calls whenever it is ready
to deliver another result.  Call this result the yield,
the result that the task has most recently generated:


    task type Generator is
       entry Element (Result : out T);
    end Generator;

    task body Generator is
       Data : array (Data_Index) of T;
    begin
       for K in Data'Range loop
          Compute (Data, K);
          select
             accept Element (Result : out T) do
                Result := Data(K);
             end Element;
          or
             terminate;
          end select;
       end loop;
    end Generator;




^ permalink raw reply	[flat|nested] 78+ messages in thread

* Re: Do people who use Ada also use ocaml or F#?
  2010-10-30 19:12       ` Yannick Duchêne (Hibou57)
@ 2010-10-30 19:37         ` Dmitry A. Kazakov
  2010-10-30 20:04           ` Yannick Duchêne (Hibou57)
  2010-10-31 21:46           ` Shark8
  0 siblings, 2 replies; 78+ messages in thread
From: Dmitry A. Kazakov @ 2010-10-30 19:37 UTC (permalink / raw)


On Sat, 30 Oct 2010 21:12:36 +0200, Yannick Duch�ne (Hibou57) wrote:

> Le Sat, 30 Oct 2010 14:59:47 +0200, Dmitry A. Kazakov  
> <mailbox@dmitry-kazakov.de> a �crit:
>> To me it is obvious that a type system serves reuse. The property of being
>> static is aimed at correctness checks/proofs. In this context generics look
>> quite disappointing.

> I do not see how this could be less safe than a design process itself.  
> Generics are like building something with a pattern, and this pattern is  
> checked for consistency in Ada.

So are machine instructions when executed by the processor. The argument is
invalid: whatever does Ada with the instances of a generic body is
irrelevant to checking the generic body.

> This is not more not less safe than any  
> other composition process.

This requires a proof, which would be hard to provide because generics are
non-testable.

-- 
Regards,
Dmitry A. Kazakov
http://www.dmitry-kazakov.de



^ permalink raw reply	[flat|nested] 78+ messages in thread

* Re: Do people who use Ada also use ocaml or F#?
  2010-10-30 19:37         ` Dmitry A. Kazakov
@ 2010-10-30 20:04           ` Yannick Duchêne (Hibou57)
  2010-10-30 20:54             ` Dmitry A. Kazakov
  2010-10-31 21:46           ` Shark8
  1 sibling, 1 reply; 78+ messages in thread
From: Yannick Duchêne (Hibou57) @ 2010-10-30 20:04 UTC (permalink / raw)


Le Sat, 30 Oct 2010 21:37:31 +0200, Dmitry A. Kazakov  
<mailbox@dmitry-kazakov.de> a écrit:
>> I do not see how this could be less safe than a design process itself.
>> Generics are like building something with a pattern, and this pattern is
>> checked for consistency in Ada.
>
> So are machine instructions when executed by the processor. The argument  
> is invalid: whatever does Ada with the instances of a generic body is
> irrelevant to checking the generic body.
What Ada do with generics is predictable, so you can theoretically prove  
an instantiation of a generic at some point with some parameters will  
fulfill some needs. What is different than when you re-use a method from a  
library and that library was not specifically designed for your  
application ? You have to check what you re-use is indeed the (or one of)  
the good stuff to use.

> So are machine instructions when executed by the processor.
Everything is better checked at multiple level of precisions : at the  
requirement/expectation level, at the model level, at the implementation  
design level, at the binary produced by the compiler. Real safety requires  
check up to the level of machine code (and CPU and so on), less safety  
requires less check (unless a big-bug occurs and you suspect the compiler).

If I understand you correctly, you complain you have a level to check (or  
else if what you said means “generics cannot be checked at all”, tell  
why). That is what is strange to me. Not provable, is one thing, provable  
at this stage instead of this one is another topic. Why should generic  
usage be provable before instantiation ? (you have at least a proof of  
some consistency with Ada, even before instantiation).

> whatever does Ada with the instances of a generic body is irrelevant.
Why is its predictable behavior irrelevant ? Isn't it the opposite ?


-- 
Si les chats miaulent et font autant de vocalises bizarres, c’est pas pour  
les chiens.



^ permalink raw reply	[flat|nested] 78+ messages in thread

* Re: Do people who use Ada also use ocaml or F#?
  2010-10-30 20:04           ` Yannick Duchêne (Hibou57)
@ 2010-10-30 20:54             ` Dmitry A. Kazakov
  2010-10-30 21:53               ` Yannick Duchêne (Hibou57)
  0 siblings, 1 reply; 78+ messages in thread
From: Dmitry A. Kazakov @ 2010-10-30 20:54 UTC (permalink / raw)


On Sat, 30 Oct 2010 22:04:34 +0200, Yannick Duchêne (Hibou57) wrote:

> Le Sat, 30 Oct 2010 21:37:31 +0200, Dmitry A. Kazakov  
> <mailbox@dmitry-kazakov.de> a écrit:
>>> I do not see how this could be less safe than a design process itself.
>>> Generics are like building something with a pattern, and this pattern is
>>> checked for consistency in Ada.
>>
>> So are machine instructions when executed by the processor. The argument  
>> is invalid: whatever does Ada with the instances of a generic body is
>> irrelevant to checking the generic body.

> What Ada do with generics is predictable, so you can theoretically prove  
> an instantiation of a generic at some point with some parameters will  
> fulfill some needs.

No, that is a halting problem.

> If I understand you correctly, you complain you have a level to check (or  
> else if what you said means “generics cannot be checked at all”, tell  
> why).

I only say that they are not testable. Testing is necessary for large scale
software design. Since you cannot separate generics from their instances,
their usefulness for software decomposition is at least questionable.

> Why should generic  
> usage be provable before instantiation ?

Because you want to be able to deliver generic components.

>> whatever does Ada with the instances of a generic body is irrelevant.

> Why is its predictable behavior irrelevant?

What is the behavior of a generic body? How would you define it? What are
the specifications of generic body, not of a given instance? How to verify
if the implementation is conformant to the specification?

The strength of generics comes from patching the source code at a very low
level. Deeper you descend less predictions could be made.

-- 
Regards,
Dmitry A. Kazakov
http://www.dmitry-kazakov.de



^ permalink raw reply	[flat|nested] 78+ messages in thread

* Re: Do people who use Ada also use ocaml or F#?
  2010-10-30 20:54             ` Dmitry A. Kazakov
@ 2010-10-30 21:53               ` Yannick Duchêne (Hibou57)
  2010-10-31  8:12                 ` Dmitry A. Kazakov
  0 siblings, 1 reply; 78+ messages in thread
From: Yannick Duchêne (Hibou57) @ 2010-10-30 21:53 UTC (permalink / raw)


Le Sat, 30 Oct 2010 22:54:39 +0200, Dmitry A. Kazakov  
<mailbox@dmitry-kazakov.de> a écrit:
>> Why should generic
>> usage be provable before instantiation ?
>
> Because you want to be able to deliver generic components.
What would be your requirements to state you are able to deliver a library  
? (I mean a library, as a library, not linked to an application).

Aren't generics similar to libraries ?

If you are to deliver an application designed upon generics, then it can  
be proved or unproved with that design.
If you are to deliver a generic as standalone, then there are things you  
will never be able to prove, right, but just like you will not be able to  
prove anything for a standalone library you've delivered. I would expect  
the requirements for the library should include suitability for one or  
some usages, precisely and priorly defined. This requirement for a  
standalone library, could be “it must be able of this and that”. The  
requirement for a standalone generic, in a similar way, could be “it must  
be able of this and that with these or these instantiation parameters” :  
just add a requirement on parameters. Impossible to guarantee anything  
outside of any defined scope, for whatever design. With generic,  
instantiation parameters matters, so just add this to the requirements.

Let's formalize a bit the deal.

Two distinct views of a generic from a client's point of view :

    1) Instance of a generic in an application
    2) Generic as standalone (as a library)

Then for the requirements :

    1) If the generic appears in an application, then the checks
       and requirements for the whole application applies.
    2) If the generic is standalone, then the kind of requirements
       which come with any library applies, plus, the added
       requirement that these latter requirements are at least
       verified for one or some clearly specified instantiation
       parameters.

What about such a deal ?

-- 
Si les chats miaulent et font autant de vocalises bizarres, c’est pas pour  
les chiens.



^ permalink raw reply	[flat|nested] 78+ messages in thread

* Re: Do people who use Ada also use ocaml or F#?
  2010-10-30  2:07       ` Chad  R. Meiners
@ 2010-10-30 23:02         ` Jeffrey Carter
  2010-10-30 23:30           ` Yannick Duchêne (Hibou57)
  0 siblings, 1 reply; 78+ messages in thread
From: Jeffrey Carter @ 2010-10-30 23:02 UTC (permalink / raw)


On 10/29/2010 07:07 PM, Chad R. Meiners wrote:
> On Oct 29, 8:01 pm, "Vinzent Hoefler"<nntp-2010...@t-
> domaingrabbing.de>  wrote:
>> On Sat, 30 Oct 2010 00:16:03 +0200, Jeffrey Carter<spam.jrcarter....@spam.not.acm.org>  wrote:
>>
>>> I'd like to see Ada without any features for programming by extension.
>>
>> Hmm, "pragma Restrictions (No_Dispatch)" is not good enough?
>
> Being able to disable a feature is not the same as denying everyone
> the feature  ;-p

Nor is dispatching all of programming by extension in Ada.

More important is the effect of having features that violate a stated design 
goal of the language and are the source of massive misunderstanding (evidenced 
by the numerous posts here by people trying to use the features but not 
understanding them). The language is more complex and compilers take more effort 
and have more errors as a result.

-- 
Jeff Carter
"Blessed are they who convert their neighbors'
oxen, for they shall inhibit their girth."
Monty Python's Life of Brian
83



^ permalink raw reply	[flat|nested] 78+ messages in thread

* Re: Do people who use Ada also use ocaml or F#?
  2010-10-30  7:41     ` Dmitry A. Kazakov
@ 2010-10-30 23:08       ` Jeffrey Carter
  2010-10-30 23:15         ` Vinzent Hoefler
  2010-10-31  7:38         ` Dmitry A. Kazakov
  0 siblings, 2 replies; 78+ messages in thread
From: Jeffrey Carter @ 2010-10-30 23:08 UTC (permalink / raw)


On 10/30/2010 12:41 AM, Dmitry A. Kazakov wrote:
> On Fri, 29 Oct 2010 15:16:03 -0700, Jeffrey Carter wrote:
>>
>> I'd like to see Ada without any features for programming by extension.
>
> That is not same. For all type extension does not lock your design as
> generics do. Once generic, forever generic.

Type extension is not the only feature for programming by extension in Ada. 
Programming by extension emphasizes ease of writing over ease of reading, 
violating one of Ada's explicit design goals.

-- 
Jeff Carter
"Blessed are they who convert their neighbors'
oxen, for they shall inhibit their girth."
Monty Python's Life of Brian
83



^ permalink raw reply	[flat|nested] 78+ messages in thread

* Re: Do people who use Ada also use ocaml or F#?
  2010-10-30 18:58         ` Yannick Duchêne (Hibou57)
  2010-10-30 19:20           ` Georg Bauhaus
@ 2010-10-30 23:11           ` Jeffrey Carter
  2010-10-31 15:13             ` Florian Weimer
  1 sibling, 1 reply; 78+ messages in thread
From: Jeffrey Carter @ 2010-10-30 23:11 UTC (permalink / raw)


On 10/30/2010 11:58 AM, Yannick Duchêne (Hibou57) wrote:
>
> (seems I miss-understood Randy when he talked about this Yield some days
> ago)

Yield does what is intended by

delay 0.0;

as it is currently used: create a scheduling point where another task could get 
the processor, without otherwise slowing the current task down if there is no 
such other task.

Given that the trend is to multiprocessors, it seems an odd thing to add at this 
point.

-- 
Jeff Carter
"Blessed are they who convert their neighbors'
oxen, for they shall inhibit their girth."
Monty Python's Life of Brian
83



^ permalink raw reply	[flat|nested] 78+ messages in thread

* Re: Do people who use Ada also use ocaml or F#?
  2010-10-30 23:08       ` Jeffrey Carter
@ 2010-10-30 23:15         ` Vinzent Hoefler
  2010-10-31  2:36           ` Jeffrey Carter
  2010-10-31  7:38         ` Dmitry A. Kazakov
  1 sibling, 1 reply; 78+ messages in thread
From: Vinzent Hoefler @ 2010-10-30 23:15 UTC (permalink / raw)


On Sun, 31 Oct 2010 01:08:19 +0200, Jeffrey Carter <spam.jrcarter.not@spam.not.acm.org> wrote:

> On 10/30/2010 12:41 AM, Dmitry A. Kazakov wrote:
>> On Fri, 29 Oct 2010 15:16:03 -0700, Jeffrey Carter wrote:
>>>
>>> I'd like to see Ada without any features for programming by extension.
>>
>> That is not same. For all type extension does not lock your design as
>> generics do. Once generic, forever generic.
>
> Type extension is not the only feature for programming by extension in Ada.
> Programming by extension emphasizes ease of writing over ease of reading,
> violating one of Ada's explicit design goals.

Could you please give an example? I can't follow you here.


Vinzent.

-- 
There is no signature.



^ permalink raw reply	[flat|nested] 78+ messages in thread

* Re: Do people who use Ada also use ocaml or F#?
  2010-10-30 23:02         ` Jeffrey Carter
@ 2010-10-30 23:30           ` Yannick Duchêne (Hibou57)
  2010-10-31  2:31             ` Jeffrey Carter
  0 siblings, 1 reply; 78+ messages in thread
From: Yannick Duchêne (Hibou57) @ 2010-10-30 23:30 UTC (permalink / raw)


Le Sun, 31 Oct 2010 01:02:12 +0200, Jeffrey Carter  
<spam.jrcarter.not@spam.not.acm.org> a écrit:
> Nor is dispatching all of programming by extension in Ada.
>
> More important is the effect of having features that violate a stated  
> design goal of the language and are the source of massive  
> misunderstanding (evidenced by the numerous posts here by people trying  
> to use the features but not understanding them).
These miss-understandings may be more caused by the attempt to map a  
language onto another (someone coming from A to B, who try to do A with  
B), than caused by the language, as tutorials and books about learning the  
language (Ada) does not really push to these miss-understandings (just  
think about JP. Rosen frequently talking about HOOD, even when he does not  
name it). Ada on-line books are more oriented towards safe practices. When  
tagged type are push onto the front, this is just as a reply to people  
convinced Ada does not support it (the supposed audience, is people who  
know what there are looking for and what they do).

A good suggestion may be not to suppose one know something because this  
look-like what he/she already know in another context, and push people to  
learn as if this was something really new to be discovered (I have revised  
many of my understandings since Ada).

If one use dispatching because he/she use derived classes all over the  
place, this is not because Ada provides tagged type, better probably  
because he/she came from a place where this is a common practice (like  
Java, which seems to me very derived-class oriented… but I may be wrong,  
as I am not so much aware of Java).

But if he/she is to use references to functions or procedures and  
determines that this may better be done using a tagged type, because this  
will come with the ability to provide a procedure associated to an object  
instead of associated to a package, then, why not ? (just an example).

Ada is just multi-paradigm, as underlined from time to time. These  
features does not break the language design (so don't violate its original  
design goals) so much, as, as an example, I feel nothing has suffered from  
the introduction of tagged types in Ada 95 (at least, I don't feel so).

-- 
Si les chats miaulent et font autant de vocalises bizarres, c’est pas pour  
les chiens.



^ permalink raw reply	[flat|nested] 78+ messages in thread

* Re: Do people who use Ada also use ocaml or F#?
  2010-10-30 23:30           ` Yannick Duchêne (Hibou57)
@ 2010-10-31  2:31             ` Jeffrey Carter
  2010-10-31  2:58               ` Yannick Duchêne (Hibou57)
  0 siblings, 1 reply; 78+ messages in thread
From: Jeffrey Carter @ 2010-10-31  2:31 UTC (permalink / raw)


On 10/30/2010 04:30 PM, Yannick Duchêne (Hibou57) wrote:
> These miss-understandings may be more caused by the attempt to map a
> language onto another (someone coming from A to B, who try to do A with
> B), than caused by the language, as tutorials and books about learning
> the language (Ada) does not really push to these miss-understandings
> (just think about JP. Rosen frequently talking about HOOD, even when he
> does not name it). Ada on-line books are more oriented towards safe
> practices. When tagged type are push onto the front, this is just as a
> reply to people convinced Ada does not support it (the supposed
> audience, is people who know what there are looking for and what they do).

Not at all. I've been using Ada since 1984, and am reckoned to have a passable 
understanding of it. I am reasonably familiar with the programming-by-extension 
features (see my use of a type extension to avoid access types in a recent 
discussion of S expressions), but I have made several errors when dealing with 
code that uses these features in their more normal, obfuscatory manner. Normally 
I would think it's just a failing on my part, but the many problems others have 
had help me think that maybe it's not.

HOOD is a design method, and has nothing to do with programming by extension, 
which is an implementation technique that has nothing to do with object 
orientedness. I've have written plenty of object-oriented S/W that does not use 
programming by extension, and (unfortunately) seen far too much S/W that uses 
programming by extension that is not object oriented.

-- 
Jeff Carter
"Blessed are they who convert their neighbors'
oxen, for they shall inhibit their girth."
Monty Python's Life of Brian
83



^ permalink raw reply	[flat|nested] 78+ messages in thread

* Re: Do people who use Ada also use ocaml or F#?
  2010-10-30 23:15         ` Vinzent Hoefler
@ 2010-10-31  2:36           ` Jeffrey Carter
  2010-10-31  3:01             ` Yannick Duchêne (Hibou57)
  0 siblings, 1 reply; 78+ messages in thread
From: Jeffrey Carter @ 2010-10-31  2:36 UTC (permalink / raw)


On 10/30/2010 04:15 PM, Vinzent Hoefler wrote:
> On Sun, 31 Oct 2010 01:08:19 +0200, Jeffrey Carter
> <spam.jrcarter.not@spam.not.acm.org> wrote:
>>
>> Type extension is not the only feature for programming by extension in
>> Ada.
>> Programming by extension emphasizes ease of writing over ease of reading,
>> violating one of Ada's explicit design goals.
>
> Could you please give an example? I can't follow you here.

An example of what? a Child package that extends its parent is another feature 
for programming by extension.

For examples of how programming by extension emphasizes ease of writing over 
ease of reading and the like, see some articles I had in /Ada Letters/:

Carter, J. R., “Ada’s Design Goals and Object-Oriented Programming,” /Ada 
Letters/, 1994 Nov/Dec

Carter, J. R., “Breaking the Ada Privacy Act,” Ada Letters, 1996 May/Jun

Carter, J. R., “OOP vs. Readability,” Ada Letters, 1997 Mar/Apr

-- 
Jeff Carter
"Blessed are they who convert their neighbors'
oxen, for they shall inhibit their girth."
Monty Python's Life of Brian
83



^ permalink raw reply	[flat|nested] 78+ messages in thread

* Re: Do people who use Ada also use ocaml or F#?
  2010-10-31  2:31             ` Jeffrey Carter
@ 2010-10-31  2:58               ` Yannick Duchêne (Hibou57)
  2010-10-31 10:57                 ` J-P. Rosen
                                   ` (2 more replies)
  0 siblings, 3 replies; 78+ messages in thread
From: Yannick Duchêne (Hibou57) @ 2010-10-31  2:58 UTC (permalink / raw)


Le Sun, 31 Oct 2010 03:31:01 +0100, Jeffrey Carter  
<spam.jrcarter.not@spam.not.acm.org> a écrit:
> Not at all. I've been using Ada since 1984, and am reckoned to have a  
> passable understanding of it. I am reasonably familiar with the  
> programming-by-extension features (see my use of a type extension to  
> avoid access types in a recent discussion of S expressions), but I have  
> made several errors when dealing with code that uses these features in  
> their more normal, obfuscatory manner. Normally I would think it's just  
> a failing on my part, but the many problems others have had help me  
> think that maybe it's not.
May be there was too much derivation levels ? Two levels should be  
sufficient in most of case I feel.

> HOOD is a design method, and has nothing to do with programming by  
> extension, which is an implementation technique that has nothing to do  
> with object orientedness.
As much as I understand it (I could not access any reference, as there are  
near to none at all on the web), HOOD do have to deal with object, and is  
not an implementation technique, but a analysis and design method. Pretty  
sure HOOD is to be considered object-oriented (will have to ask for a PDF  
book about HOOD later, I am thinking about it since some time).

> and (unfortunately) seen far too much S/W that uses programming by  
> extension that is not object oriented.
May be confusion between re-use and extension ? I know the most loud OOD  
voices expose classification and re-use in the mean time, so that it  
present derivation as both a way of classification and re-use. But  
classification/extensions and re-use are different things. You indeed  
re-use something when you extend, but to re-use is not to extend; and the  
primary topic with extension, is only extension, not re-use, which (the  
latter) only appears as a side-effect.

Indeed, if you extend to re-use, you break object boundaries and  
identifications. If you extend to extend, you are more likely to preserve  
objects identifications.

(as far as i can understand)

-- 
Si les chats miaulent et font autant de vocalises bizarres, c’est pas pour  
les chiens.



^ permalink raw reply	[flat|nested] 78+ messages in thread

* Re: Do people who use Ada also use ocaml or F#?
  2010-10-31  2:36           ` Jeffrey Carter
@ 2010-10-31  3:01             ` Yannick Duchêne (Hibou57)
  2010-10-31  4:52               ` Jeffrey Carter
  0 siblings, 1 reply; 78+ messages in thread
From: Yannick Duchêne (Hibou57) @ 2010-10-31  3:01 UTC (permalink / raw)


Le Sun, 31 Oct 2010 03:36:53 +0100, Jeffrey Carter  
<spam.jrcarter.not@spam.not.acm.org> a écrit:
>>> Type extension is not the only feature for programming by extension in
>>> Ada.
>>> Programming by extension emphasizes ease of writing over ease of  
>>> reading,
>>> violating one of Ada's explicit design goals.
>>
>> Could you please give an example? I can't follow you here.
>
> An example of what? a Child package that extends its parent is another  
> feature for programming by extension.
>
> For examples of how programming by extension emphasizes ease of writing  
> over ease of reading and the like, see some articles I had in /Ada  
> Letters/:
>
> Carter, J. R., “Ada’s Design Goals and Object-Oriented Programming,”  
> /Ada Letters/, 1994 Nov/Dec
>
> Carter, J. R., “Breaking the Ada Privacy Act,” Ada Letters, 1996 May/Jun
>
> Carter, J. R., “OOP vs. Readability,” Ada Letters, 1997 Mar/Apr

Some web links around there ?


-- 
Si les chats miaulent et font autant de vocalises bizarres, c’est pas pour  
les chiens.



^ permalink raw reply	[flat|nested] 78+ messages in thread

* Re: Do people who use Ada also use ocaml or F#?
  2010-10-31  3:01             ` Yannick Duchêne (Hibou57)
@ 2010-10-31  4:52               ` Jeffrey Carter
  2010-10-31  5:12                 ` Yannick Duchêne (Hibou57)
  0 siblings, 1 reply; 78+ messages in thread
From: Jeffrey Carter @ 2010-10-31  4:52 UTC (permalink / raw)


On 10/30/2010 08:01 PM, Yannick Duchêne (Hibou57) wrote:
> Le Sun, 31 Oct 2010 03:36:53 +0100, Jeffrey Carter
> <spam.jrcarter.not@spam.not.acm.org> a écrit:
>>
>> Carter, J. R., “Ada’s Design Goals and Object-Oriented Programming,”
>> /Ada Letters/, 1994 Nov/Dec
>>
>> Carter, J. R., “Breaking the Ada Privacy Act,” Ada Letters, 1996 May/Jun
>>
>> Carter, J. R., “OOP vs. Readability,” Ada Letters, 1997 Mar/Apr
>
> Some web links around there ?

Access to /Ada Letters/ through the ACM website is included in your SIGAda 
membership. (We're all SIGAda members, aren't we?)

-- 
Jeff Carter
"Blessed are they who convert their neighbors'
oxen, for they shall inhibit their girth."
Monty Python's Life of Brian
83



^ permalink raw reply	[flat|nested] 78+ messages in thread

* Re: Do people who use Ada also use ocaml or F#?
  2010-10-31  4:52               ` Jeffrey Carter
@ 2010-10-31  5:12                 ` Yannick Duchêne (Hibou57)
  0 siblings, 0 replies; 78+ messages in thread
From: Yannick Duchêne (Hibou57) @ 2010-10-31  5:12 UTC (permalink / raw)


Le Sun, 31 Oct 2010 05:52:01 +0100, Jeffrey Carter  
<spam.jrcarter.not@spam.not.acm.org> a écrit:
>> Some web links around there ?
>
> Access to /Ada Letters/ through the ACM website is included in your  
> SIGAda membership. (We're all SIGAda members, aren't we?)

Oops, …n …no :red:



Don't mind, I will find similar lectures somewhere (well, I hope).

-- 
Si les chats miaulent et font autant de vocalises bizarres, c’est pas pour  
les chiens.



^ permalink raw reply	[flat|nested] 78+ messages in thread

* Re: Do people who use Ada also use ocaml or F#?
  2010-10-30 23:08       ` Jeffrey Carter
  2010-10-30 23:15         ` Vinzent Hoefler
@ 2010-10-31  7:38         ` Dmitry A. Kazakov
  2010-10-31  8:03           ` Yannick Duchêne (Hibou57)
                             ` (2 more replies)
  1 sibling, 3 replies; 78+ messages in thread
From: Dmitry A. Kazakov @ 2010-10-31  7:38 UTC (permalink / raw)


On Sat, 30 Oct 2010 16:08:19 -0700, Jeffrey Carter wrote:

> Type extension is not the only feature for programming by extension in Ada. 
> Programming by extension emphasizes ease of writing over ease of reading, 
> violating one of Ada's explicit design goals.

Programming by extension focuses software design on reuse. Yes, it eases
writing, just because reuse reduces the amount of code. However it also
requires more upfront design, considered bad by some.

As for reading, I completely disagree. There is nothing more unreadable
than cut'n'pasted code, which is the only alternative to reuse. And by the
way, generics is the least readable Ada feature.

-- 
Regards,
Dmitry A. Kazakov
http://www.dmitry-kazakov.de



^ permalink raw reply	[flat|nested] 78+ messages in thread

* Re: Do people who use Ada also use ocaml or F#?
  2010-10-31  7:38         ` Dmitry A. Kazakov
@ 2010-10-31  8:03           ` Yannick Duchêne (Hibou57)
  2010-10-31  8:14             ` Dmitry A. Kazakov
  2010-10-31 11:00           ` J-P. Rosen
  2010-10-31 18:02           ` Jeffrey Carter
  2 siblings, 1 reply; 78+ messages in thread
From: Yannick Duchêne (Hibou57) @ 2010-10-31  8:03 UTC (permalink / raw)


Le Sun, 31 Oct 2010 08:38:38 +0100, Dmitry A. Kazakov  
<mailbox@dmitry-kazakov.de> a écrit:
> However it also
> requires more upfront design, considered bad by some.
What is upfront design ?

-- 
Si les chats miaulent et font autant de vocalises bizarres, c’est pas pour  
les chiens.



^ permalink raw reply	[flat|nested] 78+ messages in thread

* Re: Do people who use Ada also use ocaml or F#?
  2010-10-30 21:53               ` Yannick Duchêne (Hibou57)
@ 2010-10-31  8:12                 ` Dmitry A. Kazakov
  2010-10-31  9:49                   ` Yannick Duchêne (Hibou57)
  0 siblings, 1 reply; 78+ messages in thread
From: Dmitry A. Kazakov @ 2010-10-31  8:12 UTC (permalink / raw)


On Sat, 30 Oct 2010 23:53:13 +0200, Yannick Duch�ne (Hibou57) wrote:

> Le Sat, 30 Oct 2010 22:54:39 +0200, Dmitry A. Kazakov  
> <mailbox@dmitry-kazakov.de> a �crit:
>>> Why should generic usage be provable before instantiation ?
>>
>> Because you want to be able to deliver generic components.
> What would be your requirements to state you are able to deliver a library  
> ? (I mean a library, as a library, not linked to an application).
> 
> Aren't generics similar to libraries ?

to macro libraries

> If you are to deliver a generic as standalone, then there are things you  
> will never be able to prove, right, but just like you will not be able to  
> prove anything for a standalone library you've delivered.

The requirement is that what cannot be proved must be testable. Generics do
not fulfill it. As for provability, note also that generics fail here not
only because normal issues of something being undecidable. The train stops
miles before. Generics lack contracts [*]. You just cannot verify the
behavior since it is not specified. The specifications of Ada generics are
generic.

-------------
* Of course Ada generics have contracts (formal generic parameters etc),
but these exist at the meta language level, useless for checks and tests.

-- 
Regards,
Dmitry A. Kazakov
http://www.dmitry-kazakov.de



^ permalink raw reply	[flat|nested] 78+ messages in thread

* Re: Do people who use Ada also use ocaml or F#?
  2010-10-31  8:03           ` Yannick Duchêne (Hibou57)
@ 2010-10-31  8:14             ` Dmitry A. Kazakov
  0 siblings, 0 replies; 78+ messages in thread
From: Dmitry A. Kazakov @ 2010-10-31  8:14 UTC (permalink / raw)


On Sun, 31 Oct 2010 09:03:03 +0100, Yannick Duch�ne (Hibou57) wrote:

> Le Sun, 31 Oct 2010 08:38:38 +0100, Dmitry A. Kazakov  
> <mailbox@dmitry-kazakov.de> a �crit:
>> However it also
>> requires more upfront design, considered bad by some.
> What is upfront design ?

http://en.wikipedia.org/wiki/Big_Design_Up_Front

-- 
Regards,
Dmitry A. Kazakov
http://www.dmitry-kazakov.de



^ permalink raw reply	[flat|nested] 78+ messages in thread

* Re: Do people who use Ada also use ocaml or F#?
  2010-10-31  8:12                 ` Dmitry A. Kazakov
@ 2010-10-31  9:49                   ` Yannick Duchêne (Hibou57)
  0 siblings, 0 replies; 78+ messages in thread
From: Yannick Duchêne (Hibou57) @ 2010-10-31  9:49 UTC (permalink / raw)


Le Sun, 31 Oct 2010 09:12:27 +0100, Dmitry A. Kazakov  
<mailbox@dmitry-kazakov.de> a écrit:
>> If you are to deliver a generic as standalone, then there are things you
>> will never be able to prove, right, but just like you will not be able  
>> to
>> prove anything for a standalone library you've delivered.
>
> The requirement is that what cannot be proved must be testable. Generics  
> do
> not fulfill it.
I understand and see your point (while I do not share it, but there is  
nothing provable at this point here ;) )

Thanks for the explanations

-- 
Si les chats miaulent et font autant de vocalises bizarres, c’est pas pour  
les chiens.



^ permalink raw reply	[flat|nested] 78+ messages in thread

* Re: Do people who use Ada also use ocaml or F#?
  2010-10-31  2:58               ` Yannick Duchêne (Hibou57)
@ 2010-10-31 10:57                 ` J-P. Rosen
  2010-10-31 11:04                   ` Yannick Duchêne (Hibou57)
  2010-10-31 16:58                 ` Jeffrey Carter
  2010-11-01 17:46                 ` Colin Paul Gloster
  2 siblings, 1 reply; 78+ messages in thread
From: J-P. Rosen @ 2010-10-31 10:57 UTC (permalink / raw)


Le 31/10/2010 03:58, Yannick Duchêne (Hibou57) a écrit :
> As much as I understand it (I could not access any reference, as there
> are near to none at all on the web), HOOD do have to deal with object,
> and is not an implementation technique, but a analysis and design
> method. Pretty sure HOOD is to be considered object-oriented
The confusion comes from that HOOD 3.1 had no support for inheritance,
this was added in HOOD 4.

> (will have
> to ask for a PDF book about HOOD later, I am thinking about it since
> some time).
> 
You should have it by now :-)

-- 
---------------------------------------------------------
           J-P. Rosen (rosen@adalog.fr)
Adalog a déménagé / Adalog has moved:
2 rue du Docteur Lombard, 92441 Issy-les-Moulineaux CEDEX
Tel: +33 1 45 29 21 52, Fax: +33 1 45 29 25 00



^ permalink raw reply	[flat|nested] 78+ messages in thread

* Re: Do people who use Ada also use ocaml or F#?
  2010-10-31  7:38         ` Dmitry A. Kazakov
  2010-10-31  8:03           ` Yannick Duchêne (Hibou57)
@ 2010-10-31 11:00           ` J-P. Rosen
  2010-10-31 11:17             ` Dmitry A. Kazakov
  2010-10-31 18:02           ` Jeffrey Carter
  2 siblings, 1 reply; 78+ messages in thread
From: J-P. Rosen @ 2010-10-31 11:00 UTC (permalink / raw)


Le 31/10/2010 08:38, Dmitry A. Kazakov a �crit :
> Programming by extension focuses software design on reuse. Yes, it eases
> writing, just because reuse reduces the amount of code. However it also
> requires more upfront design, considered bad by some.
> 
> As for reading, I completely disagree. There is nothing more unreadable
> than cut'n'pasted code, which is the only alternative to reuse. 
Ouch! You just forget reusable components!

I can tell you that I have my own set of well-tested reusable components
that I use for all my developments. I have written them years ago, I
don't remember how they work, they just work.

-- 
---------------------------------------------------------
           J-P. Rosen (rosen@adalog.fr)
Adalog a d�m�nag� / Adalog has moved:
2 rue du Docteur Lombard, 92441 Issy-les-Moulineaux CEDEX
Tel: +33 1 45 29 21 52, Fax: +33 1 45 29 25 00



^ permalink raw reply	[flat|nested] 78+ messages in thread

* Re: Do people who use Ada also use ocaml or F#?
  2010-10-31 10:57                 ` J-P. Rosen
@ 2010-10-31 11:04                   ` Yannick Duchêne (Hibou57)
  0 siblings, 0 replies; 78+ messages in thread
From: Yannick Duchêne (Hibou57) @ 2010-10-31 11:04 UTC (permalink / raw)


Le Sun, 31 Oct 2010 11:57:11 +0100, J-P. Rosen <rosen@adalog.fr> a écrit:

> Le 31/10/2010 03:58, Yannick Duchêne (Hibou57) a écrit :
>> As much as I understand it (I could not access any reference, as there
>> are near to none at all on the web), HOOD do have to deal with object,
>> and is not an implementation technique, but a analysis and design
>> method. Pretty sure HOOD is to be considered object-oriented
> The confusion comes from that HOOD 3.1 had no support for inheritance,
> this was added in HOOD 4.
>
>> (will have
>> to ask for a PDF book about HOOD later, I am thinking about it since
>> some time).
>>
> You should have it by now :-)
Youpi!

(yes, just got it, lot of thanks and cheers)


-- 
Si les chats miaulent et font autant de vocalises bizarres, c’est pas pour  
les chiens.



^ permalink raw reply	[flat|nested] 78+ messages in thread

* Re: Do people who use Ada also use ocaml or F#?
  2010-10-31 11:00           ` J-P. Rosen
@ 2010-10-31 11:17             ` Dmitry A. Kazakov
  2010-10-31 12:51               ` J-P. Rosen
  0 siblings, 1 reply; 78+ messages in thread
From: Dmitry A. Kazakov @ 2010-10-31 11:17 UTC (permalink / raw)


On Sun, 31 Oct 2010 12:00:10 +0100, J-P. Rosen wrote:

> Le 31/10/2010 08:38, Dmitry A. Kazakov a �crit :
>> Programming by extension focuses software design on reuse. Yes, it eases
>> writing, just because reuse reduces the amount of code. However it also
>> requires more upfront design, considered bad by some.
>> 
>> As for reading, I completely disagree. There is nothing more unreadable
>> than cut'n'pasted code, which is the only alternative to reuse. 
> Ouch! You just forget reusable components!

Do you mean reusable components unreadable, or, maybe, that these
components are used as-is?

Maybe two-tier "assemble" design works for small throw-away projects, but
in Ada I would rather expect components combined into new components, i.e.
extended, if not functionally, then by aggregation.

-- 
Regards,
Dmitry A. Kazakov
http://www.dmitry-kazakov.de



^ permalink raw reply	[flat|nested] 78+ messages in thread

* Re: Do people who use Ada also use ocaml or F#?
  2010-10-31 11:17             ` Dmitry A. Kazakov
@ 2010-10-31 12:51               ` J-P. Rosen
  2010-10-31 15:07                 ` Dmitry A. Kazakov
  0 siblings, 1 reply; 78+ messages in thread
From: J-P. Rosen @ 2010-10-31 12:51 UTC (permalink / raw)


Le 31/10/2010 12:17, Dmitry A. Kazakov a �crit :
>>> As for reading, I completely disagree. There is nothing more unreadable
>>> than cut'n'pasted code, which is the only alternative to reuse. 
>> Ouch! You just forget reusable components!
> 
> Do you mean reusable components unreadable, or, maybe, that these
> components are used as-is?
Yes, reusable components, used as-is. I objected to your mention that
the only alternative to inheritance for reuse is cut-and-paste.

> Maybe two-tier "assemble" design works for small throw-away projects, but
> in Ada I would rather expect components combined into new components, i.e.
> extended, if not functionally, then by aggregation.
> 
You can build new components that use other components, hence you can
call it aggregation, but this is hidden in the body, so nobody cares,
it's not visible; unlike inheritance where the whole dependency has to
be visible.

That's why I claim that components are superior, because you never need
to be aware of more than one level.

-- 
---------------------------------------------------------
           J-P. Rosen (rosen@adalog.fr)
Adalog a d�m�nag� / Adalog has moved:
2 rue du Docteur Lombard, 92441 Issy-les-Moulineaux CEDEX
Tel: +33 1 45 29 21 52, Fax: +33 1 45 29 25 00



^ permalink raw reply	[flat|nested] 78+ messages in thread

* Re: Do people who use Ada also use ocaml or F#?
  2010-10-31 12:51               ` J-P. Rosen
@ 2010-10-31 15:07                 ` Dmitry A. Kazakov
  2010-10-31 15:32                   ` Yannick Duchêne (Hibou57)
  2010-10-31 18:23                   ` Jeffrey Carter
  0 siblings, 2 replies; 78+ messages in thread
From: Dmitry A. Kazakov @ 2010-10-31 15:07 UTC (permalink / raw)


On Sun, 31 Oct 2010 13:51:16 +0100, J-P. Rosen wrote:

> Le 31/10/2010 12:17, Dmitry A. Kazakov a �crit :
>> Maybe two-tier "assemble" design works for small throw-away projects, but
>> in Ada I would rather expect components combined into new components, i.e.
>> extended, if not functionally, then by aggregation.
>> 
> You can build new components that use other components, hence you can
> call it aggregation, but this is hidden in the body, so nobody cares,
> it's not visible; unlike inheritance where the whole dependency has to
> be visible.

But reusable components are visible as well, e.g. a list [component 1] of
arrays [component 2] of something [component 3].

> That's why I claim that components are superior, because you never need
> to be aware of more than one level.

Flatten hierarchies are not always good. Example: String vs.
Unbounded_String vs. Bounded string x single vs. wide vs. wide_wide =
geometric explosion of packages all over Ada standard library.

-- 
Regards,
Dmitry A. Kazakov
http://www.dmitry-kazakov.de



^ permalink raw reply	[flat|nested] 78+ messages in thread

* Re: Do people who use Ada also use ocaml or F#?
  2010-10-30 23:11           ` Jeffrey Carter
@ 2010-10-31 15:13             ` Florian Weimer
  0 siblings, 0 replies; 78+ messages in thread
From: Florian Weimer @ 2010-10-31 15:13 UTC (permalink / raw)


* Jeffrey Carter:

> Yield does what is intended by
>
> delay 0.0;
>
> as it is currently used: create a scheduling point where another task
> could get the processor, without otherwise slowing the current task
> down if there is no such other task.
>
> Given that the trend is to multiprocessors, it seems an odd thing to
> add at this point.

As far as I understand it, there's some sort of industry-wide
consensus to use coroutines/fibers/user-space cooperative threads to
generate work items which are then dispatched to per-CPU worker
threads.  The challenge is to keep the workers busy, while not
accumalting too much cruft which is only needed much later.  The pmap
example often used to promote Erlang shows this issue rather neatly,
IMHO.  In a sense, this challenge is a fallout from trying to solve
the overscheduling problem (when you spawn more threads than you have
resources, throughput decreases, often drastically).

It is not an exact replica of the old N:M threading model because the
coroutines are expected to be really lightweight this time.  I guess
it's still a waste of time because you need way too many processors to
get even with a sequential approach where most of the overhead has
been squeezed out.  Except for tasks which can be partitioned with
little or no communication, but those aren't in the interesting ones
anyway because it's easy to split them into separate processes.



^ permalink raw reply	[flat|nested] 78+ messages in thread

* Re: Do people who use Ada also use ocaml or F#?
  2010-10-31 15:07                 ` Dmitry A. Kazakov
@ 2010-10-31 15:32                   ` Yannick Duchêne (Hibou57)
  2010-10-31 20:00                     ` Dmitry A. Kazakov
  2010-10-31 18:23                   ` Jeffrey Carter
  1 sibling, 1 reply; 78+ messages in thread
From: Yannick Duchêne (Hibou57) @ 2010-10-31 15:32 UTC (permalink / raw)


Le Sun, 31 Oct 2010 16:07:10 +0100, Dmitry A. Kazakov  
<mailbox@dmitry-kazakov.de> a écrit:
>> You can build new components that use other components, hence you can
>> call it aggregation, but this is hidden in the body, so nobody cares,
>> it's not visible; unlike inheritance where the whole dependency has to
>> be visible.
>
> But reusable components are visible as well, e.g. a list [component 1] of
> arrays [component 2] of something [component 3].
Yes, they are also visible, but the visibility you need to have is not the  
same. Visibility here, does not really mean “what is visible”, instead it  
means “what needs to viewed”.

With composition, you just need to see the interfaces and what is directly  
connected to these interfaces, i.e. what you need to view is what is made  
of an exploration of the direct environment. With Inheritance, the  
exploration must be transitive, can go far and/or apply to many types,  
i.e. there is no real local circumscription of consequences, as what is at  
one place, may be visible from all the places where the inheritance graph  
can lead you from the original places (that is the meaning of “visible”  
here).

This can be powerful, as much as it can damage the whole system.

To talk using a picture : there are the kind of messages/mails/etc you  
will see no objection to broadcast, and there is the kind of you would  
avoid to. Something a bit similar applies (propagation). There are  
sensible things which should not be propagated through an Inheritance  
graph (which virtually has no limit), there are other for which you will  
not bother.

To say Composition is the only good way to go, would be extremist; but you  
can safely say, using Composition, you will avoid many potential troubles.  
The most secure you want to be with your design, the most you will use  
Composition. And if the power of Inheritance is used, you will have to  
carefully balance what you are throwing potentially far away (at least you  
may want to avoid for likely bombs, but you will not bother for fancy  
stuffs).

-- 
Si les chats miaulent et font autant de vocalises bizarres, c’est pas pour  
les chiens.



^ permalink raw reply	[flat|nested] 78+ messages in thread

* Re: Do people who use Ada also use ocaml or F#?
  2010-10-31  2:58               ` Yannick Duchêne (Hibou57)
  2010-10-31 10:57                 ` J-P. Rosen
@ 2010-10-31 16:58                 ` Jeffrey Carter
  2010-11-01 17:46                 ` Colin Paul Gloster
  2 siblings, 0 replies; 78+ messages in thread
From: Jeffrey Carter @ 2010-10-31 16:58 UTC (permalink / raw)


On 10/30/2010 07:58 PM, Yannick Duchêne (Hibou57) wrote:
> May be there was too much derivation levels ? Two levels should be
> sufficient in most of case I feel.

In some cases, as little as 2 levels.

> As much as I understand it (I could not access any reference, as there
> are near to none at all on the web), HOOD do have to deal with object,
> and is not an implementation technique, but a analysis and design
> method. Pretty sure HOOD is to be considered object-oriented (will have
> to ask for a PDF book about HOOD later, I am thinking about it since
> some time).

Right. Object orientation is a design characteristic, not an implementation 
characteristic.

> May be confusion between re-use and extension ? I know the most loud OOD
> voices expose classification and re-use in the mean time, so that it
> present derivation as both a way of classification and re-use. But
> classification/extensions and re-use are different things. You indeed
> re-use something when you extend, but to re-use is not to extend; and
> the primary topic with extension, is only extension, not re-use, which
> (the latter) only appears as a side-effect.

No, just the belief that by using "OOP" (which means programming by type 
extension and dispatching, and has nothing to do with OO) your S/W is object 
oriented, without any understanding of object orientation (or any design, as far 
as I could tell, for that matter).

-- 
Jeff Carter
"Blessed are they who convert their neighbors'
oxen, for they shall inhibit their girth."
Monty Python's Life of Brian
83



^ permalink raw reply	[flat|nested] 78+ messages in thread

* Re: Do people who use Ada also use ocaml or F#?
  2010-10-31  7:38         ` Dmitry A. Kazakov
  2010-10-31  8:03           ` Yannick Duchêne (Hibou57)
  2010-10-31 11:00           ` J-P. Rosen
@ 2010-10-31 18:02           ` Jeffrey Carter
  2 siblings, 0 replies; 78+ messages in thread
From: Jeffrey Carter @ 2010-10-31 18:02 UTC (permalink / raw)


On 10/31/2010 12:38 AM, Dmitry A. Kazakov wrote:
>
> Programming by extension focuses software design on reuse. Yes, it eases
> writing, just because reuse reduces the amount of code. However it also
> requires more upfront design, considered bad by some.

Funny, I've been writing and re-using reusable software for decades, and don't 
use programming by extension. Nor have I had any problem focusing on designing 
before coding.

> As for reading, I completely disagree. There is nothing more unreadable
> than cut'n'pasted code, which is the only alternative to reuse. And by the
> way, generics is the least readable Ada feature.

Even with well designed programming-by-extension code, I find it much harder to 
read than programming-by-composition code.

As said above, there most certainly is an alternative to programming by 
extension and to cut-and-paste for reuse.

I find generics far more readable than programming by extension.

And I'm well aware we disagree, and are unlikely ever to agree, which is why I 
think this (sub-)discussion should end here.

-- 
Jeff Carter
"Why, the Mayflower was full of Fireflies, and a few
horseflies, too. The Fireflies were on the upper deck,
and the horseflies were on the Fireflies."
Duck Soup
95



^ permalink raw reply	[flat|nested] 78+ messages in thread

* Re: Do people who use Ada also use ocaml or F#?
  2010-10-31 15:07                 ` Dmitry A. Kazakov
  2010-10-31 15:32                   ` Yannick Duchêne (Hibou57)
@ 2010-10-31 18:23                   ` Jeffrey Carter
  1 sibling, 0 replies; 78+ messages in thread
From: Jeffrey Carter @ 2010-10-31 18:23 UTC (permalink / raw)


On 10/31/2010 08:07 AM, Dmitry A. Kazakov wrote:
>
> But reusable components are visible as well, e.g. a list [component 1] of
> arrays [component 2] of something [component 3].

But everything's visible in one place, preserving locality, which enhances ease 
of reading.

-- 
Jeff Carter
"Why, the Mayflower was full of Fireflies, and a few
horseflies, too. The Fireflies were on the upper deck,
and the horseflies were on the Fireflies."
Duck Soup
95



^ permalink raw reply	[flat|nested] 78+ messages in thread

* Re: Do people who use Ada also use ocaml or F#?
  2010-10-31 15:32                   ` Yannick Duchêne (Hibou57)
@ 2010-10-31 20:00                     ` Dmitry A. Kazakov
  2010-10-31 20:04                       ` Yannick Duchêne (Hibou57)
  0 siblings, 1 reply; 78+ messages in thread
From: Dmitry A. Kazakov @ 2010-10-31 20:00 UTC (permalink / raw)


On Sun, 31 Oct 2010 16:32:57 +0100, Yannick Duchêne (Hibou57) wrote:

> Le Sun, 31 Oct 2010 16:07:10 +0100, Dmitry A. Kazakov  
> <mailbox@dmitry-kazakov.de> a écrit:
>>> You can build new components that use other components, hence you can
>>> call it aggregation, but this is hidden in the body, so nobody cares,
>>> it's not visible; unlike inheritance where the whole dependency has to
>>> be visible.
>>
>> But reusable components are visible as well, e.g. a list [component 1] of
>> arrays [component 2] of something [component 3].
> Yes, they are also visible, but the visibility you need to have is not the  
> same. Visibility here, does not really mean “what is visible”, instead it  
> means “what needs to viewed”.

This is not in favor of composition, which is less friendly to information
hiding than inheritance.

> With composition, you just need to see the interfaces

You don't have interfaces without inheritance. The very first step of
separation interface from concrete implementation involves two types and a
class of.

-- 
Regards,
Dmitry A. Kazakov
http://www.dmitry-kazakov.de



^ permalink raw reply	[flat|nested] 78+ messages in thread

* Re: Do people who use Ada also use ocaml or F#?
  2010-10-31 20:00                     ` Dmitry A. Kazakov
@ 2010-10-31 20:04                       ` Yannick Duchêne (Hibou57)
  2010-10-31 20:19                         ` Dmitry A. Kazakov
  0 siblings, 1 reply; 78+ messages in thread
From: Yannick Duchêne (Hibou57) @ 2010-10-31 20:04 UTC (permalink / raw)


Le Sun, 31 Oct 2010 21:00:09 +0100, Dmitry A. Kazakov  
<mailbox@dmitry-kazakov.de> a écrit:
> You don't have interfaces without inheritance. The very first step of
> separation interface from concrete implementation involves two types and  
> a
> class of.
Contracts may rely on type, but does not requires inheritance.


-- 
Si les chats miaulent et font autant de vocalises bizarres, c’est pas pour  
les chiens.



^ permalink raw reply	[flat|nested] 78+ messages in thread

* Re: Do people who use Ada also use ocaml or F#?
  2010-10-31 20:04                       ` Yannick Duchêne (Hibou57)
@ 2010-10-31 20:19                         ` Dmitry A. Kazakov
  0 siblings, 0 replies; 78+ messages in thread
From: Dmitry A. Kazakov @ 2010-10-31 20:19 UTC (permalink / raw)


On Sun, 31 Oct 2010 21:04:34 +0100, Yannick Duch�ne (Hibou57) wrote:

> Le Sun, 31 Oct 2010 21:00:09 +0100, Dmitry A. Kazakov  
> <mailbox@dmitry-kazakov.de> a �crit:
>> You don't have interfaces without inheritance. The very first step of
>> separation interface from concrete implementation involves two types and  
>> a class of.
> Contracts may rely on type, but does not requires inheritance.

In which case your argument about partial visibility does not apply.

-- 
Regards,
Dmitry A. Kazakov
http://www.dmitry-kazakov.de



^ permalink raw reply	[flat|nested] 78+ messages in thread

* Re: Do people who use Ada also use ocaml or F#?
  2010-10-30 19:37         ` Dmitry A. Kazakov
  2010-10-30 20:04           ` Yannick Duchêne (Hibou57)
@ 2010-10-31 21:46           ` Shark8
  2010-11-01  9:32             ` Dmitry A. Kazakov
  2010-11-01 11:44             ` Brian Drummond
  1 sibling, 2 replies; 78+ messages in thread
From: Shark8 @ 2010-10-31 21:46 UTC (permalink / raw)


On Oct 30, 1:37 pm, "Dmitry A. Kazakov" <mail...@dmitry-kazakov.de>
wrote:
> On Sat, 30 Oct 2010 21:12:36 +0200, Yannick Duchêne (Hibou57) wrote:
> > This is not more not less safe than any  
> > other composition process.
>
> This requires a proof, which would be hard to provide because generics are
> non-testable.
>
> --
> Regards,
> Dmitry A. Kazakovhttp://www.dmitry-kazakov.de

Are generics really non-testable?
I think they are, though perhaps they may quickly spiral into a wide
range of tests.

The simple example of a bubble-sort on an array is testable:

Generic
 Type Element_Type is private;
 Type Index_Type is (<>);
 Type Array_Type is Array( Index_Type Range <> ) of Element_Type;
 With Function "<" ( Left, Right : in Element_Type ) Return Boolean is
<>;
Function Bubble_Sort( Input : In Array_Type ) Return Array_type;
---- Body for Bubble_Sort
Function Bubble_Sort( Input : In Array_Type ) Return Array_type is
   begin
      Return Result: Array_Type:= Input do
         For Index_1 in Input'First..Index_Type'Pred(Input'Last) loop
            For Index_2 in Index_Type'Succ(Index_1)..Input'Last loop
               if Not (Input(Index_1) < Input(Index_2)) then
                  declare
                     Temp : Element_Type:= Result(Index_1);
                  begin
                     Result(Index_1):= Result(Index_2);
                     Result(Index_2):= Temp;
                  end;
               end if;
            end loop;
         end loop;
      End Return;
   end Bubble_Sort;

Because we know that the index is a discrete type, and has the 'Pred &
'Succ functions we can prove this to be correct; and because we are
requiring a function "<" for the element-type we can prove that this
is a correct and complete bubble-sort; it is also a generic function
though.

Things get much, much more complex very quickly when you expand out
into packages, but this does not invalidate this example.
It is my opinion that a lot of what the software industry is facing is
the culmination of the failure to really understand the problems we
have been given; I don't exclude myself from this assessment, many
times I have coded something, and then coded it again, and then again,
and *THEN* I finally **GET** the problem. {I am here distinguishing
getting the task-completed from _understanding_ the task itself.}

Much of that lack of a deeper understanding, in my opinion, is caused
by the Cut-n-paste mentality of my peers. C/C++/Java students have a
"rich tradition" of going online, looking up the code that "basically
does what you want" and then "tweaking" it to suit their needs.
Working within the realm of generics is somewhat akin to mathematical
induction, you HAVE to use the properties of the objects your working
with and, once you do it "magically" comes together. Just like
induction requires two distinct portions the "n -> n+1"- and the "n"-
portions generics can be divided up into two portions the problem that
you are trying to address, and the properties of the objects you are
working with within that problem.



^ permalink raw reply	[flat|nested] 78+ messages in thread

* Re: Do people who use Ada also use ocaml or F#?
  2010-10-31 21:46           ` Shark8
@ 2010-11-01  9:32             ` Dmitry A. Kazakov
  2010-11-01 10:17               ` Florian Weimer
  2010-11-05 12:46               ` Robert A Duff
  2010-11-01 11:44             ` Brian Drummond
  1 sibling, 2 replies; 78+ messages in thread
From: Dmitry A. Kazakov @ 2010-11-01  9:32 UTC (permalink / raw)


On Sun, 31 Oct 2010 14:46:07 -0700 (PDT), Shark8 wrote:

> On Oct 30, 1:37�pm, "Dmitry A. Kazakov" <mail...@dmitry-kazakov.de>
> wrote:
>> On Sat, 30 Oct 2010 21:12:36 +0200, Yannick Duch�ne (Hibou57) wrote:
>>> This is not more not less safe than any �
>>> other composition process.
>>
>> This requires a proof, which would be hard to provide because generics are
>> non-testable.
> 
> Are generics really non-testable?

How do you execute a generic body? Testable are generic instances.

> The simple example of a bubble-sort on an array is testable:
[...]

You mean provable. Yes, in some cases it is possible to prove certain
properties which would hold for any instance of a generic body.
 
> Working within the realm of generics is somewhat akin to mathematical
> induction, you HAVE to use the properties of the objects your working
> with and, once you do it "magically" comes together.

Right, but what you described is actually generic programming. Generic
programming = programming in terms of sets of types, rather than in terms
of individual types. I am not against it, I am against generic programming
done with generics, because done with classes (class is a set of types) it
is much safer and cleaner.

-- 
Regards,
Dmitry A. Kazakov
http://www.dmitry-kazakov.de



^ permalink raw reply	[flat|nested] 78+ messages in thread

* Re: Do people who use Ada also use ocaml or F#?
  2010-11-01  9:32             ` Dmitry A. Kazakov
@ 2010-11-01 10:17               ` Florian Weimer
  2010-11-05 12:46               ` Robert A Duff
  1 sibling, 0 replies; 78+ messages in thread
From: Florian Weimer @ 2010-11-01 10:17 UTC (permalink / raw)


* Dmitry A. Kazakov:

>> Are generics really non-testable?
>
> How do you execute a generic body?

You could use something like QuickCheck.  However, Ada generics tend
to be higher-order constructs, and those are always more difficult to
test.  But I'm sure most people still prefer them over the
alternatives (such as manual cut-and-paste, preprocessors and code
generators, and so on).



^ permalink raw reply	[flat|nested] 78+ messages in thread

* Re: Do people who use Ada also use ocaml or F#?
  2010-10-31 21:46           ` Shark8
  2010-11-01  9:32             ` Dmitry A. Kazakov
@ 2010-11-01 11:44             ` Brian Drummond
  1 sibling, 0 replies; 78+ messages in thread
From: Brian Drummond @ 2010-11-01 11:44 UTC (permalink / raw)


On Sun, 31 Oct 2010 14:46:07 -0700 (PDT), Shark8 <onewingedshark@gmail.com>
wrote:

>On Oct 30, 1:37�pm, "Dmitry A. Kazakov" <mail...@dmitry-kazakov.de>
>wrote:

>Are generics really non-testable?
>I think they are, though perhaps they may quickly spiral into a wide
>range of tests.
>
>The simple example of a bubble-sort on an array is testable:
...
>
>Because we know that the index is a discrete type, and has the 'Pred &
>'Succ functions we can prove this to be correct; and because we are
>requiring a function "<" for the element-type we can prove that this
>is a correct and complete bubble-sort; it is also a generic function
>though.
>
>Generic
> Type Element_Type is private;

I think you have argued that it is provable, not testable!

Which, given proof tools (Spark-2025, perhaps?) is IMO more desirable, but not
quite the same thing...

Generics are still infinitely preferable to C++ templates, in which (by
instantiating them with new types) I am still finding basic compile time errors
in a well-tested example by a vastly more competent C++ programmer than I am,
years after it was first used.

- Brian




^ permalink raw reply	[flat|nested] 78+ messages in thread

* Re: Do people who use Ada also use ocaml or F#?
  2010-11-01 17:46                 ` Colin Paul Gloster
@ 2010-11-01 17:03                   ` Vinzent Hoefler
  2010-11-03 13:30                     ` Colin Paul Gloster
  0 siblings, 1 reply; 78+ messages in thread
From: Vinzent Hoefler @ 2010-11-01 17:03 UTC (permalink / raw)


On Mon, 01 Nov 2010 18:46:29 +0100, Colin Paul Gloster <Colin_Paul_Gloster@acm.org> wrote:

> HOOD, the so-called Hierarchial Object-Oriented Design method, is not
> object-oriented.

Care to explain why?

IMO it has everything what is needed to be called object-oriented.


Vinzent.


-- 
There is no signature.



^ permalink raw reply	[flat|nested] 78+ messages in thread

* Re: Do people who use Ada also use ocaml or F#?
  2010-10-31  2:58               ` Yannick Duchêne (Hibou57)
  2010-10-31 10:57                 ` J-P. Rosen
  2010-10-31 16:58                 ` Jeffrey Carter
@ 2010-11-01 17:46                 ` Colin Paul Gloster
  2010-11-01 17:03                   ` Vinzent Hoefler
  2 siblings, 1 reply; 78+ messages in thread
From: Colin Paul Gloster @ 2010-11-01 17:46 UTC (permalink / raw)


[-- Attachment #1: Type: TEXT/PLAIN, Size: 625 bytes --]

Yannick Duchêne (Hibou57) <yannick_duchene@Yahoo.Fr> sent on October
31st, 2010:

|-------------------------------------|
|"[..]                                |
|                                     |
|[..]                                 |
|[..] Pretty sure HOOD is             |
|to be considered object-oriented [..]|
|[..]                                 |
|                                     |
|[..]"                                |
|-------------------------------------|

HOOD, the so-called Hierarchial Object-Oriented Design method, is not
object-oriented.

Yours sincerely,
Colin Paul Gloster

^ permalink raw reply	[flat|nested] 78+ messages in thread

* Re: Do people who use Ada also use ocaml or F#?
  2010-11-01 17:03                   ` Vinzent Hoefler
@ 2010-11-03 13:30                     ` Colin Paul Gloster
  2010-11-03 19:16                       ` Yannick Duchêne (Hibou57)
  0 siblings, 1 reply; 78+ messages in thread
From: Colin Paul Gloster @ 2010-11-03 13:30 UTC (permalink / raw)


Vinzent Hoefler sent on November 1st, 2010:

|-----------------------------------------------------------------------|
|"On Mon, 01 Nov 2010 18:46:29 +0100, Colin Paul Gloster                |
|<Colin_Paul_Gloster@acm.org> wrote:                                    |
|                                                                       |
|> HOOD, the so-called Hierarchial Object-Oriented Design method, is not|
|> object-oriented.                                                     |
|                                                                       |
|Care to explain why?                                                   |
|                                                                       |
|IMO it has everything what is needed to be called object-oriented."    |
|-----------------------------------------------------------------------|

HOOD enforces type consistency. Object-oriented languages are weakly
typed.

HOOD does not promote jumping into prototyping. Object-oriented
systems do not always mature out of prototyping.

HOOD has generics. Object orientation does not need generics.

Object orientation supports interactive modifications to the system
while it is being run, without relying on patches in machine code.



^ permalink raw reply	[flat|nested] 78+ messages in thread

* Re: Do people who use Ada also use ocaml or F#?
  2010-11-03 13:30                     ` Colin Paul Gloster
@ 2010-11-03 19:16                       ` Yannick Duchêne (Hibou57)
  0 siblings, 0 replies; 78+ messages in thread
From: Yannick Duchêne (Hibou57) @ 2010-11-03 19:16 UTC (permalink / raw)


Le Wed, 03 Nov 2010 14:30:25 +0100, Colin Paul Gloster  
<Colin_Paul_Gloster@acm.org> a écrit:
> HOOD enforces type consistency. Object-oriented languages are weakly
> typed.
Right for HOOD, wrong for OO. OO says nothing about typing, it is all  
about identifying the characteristics of an object at analysis stage and  
about to be able to express it in a language, which may be typed or not.  
If you've seen many untyped OO languages, this is not because OO is not  
typed, but because these languages added some more paradigm to OO to serve  
some targets. I would say : this is not really the language which is OO,  
this is the analysis.

To be honest, the language may provide support, like the minimum required  
for structures, but this not mandatory, as objects may be represented in  
any other way (even with their properties scattered every where in a  
database), and does not do a lot more.

> HOOD does not promote jumping into prototyping. Object-oriented
> systems do not always mature out of prototyping.
Here we are : OO is not prototyping (nor a theory of types), but some  
languages mixed prototyping and OO. Prototyping is indeed the other way  
(and most natural way for human beings) to do without typing, so they may  
be typed OO, and prototyped OO.

> HOOD has generics. Object orientation does not need generics.
I am not sure to see the point, so I will not reply.

> Object orientation supports interactive modifications to the system
> while it is being run, without relying on patches in machine code.
One again, these are other things, not OO.

You may have OO mixed with : dynamic linking, agents, prototypes, types,  
messages passing, method invokation, delegation, inheritance, object as  
class (or class as object), and so on.

OO is like an high level language compared to an assembly language, it was  
created to overcome limits of the classic structural approach which is  
unable to handle/manage large systems (while it is nice for smaller).  
Then, *on top of that*, you may have many things, just like an high level  
language which is not assembly, may be many things (you may not assert a  
lot about a language based on the only fact it is hight level). I also  
feel this is in some way comparable to Ada packages.

To draw a picture

         -> machine code (very early history)
            - tiny-applications
         -> assembly (which some one confuse with machine code)
            - small-applications
            - “coding” is the main matter
              (was created to ease coding, using
               symbols instead of numeric codes)
         -> high level structured language
            - medium to attempted large scale application
            - “coding” is lesser and lesser a matter
              and “analysis” comes in the place
              (structural language gave life to Analysis)
         -> object oriented language
            - “analysis” is clearly the matter, so much
              that it is even done more and more
              early in the application's live, so much
              that it became quite common to do
              analysis while not even a single line
              of source was ever written (!)
            - the old structural languages are always used,
              but they are used to implement OO (you
              will see structural stuff inside of
              object methods)
         -> modeling language (large and/or long life applications)
            - “analysis” is now the only one things : coding ? what
              is this ? OO is always there, plus some other hight
              level paradigm depending on the area (dynamic systems,
              parallel systems, network and web applications, user
              interfaces, intelligent agents, etc).
            - OO is now a bit relegated, to the base components, part
              of the basic alphabet. It turned to be the background
              and the base material (note that even in this
              context, OO still make use of structural languages
              for its own purpose, so it has not disappeared at all).


To be short

           Early time .... -----------> increasing time
           Small system .. -----------> larger system
           Few analysis .. -----------> more analysis up to be the only  
focus

OO is just a stage there (the actual one or the direct-previous one,  
depending on the point of view). With that, it may be typed, none-typed  
(depending on the area), have generic or not, and so on.


-- 
Si les chats miaulent et font autant de vocalises bizarres, c’est pas pour  
les chiens.



^ permalink raw reply	[flat|nested] 78+ messages in thread

* Re: Do people who use Ada also use ocaml or F#?
  2010-11-01  9:32             ` Dmitry A. Kazakov
  2010-11-01 10:17               ` Florian Weimer
@ 2010-11-05 12:46               ` Robert A Duff
  2010-11-05 16:39                 ` Dmitry A. Kazakov
  2010-11-06 17:22                 ` Stephen Leake
  1 sibling, 2 replies; 78+ messages in thread
From: Robert A Duff @ 2010-11-05 12:46 UTC (permalink / raw)


"Dmitry A. Kazakov" <mailbox@dmitry-kazakov.de> writes:

> How do you execute a generic body? Testable are generic instances.

    You can't test a generic without instantiating it.
    
    You can't test a procedure without calling it.
    
    You can't test an abstract type without declaring
    a concrete type, and some objects of that type.

What am I missing?

- Bob



^ permalink raw reply	[flat|nested] 78+ messages in thread

* Re: Do people who use Ada also use ocaml or F#?
  2010-11-05 12:46               ` Robert A Duff
@ 2010-11-05 16:39                 ` Dmitry A. Kazakov
  2010-11-06 17:22                 ` Stephen Leake
  1 sibling, 0 replies; 78+ messages in thread
From: Dmitry A. Kazakov @ 2010-11-05 16:39 UTC (permalink / raw)


On Fri, 05 Nov 2010 08:46:13 -0400, Robert A Duff wrote:

> "Dmitry A. Kazakov" <mailbox@dmitry-kazakov.de> writes:
> 
>> How do you execute a generic body? Testable are generic instances.
> 
>     You can't test a generic without instantiating it.
>     
>     You can't test a procedure without calling it.
>     
>     You can't test an abstract type without declaring
>     a concrete type, and some objects of that type.
> 
> What am I missing?

You can't test a task without running it and some other tasks and skewing
clock and scheduler.

You can't test a protected objects without running some tasks and skewing
clock and scheduler.

You can't test clock, hmm, at all.

+ the difficulty to achieve the desired grade of test coverage.

-- 
Regards,
Dmitry A. Kazakov
http://www.dmitry-kazakov.de



^ permalink raw reply	[flat|nested] 78+ messages in thread

* Re: Do people who use Ada also use ocaml or F#?
  2010-11-05 12:46               ` Robert A Duff
  2010-11-05 16:39                 ` Dmitry A. Kazakov
@ 2010-11-06 17:22                 ` Stephen Leake
  2010-11-06 20:56                   ` Robert A Duff
  2010-11-07  3:05                   ` Chad  R. Meiners
  1 sibling, 2 replies; 78+ messages in thread
From: Stephen Leake @ 2010-11-06 17:22 UTC (permalink / raw)


Robert A Duff <bobduff@shell01.TheWorld.com> writes:

> "Dmitry A. Kazakov" <mailbox@dmitry-kazakov.de> writes:
>
>> How do you execute a generic body? Testable are generic instances.
>
>     You can't test a generic without instantiating it.
>     
>     You can't test a procedure without calling it.
>     
>     You can't test an abstract type without declaring
>     a concrete type, and some objects of that type.
>
> What am I missing?

To truly test a generic, you need to test with all possible
instantiations.

Or at least with a representative subset. If the generic parameters are
well structured, it may be possible to show that a few instances are
sufficient.

That's much more effort than testing a single concrete procedure.

It may be worth it, of course; I often use generics precisely to reduce
testing burden.

-- 
-- Stephe



^ permalink raw reply	[flat|nested] 78+ messages in thread

* Re: Do people who use Ada also use ocaml or F#?
  2010-11-06 17:22                 ` Stephen Leake
@ 2010-11-06 20:56                   ` Robert A Duff
  2010-11-06 23:03                     ` Dmitry A. Kazakov
  2010-11-07  3:05                   ` Chad  R. Meiners
  1 sibling, 1 reply; 78+ messages in thread
From: Robert A Duff @ 2010-11-06 20:56 UTC (permalink / raw)


Stephen Leake <stephen_leake@stephe-leake.org> writes:

> Robert A Duff <bobduff@shell01.TheWorld.com> writes:
>
>> "Dmitry A. Kazakov" <mailbox@dmitry-kazakov.de> writes:
>>
>>> How do you execute a generic body? Testable are generic instances.
>>
>>     You can't test a generic without instantiating it.
>>     
>>     You can't test a procedure without calling it.
>>     
>>     You can't test an abstract type without declaring
>>     a concrete type, and some objects of that type.
>>
>> What am I missing?
>
> To truly test a generic, you need to test with all possible
> instantiations.

To "truly" test a procedure, you have to call it with all
possible parameter values (and all possible globals,
if it uses those).

> Or at least with a representative subset.

Right, it's usually impossible to try all possibilities,
so we pick some subset -- for generics and for procedures.

>...If the generic parameters are
> well structured, it may be possible to show that a few instances are
> sufficient.

For something like Ada.Containers.Vectors, it's fairly easy
to know that the code doesn't much care what the element type is.

If you find a bug in a generic, it is almost certainly
a bug in every instance, in my experience.  Only rarely
does the bug depend on specific properties of some
instance.

> That's much more effort than testing a single concrete procedure.

Well, I agree that testing a generic is typically harder
than testing a single procedure.  That's because generics
are typically more, um, "general".  But the claim was
that generics are untestable, which seems too extreme to me.
And if you replace generics with some other feature,
then if that feature has the generality desired,
it will be equally hard to test.

> It may be worth it, of course; I often use generics precisely to reduce
> testing burden.

Right, it's certainly easier to test a generic, than to write
similar code 20 times for 20 different types, and test all of
those.  Just like it's easier to test a single procedure than to
test 20 cut&pasted versions of the same code (each of which
has been slightly modified so they're not quite identical
anymore).

- Bob



^ permalink raw reply	[flat|nested] 78+ messages in thread

* Re: Do people who use Ada also use ocaml or F#?
  2010-11-06 20:56                   ` Robert A Duff
@ 2010-11-06 23:03                     ` Dmitry A. Kazakov
  2010-11-06 23:41                       ` Yannick Duchêne (Hibou57)
                                         ` (2 more replies)
  0 siblings, 3 replies; 78+ messages in thread
From: Dmitry A. Kazakov @ 2010-11-06 23:03 UTC (permalink / raw)


On Sat, 06 Nov 2010 16:56:14 -0400, Robert A Duff wrote:

> Stephen Leake <stephen_leake@stephe-leake.org> writes:
> 
>> To truly test a generic, you need to test with all possible
>> instantiations.
> 
> To "truly" test a procedure, you have to call it with all
> possible parameter values (and all possible globals,
> if it uses those).

Loaded at all possible memory addresses, etc. There is no such thing as a
"true" test. Some things have to be taken for granted/proved.

>> That's much more effort than testing a single concrete procedure.
> 
> Well, I agree that testing a generic is typically harder
> than testing a single procedure.  That's because generics
> are typically more, um, "general".

No, it is because there are more things which can be safely assumed for a
well-designed procedure than for a well-designed generic.

Furthermore, I would bet that practically any generic can be broken per
erroneous instantiation, e.g. by passing function "-" where "+" expected.
We discard these cases as unlike, but we cannot prove that they indeed do
not happen, until we instantiate, with is the essence of being
non-testable. For procedures testing usually covers the inputs necessary to
deduce that it works for all other inputs. Erroneous usages do not exist or
well known/detectable/preventable.

-- 
Regards,
Dmitry A. Kazakov
http://www.dmitry-kazakov.de



^ permalink raw reply	[flat|nested] 78+ messages in thread

* Re: Do people who use Ada also use ocaml or F#?
  2010-11-06 23:03                     ` Dmitry A. Kazakov
@ 2010-11-06 23:41                       ` Yannick Duchêne (Hibou57)
  2010-11-07  0:18                       ` Yannick Duchêne (Hibou57)
  2010-11-07 11:51                       ` Simon Wright
  2 siblings, 0 replies; 78+ messages in thread
From: Yannick Duchêne (Hibou57) @ 2010-11-06 23:41 UTC (permalink / raw)


Le Sun, 07 Nov 2010 00:03:04 +0100, Dmitry A. Kazakov  
<mailbox@dmitry-kazakov.de> a écrit:
> Furthermore, I would bet that practically any generic can be broken per
> erroneous instantiation, e.g. by passing function "-" where "+" expected.
Good point. I don't know how I didn't though about this one (may be  
because I do not use generics that much).

Now better understand your point about formal proof. Until we get it, why  
not a sanity check in generics initialization ? This sanity check could  
test assertions like the ones you would like to express in formal  
contract, and raise a runtime error if ever if fails. This is no more  
exception safe, but better an application which raise an error at startup  
than one which do silly things without a single warning.


-- 
Si les chats miaulent et font autant de vocalises bizarres, c’est pas pour  
les chiens.

“I am fluent in ASCII” [Warren 2010]



^ permalink raw reply	[flat|nested] 78+ messages in thread

* Re: Do people who use Ada also use ocaml or F#?
  2010-11-06 23:03                     ` Dmitry A. Kazakov
  2010-11-06 23:41                       ` Yannick Duchêne (Hibou57)
@ 2010-11-07  0:18                       ` Yannick Duchêne (Hibou57)
  2010-11-07 11:51                       ` Simon Wright
  2 siblings, 0 replies; 78+ messages in thread
From: Yannick Duchêne (Hibou57) @ 2010-11-07  0:18 UTC (permalink / raw)


Le Sun, 07 Nov 2010 00:03:04 +0100, Dmitry A. Kazakov  
<mailbox@dmitry-kazakov.de> a écrit:
> Furthermore, I would bet that practically any generic can be broken per
> erroneous instantiation, e.g. by passing function "-" where "+" expected.
> We discard these cases as unlike, but we cannot prove that they indeed do
> not happen, until we instantiate,
Another comment: in that area, may be the use of generics in the exact  
purpose of mixins in safer than the wide use of generics. Reason: a  
package may require its formal parameters to be derived from a type, and  
the semantic of these types is already known (unlike what can get with  
more widely opened parameters, in which we may indeed receive anything,  
the only guarantee being that the signatures match).


-- 
Si les chats miaulent et font autant de vocalises bizarres, c’est pas pour  
les chiens.

“I am fluent in ASCII” [Warren 2010]



^ permalink raw reply	[flat|nested] 78+ messages in thread

* Re: Do people who use Ada also use ocaml or F#?
  2010-11-06 17:22                 ` Stephen Leake
  2010-11-06 20:56                   ` Robert A Duff
@ 2010-11-07  3:05                   ` Chad  R. Meiners
  1 sibling, 0 replies; 78+ messages in thread
From: Chad  R. Meiners @ 2010-11-07  3:05 UTC (permalink / raw)


On Nov 6, 1:22 pm, Stephen Leake <stephen_le...@stephe-leake.org>
wrote:
> Robert A Duff <bobd...@shell01.TheWorld.com> writes:
>
> > "Dmitry A. Kazakov" <mail...@dmitry-kazakov.de> writes:
>
> >> How do you execute a generic body? Testable are generic instances.
>
> >     You can't test a generic without instantiating it.
>
> >     You can't test a procedure without calling it.
>
> >     You can't test an abstract type without declaring
> >     a concrete type, and some objects of that type.
>
> > What am I missing?
>
> To truly test a generic, you need to test with all possible
> instantiations.
>
> Or at least with a representative subset. If the generic parameters are
> well structured, it may be possible to show that a few instances are
> sufficient.
>
> That's much more effort than testing a single concrete procedure.
>
> It may be worth it, of course; I often use generics precisely to reduce
> testing burden.
>
> --
> -- Stephe

No, this really isn't the case.  When you write a generic you only
need to test it for the cases that you intend to use it.  When you
attempt to reuse the generic, however, you need to test and verify
that the code is appropriate for reuse.

To bring this back to the original question, this is almost a mantra
of FP.  You need to make sure you are using the function (generic)
correctly, or you need to modify the function (or generic).



^ permalink raw reply	[flat|nested] 78+ messages in thread

* Re: Do people who use Ada also use ocaml or F#?
  2010-11-06 23:03                     ` Dmitry A. Kazakov
  2010-11-06 23:41                       ` Yannick Duchêne (Hibou57)
  2010-11-07  0:18                       ` Yannick Duchêne (Hibou57)
@ 2010-11-07 11:51                       ` Simon Wright
  2010-11-07 12:14                         ` Dmitry A. Kazakov
  2 siblings, 1 reply; 78+ messages in thread
From: Simon Wright @ 2010-11-07 11:51 UTC (permalink / raw)


"Dmitry A. Kazakov" <mailbox@dmitry-kazakov.de> writes:

> Furthermore, I would bet that practically any generic can be broken
> per erroneous instantiation, e.g. by passing function "-" where "+"
> expected.  We discard these cases as unlike, but we cannot prove that
> they indeed do not happen, until we instantiate, with is the essence
> of being non-testable.

Good grief, most code won't give the right answers (=> answers you were
hoping for) if you violate its preconditions!



^ permalink raw reply	[flat|nested] 78+ messages in thread

* Re: Do people who use Ada also use ocaml or F#?
  2010-11-07 11:51                       ` Simon Wright
@ 2010-11-07 12:14                         ` Dmitry A. Kazakov
  0 siblings, 0 replies; 78+ messages in thread
From: Dmitry A. Kazakov @ 2010-11-07 12:14 UTC (permalink / raw)


On Sun, 07 Nov 2010 11:51:32 +0000, Simon Wright wrote:

> "Dmitry A. Kazakov" <mailbox@dmitry-kazakov.de> writes:
> 
>> Furthermore, I would bet that practically any generic can be broken
>> per erroneous instantiation, e.g. by passing function "-" where "+"
>> expected.  We discard these cases as unlike, but we cannot prove that
>> they indeed do not happen, until we instantiate, with is the essence
>> of being non-testable.
> 
> Good grief, most code won't give the right answers (=> answers you were
> hoping for) if you violate its preconditions!

That depends. If Read raised End_Error, while I hoped to get a Character,
was it right or wrong?

IMO one of the most important characteristics of bad design are
preconditions, which can get violated. The design is extremely bad when
they can be violated without a notice. Preconditions is what makes usage
unsafe.

-- 
Regards,
Dmitry A. Kazakov
http://www.dmitry-kazakov.de



^ permalink raw reply	[flat|nested] 78+ messages in thread

end of thread, other threads:[~2010-11-07 12:14 UTC | newest]

Thread overview: 78+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-10-29  2:27 Do people who use Ada also use ocaml or F#? Chad  R. Meiners
2010-10-29  2:58 ` Yannick Duchêne (Hibou57)
2010-10-30  1:32   ` Chad  R. Meiners
2010-10-30  2:22     ` Yannick Duchêne (Hibou57)
2010-10-30  3:44       ` Chad  R. Meiners
2010-10-30 12:15     ` Georg Bauhaus
2010-10-30 12:14   ` Florian Weimer
2010-10-30 12:46     ` Yannick Duchêne (Hibou57)
2010-10-30 13:59       ` Florian Weimer
2010-10-30 14:12       ` Niklas Holsti
2010-10-30 18:58         ` Yannick Duchêne (Hibou57)
2010-10-30 19:20           ` Georg Bauhaus
2010-10-30 23:11           ` Jeffrey Carter
2010-10-31 15:13             ` Florian Weimer
2010-10-29  7:53 ` Dmitry A. Kazakov
2010-10-29 17:10   ` Yannick Duchêne (Hibou57)
2010-10-29 19:10     ` Dmitry A. Kazakov
2010-10-29 22:16   ` Jeffrey Carter
2010-10-30  0:01     ` Vinzent Hoefler
2010-10-30  2:07       ` Chad  R. Meiners
2010-10-30 23:02         ` Jeffrey Carter
2010-10-30 23:30           ` Yannick Duchêne (Hibou57)
2010-10-31  2:31             ` Jeffrey Carter
2010-10-31  2:58               ` Yannick Duchêne (Hibou57)
2010-10-31 10:57                 ` J-P. Rosen
2010-10-31 11:04                   ` Yannick Duchêne (Hibou57)
2010-10-31 16:58                 ` Jeffrey Carter
2010-11-01 17:46                 ` Colin Paul Gloster
2010-11-01 17:03                   ` Vinzent Hoefler
2010-11-03 13:30                     ` Colin Paul Gloster
2010-11-03 19:16                       ` Yannick Duchêne (Hibou57)
2010-10-30  7:41     ` Dmitry A. Kazakov
2010-10-30 23:08       ` Jeffrey Carter
2010-10-30 23:15         ` Vinzent Hoefler
2010-10-31  2:36           ` Jeffrey Carter
2010-10-31  3:01             ` Yannick Duchêne (Hibou57)
2010-10-31  4:52               ` Jeffrey Carter
2010-10-31  5:12                 ` Yannick Duchêne (Hibou57)
2010-10-31  7:38         ` Dmitry A. Kazakov
2010-10-31  8:03           ` Yannick Duchêne (Hibou57)
2010-10-31  8:14             ` Dmitry A. Kazakov
2010-10-31 11:00           ` J-P. Rosen
2010-10-31 11:17             ` Dmitry A. Kazakov
2010-10-31 12:51               ` J-P. Rosen
2010-10-31 15:07                 ` Dmitry A. Kazakov
2010-10-31 15:32                   ` Yannick Duchêne (Hibou57)
2010-10-31 20:00                     ` Dmitry A. Kazakov
2010-10-31 20:04                       ` Yannick Duchêne (Hibou57)
2010-10-31 20:19                         ` Dmitry A. Kazakov
2010-10-31 18:23                   ` Jeffrey Carter
2010-10-31 18:02           ` Jeffrey Carter
2010-10-30  2:07   ` Chad  R. Meiners
2010-10-30  2:29     ` Yannick Duchêne (Hibou57)
2010-10-30  3:55       ` Chad  R. Meiners
2010-10-30  7:49     ` Dmitry A. Kazakov
2010-10-30 12:18   ` Florian Weimer
2010-10-30 12:59     ` Dmitry A. Kazakov
2010-10-30 19:12       ` Yannick Duchêne (Hibou57)
2010-10-30 19:37         ` Dmitry A. Kazakov
2010-10-30 20:04           ` Yannick Duchêne (Hibou57)
2010-10-30 20:54             ` Dmitry A. Kazakov
2010-10-30 21:53               ` Yannick Duchêne (Hibou57)
2010-10-31  8:12                 ` Dmitry A. Kazakov
2010-10-31  9:49                   ` Yannick Duchêne (Hibou57)
2010-10-31 21:46           ` Shark8
2010-11-01  9:32             ` Dmitry A. Kazakov
2010-11-01 10:17               ` Florian Weimer
2010-11-05 12:46               ` Robert A Duff
2010-11-05 16:39                 ` Dmitry A. Kazakov
2010-11-06 17:22                 ` Stephen Leake
2010-11-06 20:56                   ` Robert A Duff
2010-11-06 23:03                     ` Dmitry A. Kazakov
2010-11-06 23:41                       ` Yannick Duchêne (Hibou57)
2010-11-07  0:18                       ` Yannick Duchêne (Hibou57)
2010-11-07 11:51                       ` Simon Wright
2010-11-07 12:14                         ` Dmitry A. Kazakov
2010-11-07  3:05                   ` Chad  R. Meiners
2010-11-01 11:44             ` Brian Drummond

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