From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-0.9 required=5.0 tests=BAYES_00,FORGED_GMAIL_RCVD, FREEMAIL_FROM autolearn=no autolearn_force=no version=3.4.4 X-Google-Thread: 103376,9e7db243dfa070d7 X-Google-NewGroupId: yes X-Google-Attributes: gida07f3367d7,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII Path: g2news2.google.com!postnews.google.com!g25g2000yqn.googlegroups.com!not-for-mail From: "Chad R. Meiners" Newsgroups: comp.lang.ada Subject: Re: Do people who use Ada also use ocaml or F#? Date: Fri, 29 Oct 2010 20:44:10 -0700 (PDT) Organization: http://groups.google.com Message-ID: References: <4aacf4ab-6e56-421d-8381-26f8aeb5c840@p1g2000yqm.googlegroups.com> NNTP-Posting-Host: 173.48.246.55 Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-Trace: posting.google.com 1288410250 26784 127.0.0.1 (30 Oct 2010 03:44:10 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Sat, 30 Oct 2010 03:44:10 +0000 (UTC) Complaints-To: groups-abuse@google.com Injection-Info: g25g2000yqn.googlegroups.com; posting-host=173.48.246.55; posting-account=XRGbKgoAAACag8f1Ww4XGf81DDZtyfbX User-Agent: G2/1.0 X-HTTP-UserAgent: Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US) AppleWebKit/534.7 (KHTML, like Gecko) Chrome/7.0.517.41 Safari/534.7,gzip(gfe) Xref: g2news2.google.com comp.lang.ada:15927 Date: 2010-10-29T20:44:10-07:00 List-Id: On Oct 29, 10:22=A0pm, Yannick Duch=EAne (Hibou57) wrote: > Le Sat, 30 Oct 2010 03:32:53 +0200, Chad =A0R. Meiners =A0 > a =E9crit: > > > > > > > > > > > let reduce foo =3D > > =A0 let rec go carry =3D function > > =A0 =A0 | [] -> carry > > =A0 =A0 | value :: tail -> go (foo carry value) tail > > =A0 in go > > > the equivalent Ada would be (don't have an Ada compiler accessible) > > > generic > > =A0 type t is private; > > =A0 type t_list is limited private; > > =A0 with function foo(Left : t; Right : t) return t; > > =A0 with function head(item : t_list) return t; > > =A0 with function tail(item : t_list) return t_list; > > =A0 with function isNull(item : t_list) return Boolean; > > function reduce(carry : t; list : t_list) return t is > > begin > > =A0 if isNull(list) then > > =A0 =A0 return carry; > > =A0 else > > =A0 =A0 return reduce(foo(carry, head(list)), tail(list)); > > =A0 end if; > > end reduce; > > This would not be automatic generalization any more, but depending on the= =A0 > objects, tagged types may help here. And if the object type is always the= =A0 > 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 =A0 > same. With ML you do not have to know what will be the type(s) of the =A0 > object, with Ada you must. That is one of the reason why I said ML is =A0 > better at modeling, with Ada, the model is supposed to be known and not t= o =A0 > 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= =A0 > with Ada (and by the way you may discover and fix some flaws which was no= t =A0 > 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. =A0I 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. =A0I have used SPARK before, and I have built model checker > > generator in Ada. =A0I know a little bit about formal methods ;-p > > You are experienced so, I am not so much (I just learned and played with = =A0 > SPARK). > > > I was asking for others' vague and concrete ideas. =A0It is pretty > > difficult to figure out how ML feature and Ada features can be > > combined. =A0I am working on a gut feeling that the combination could b= e > > pretty awesome. =A0t'class would be pretty nice in an ML language. > > Combined together in a whole and large process, from idea to =A0 > implementation and deployment, certainly, but not combined at the languag= e =A0 > level, neither from Ada to ML or the opposite (by the way, I prefer one o= f =A0 > 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.