From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Thread: 103376,21960280f1d61e84 X-Google-Attributes: gid103376,public X-Google-Language: ENGLISH,ASCII-7-bit Newsgroups: comp.lang.ada Subject: Re: How come Ada isn't more popular? References: <1169636785.504223.139630@j27g2000cwj.googlegroups.com> <45b8361a_5@news.bluewin.ch> <3pejpgfbki.fsf@hod.lan.m-e-leypold.de> <8lwt2zb8ga.fsf@hod.lan.m-e-leypold.de> <96swuj6qxb$.1k74rt53lh46v.dlg@40tude.net> From: Markus E Leypold Organization: N/A Date: Sun, 04 Feb 2007 23:33:40 +0100 Message-ID: User-Agent: Some cool user agent (SCUG) Cancel-Lock: sha1:4tEZG0z9dAPmGELm8D5Nh8QNlLI= MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii NNTP-Posting-Host: 88.72.198.57 X-Trace: news.arcor-ip.de 1170628118 88.72.198.57 (4 Feb 2007 23:28:38 +0200) X-Complaints-To: abuse@arcor-ip.de Path: g2news2.google.com!news3.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsfeed.arcor-ip.de!news.arcor-ip.de!not-for-mail Xref: g2news2.google.com comp.lang.ada:8939 Date: 2007-02-04T23:33:40+01:00 List-Id: "Dmitry A. Kazakov" writes: > On Sun, 04 Feb 2007 21:18:55 +0100, Markus E Leypold wrote: > >> "Dmitry A. Kazakov" writes: >> >>> Or not, if you have relocatable objects, for instance. In general nothing >>> in objects requires X'Address. There are other kinds of identity. For >>> example id:X->T, where T is the type of X. >>> >>>> I fail to see how "identity" comes into the question of >>>> "value-oriented" languages (your term, BTW) and represenation >>>> sharing. GC is about references (to memory) and representation sharing >>>> works with references to parts of another "value" (see lisp >>>> lists). Represnattion sharing needs either reference counting >>>> (inefficient, is also just some kind of instant GC) or GC. >> >>> The example you mentioned was a tree. Do you want to share subtrees between >>> other trees? >> >> That's the way it is usually done in the implementation of a >> functional language. > > They don't share subtrees they share memory (implementation), which is > casual to the program semantics. They share representation in the underlying system / VM / whatever you call it. That is what I (expressing myself in shorthand) mean, by saying they share subtrees. They (the trees) don't share memory. > >>> When a subtree C of a tree A changes, should it ("it" is an >>> identity (:-)) in the tree B be changed as well? >> >> Change? There is no "change" in a functional world, only the >> production of new values (i.e. new elements from a specific set, in >> your case the set of all trees). > > (New values? What is the difference between new and old values? Do values > carry RFID chips with timestamps? (:-)) Don't play dumb. There is certainly an order between value occuring in a (functional) program. > No, you are wrong. In mathematics there is a notion of dependent and > independent variables. No. That must be physics you're talking about. In mathematics there are only elements and names for elements. If it "depends", what people mean is a function. > Mathematics is extremely "non-functional". How is that? > Consider a mapping between nodes of two trees which has to be > preserved. Now a function of the first tree is evaluated, what > happens with the function of the second tree? > g > A ------> B > | | > f| | id = nothing happens > | | > V g V > f(A) ------> B (broken invariant) The function of the second tree? What are you talking about? Let me repeat: In pure functional languages nothing "changes". >>> You cannot answer these questions in terms of tree values. >> >> It doesn't make sense in terms of tree values, that is, in a purely >> functional world. (BTW: The quoting sucks a bit -- one cannot readily see that "what makes sense" here, is the question "When a subtree C of a tree A changes, should it ("it" is an identity (:-)) in the tree B be changed as well?" -- and BTW2: "It" is not an identity. Not in any natural language I know of. Linguists certainly have a better word for it, but it is a context dependent reference.) > Of course it does. Consider a graph and its complement. Is it one value or > two? [To prevent a possible discussion, consider an incomputable g.] They are 2 values. Two different elements (except in the case it's by accident, the same ...). I didn't say wether you can "compute" it (i.e. find it). >>> Value vs. reference is a semantically irrelevant implementation >>> detail. >> >> Sementically, yes. If we are talking about a functional language. Not, >> if we talk about some imperative language. > How so? Ada is imperative, yet Foo (A) should not depend on whether the > compiler passes A by value or by reference. Arrgs. You're just not listening, do you? But look: It makes a difference if you pass an access to a variable instead of passing the variable as an in/out parameter and there is a difference if you pass it as an in parameter. This is difference in the respective semantics of the statements and passing an access is what is usually called passing a reference. It's a completely different thing if you're talking about references in the implementation of what the compiler produces or about references in the languages. We are talking firstly about languages here and there is, let me repeat, NO REFERENCES IN PURE FUNCTIONAL LANGUAGES (value oriented languages as you said). In their semantics if you like. But we are talking secondly about the usefulness of GC and when it is needed in language design. And there it is so, that functional languages can only be _implemented_ by representation sharing between values (simple example: The way lists work in a FP), because else a lot of copying would have to take place. But representation sharing is _implemented_ by pointers/references, and since sharing takes place, multiple pointers often point to one shared "sub-representation". And since we want to pass values freely around (there is no scope for values, see the other sub-thread ...) we hardly ever know statically how long a particular sub-representation will live. So a garbage collection mechanism is required. This might be reference counting (which is indeed just some ad hoc kind of GC) or some more advanced algorithm. As it turns out, suitably tuned advanced algorithms, like e.g. a generational garbage collector are much more efficient since they avoid the overhead of maintaining the reference counter every time a reference is duplicated (passed up and down the call stack) and instead do all the work every now and then. We can, BTW, learn something form this discussion: It might be true that it is possible to implement some kid of functional structures in Ada or any other imperative language of the Algol family (i.e structures you don't mutate to do date manipulation but instead produce new structures from those you already have), but without a GC already built in, it will always be inefficient (you either have to copy representations gratuitously or you'll have to do reference counting which is also not very efficient. But look: I'm just tired of this discussion. It's rather some time ago since I've been reading up on the relevant vocabulary. But somehow I doubt it is my inability to make myself understood that the discussion with you somehow never comes to the point. Partly it's because we seem to miss a goal in that discussion (what was the thing you wanted to convince me of?), partly I suggest you read all that up in a book on language design an implementation. Regards -- Markus