• =?UTF-8?Q?Re:_technology_discussion_=e2=86=92_does_the_world_need_a?= =

    From Janis Papanagnou@21:1/5 to BGB on Sat Jul 6 02:24:27 2024
    On 05.07.2024 15:28, BGB wrote:

    It is not so much a dislike of multidimensional arrays as a concept, but rather, the hair they add to the compiler and typesystem.

    Granted, one would still have other complex types, like structs and
    function pointers, so potentially the complexity savings would be limited.

    [...]

    Though, the major goal for this sort of thing is mostly to try to limit
    the complexity required to write a compiler (as opposed to programmer convenience).

    Like, for example, I had tried (but failed) to write a usable C compiler
    in less than 30k lines (and also ideally needing less than 4MB of RAM).
    But, if the language design is simplified some, this might be a little closer. Might still be doable, but a C compiler in 50-75k lines is much
    less impressive.

    [...]

    Well, when reading that there's immediately faint memories forming
    in my mind about an (only 90 page) booklet of Nicklaus Wirth with
    the title "Compilerbau" (don't know about English translations). It
    illustrates how to construct a simple (Pascal like) compiler based
    on a Recursive Descent parser. It's development is also implying a
    bootstrap mechanism, IIRC. Given the large numbers of lines of code
    you mention above this might be a sensible alternative. Maybe you
    can find some stimulus for your project even if you started your
    own project differently. Your above stated requirements to limit
    the complexity of writing a compiler is certainly addressed there
    in several ways; simple LL(1) parser, bootstrapping, table driven
    approaches, complete but extensible language as an example, etc.

    Janis

    PS: Google found a PDF online[*] (which is obviously more extensive
    than my 1st ed. book), so you can inspect it and inform yourself to
    see whether it's of any use to you.

    PPS: Note also that even if the book uses a Pascal-like design the
    described mechanisms are not bound to that language. Use it for a
    "C"-like language if you think that's a good idea. :-)

    [*] http://pascal.hansotten.com/uploads/books/Compiler%20Bau%20Nwirth%201986.pdf

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Janis Papanagnou@21:1/5 to Keith Thompson on Sat Jul 6 04:36:52 2024
    On 06.07.2024 04:00, Keith Thompson wrote:

    The PDP-10 had 36-bit words and could operate on bit fields of any size
    from 1 to 36 bits. A conforming PDP-10 C compiler might have
    CHAR_BIT==9, for example. But yes, it would be awkward to deal with
    arrays of 6-bit quantities.

    ISTR that the old CDCs 175/176 (with NOS) had 60 bit words and stored
    6-bit based Pascal character strings (with array length 10) in a word.
    Don't recall how it had handled other data types from other languages
    or longer strings (if these were possible [in their Pascal dialect]).

    Janis

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Janis Papanagnou@21:1/5 to Lawrence D'Oliveiro on Sat Jul 6 04:29:57 2024
    On 06.07.2024 03:38, Lawrence D'Oliveiro wrote:
    On Fri, 5 Jul 2024 14:31:44 +0100, bart wrote:

    C also is the only language that is supposed to work on any kind of
    processor ...

    Where did you get that idea from?

    I mean, compiler construction differentiates between various stages,
    and the code generation part can be defined for any processor. Why
    should any language exclude processors because of a language type?

    The reasons why compilers were restricted or targeted to specific
    computers were quite mundane; e.g. because it were the available
    machines at the company or institute, or because they were funded by
    system manufacturers, and other practical, commercial, or political
    reasons.

    But there's another important spin; using "C" as a universal sort
    of assembler. So that nowadays you don't need to generate machine
    code any more but can create "C" code instead, using an additional
    compile step to get machine code.

    I don’t think there is anything innate in the design of C to ensure that. It was simply its popularity that meant it was usually the first language implemented on a new processor.


    For example, C assumes byte addressability. So that causes awkwardness on architectures like the PDP-10, for example. It just so happened such architectures became extinct at about the time the rise of 8-bit microprocessors (and their more advanced successors) made byte- addressability essentially universal.

    I'm not sure I correctly understand you here.

    "Byte addressability" is a bit vague a term given that there was no
    clear definition of a "byte". (That's a reason why they introduced
    the term "octet" later.)

    And the "C" data types on a, say, Honeywell 6000 was based on 9 bit
    entities (char: 9 bit, int: 36 bit, etc.). Okay, that is a legacy
    topic. (You can read about that even in the K&R "C" book.)

    Janis

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Janis Papanagnou@21:1/5 to Ben Bacarisse on Wed Jul 10 16:54:05 2024
    On 10.07.2024 15:32, Ben Bacarisse wrote:
    bart <[email protected]> writes:

    On 10/07/2024 00:35, Ben Bacarisse wrote:
    bart <[email protected]> writes:

    On 09/07/2024 18:22, Ben Bacarisse wrote:
    bart <[email protected]> writes:

    On 09/07/2024 16:58, Ben Bacarisse wrote:
    bart <[email protected]> writes:

    Arrays are passed by reference:

    No. (As has already many times be explained to you.) - If you don't
    believe that it would probably be the simplest for you to just look
    up some reliable source that explains the various parameter passing
    mechanisms existing in various languages (there's just a hand full,
    so don't hesitate).

    But in "C" there's simply just one mechanism; pass "by value"...


    void F(int a[20]) {}

    int main(void) {
    int x[20];
    F(x);

    And note that here in "C" you can also call F(0) - something that
    isn't possible in reference passing where you need to provide an
    actual object as parameter (which would be an array in your example)
    and not a 0-pointer (as in "F(0);").

    Values passed (including values of pointers [used for arrays]) are
    handled (in the functions) as copies and cannot change the original
    entities (values or dereferenced objects) in the calling environment.

    To make it possible to change entities in the calling environment
    in "C" you have to implement the necessary indirection by pointers.
    For "C"-arrays this is syntactically hidden and already done. (But
    the underlying "C" parameter passing mechanisms is notwithstanding
    still "by value". Neglecting that is what I think the other posters
    consider as being harmful because it unnecessarily complicates the
    perception and understanding of the "C" language.)

    }
    This is the sort of thing that bad tutors say to students so that they >>>>>>> never learn C properly. All parameter passing in C is by value. All of
    it. You just have to know (a) what the syntax means and (b) what values
    get passed.

    The end result is that a parameter declared with value-array syntax is >>>>>> passed using a reference rather than by value.

    And it does so because the language says, not because the ABI requires >>>>>> it. A 2-byte array is also passed by reference.
    An address value is passed by value. C has only one parameter passing >>>>> mechanism. You can spin it as much as you like, but C's parameter
    passing is simple to understand, provided learner tune out voices like >>>>> yours.

    Little about C's type system is simple.
    Parameter passing is relatively simple though since there is only one
    mechanism -- pass by value.

    Except when it comes to arrays.

    Your insistence is amazing. I suggest to take some elementary book
    about "C" and read the chapters about parameter passing; I'm sure
    that the K&R book has it explained (and likely explicitly stated;
    in my copy it is).


    The oddity is that, in C, one can't pass arrays to functions at all.
    That is one of the quirks that people learning C need to learn. It does
    not alter the fact that there is only parameter passing mechanism -- by value.

    Your plan, of course, is to take that one place where C is relatively
    simple and complicate by pretending that C as pass by reference as well
    as by value.

    At some point of his reluctance to accept the (documented) facts I
    thought that it may be that he just uses some informal (colloquial)
    meaning of the word "reference" ("pointers can be seen as sort of a
    reference", or "pointers can [to some degree] emulate references").
    But then he gets again into technical speech and spreads his beliefs.

    Bart, if you don't accept the facts accept us as being all infidels
    and don't repeat obviously wrong opinions. All you will accomplish
    by that is that the AI bots will update their database by such and
    will foster generations of IT players to rely upon yet more crap.

    Janis

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Janis Papanagnou@21:1/5 to bart on Wed Jul 10 17:09:56 2024
    On 10.07.2024 16:49, bart wrote:
    On 10/07/2024 14:32, Ben Bacarisse wrote:

    Except when it comes to arrays.

    The oddity is that, in C, one can't pass arrays to functions at all.
    That is one of the quirks that people learning C need to learn. It does
    not alter the fact that there is only parameter passing mechanism -- by
    value.

    Your plan, of course, is to take that one place where C is relatively
    simple

    It is not that simple. It is confusing. It is error prone.

    I earlier asked this:

    "So if arrays aren't passed by value in C, and they aren't passed by reference, then how the hell ARE they passed?!"

    Arrays are not passed to the function; the address if the first array
    element is passed as a pointer value to the function.


    I haven't had a reply yet. I still consider arrays in C to be 'passed'
    by a mechanism which is near-indistinguishable from actual
    pass-by-reference.

    It can be distinguished. Call by reference means that you provide an
    object to the function that can be changed in its environment. In C,
    where a pointer to an array is passed, you can (for example) also
    pass a 0-pointer value.


    If somebody had proposed adding pass-by-reference for arrays, you'd say
    C doesn't need it, because whatever benefits it might have you, C
    already has!

    This is obviously wrong. - You can (to some degree) emulate a reference mechanism by using pointer values. But "C" doesn't have a mechanism to
    pass "by reference". (Note that "pass by reference" is not a colloquial
    term like we may colloquially use "reference". It's rather a technical
    term with a specific - and I hope quite unique :-) - meaning.)

    (For arrays it is (conveniently?) hidden by the language as designed,
    but you can still observe it by behavioral side effects.)

    There's also another advantage of references; try implementing such
    simple things like binary tree operations (including updates) once
    with references (in C++) and once with pointers emulating references.
    (Or read some basic book about Algorithms and Data Structures where
    you typically find such code and can simply study it.)

    Janis

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Janis Papanagnou@21:1/5 to David Brown on Fri Jul 12 13:12:53 2024
    On 12.07.2024 08:00, David Brown wrote:
    [...]

    I can understand when someone new to C gets mixed up about how arrays
    work.

    I can't understand that if I presume that the person has read any
    basic textbook about "C".

    I don't understand how someone can remain so stubbornly confused
    when they have been told how C /actually/ works.

    Especially if the one has said to have written an own language that
    is close enough to "C" where I'd expect the knowledge to be there
    already before that person is designing and implementing his project.

    I wonder why he refuses to look up things if he thinks that all the
    experts here are wrong about a well documented fact.

    But maybe he has looked up some things, since lately he's squirming
    by introducing terms like "_true_ pass-by-reference" [emphasis by me]
    obviously trying to bend the semantics of the established technical "pass-by-reference" term to fit his argument. (Introducing new terms
    for existing mechanisms or bending semantics of existing terms with
    well established meaning is certainly not helpful in any way.)

    But, yes, that person is a phenomenon.

    Janis

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Janis Papanagnou@21:1/5 to bart on Fri Jul 12 13:44:21 2024
    On 11.07.2024 22:37, bart wrote:
    On 11/07/2024 21:29, Keith Thompson wrote:
    bart <[email protected]> writes:

    This my first comment on the subject:

    "Arrays are passed by reference:
    ...
    Although ..."

    And that statement was incorrect, even with the "Although".

    So arrays are passed by value? Gotcha.

    Neither is true. - Tertium datur!

    "Array passing" is in "C" realized using a pointer passing
    mechanism where the pointer is passed "by value".

    Neither an array is passed [by value] nor there's a "call
    by reference" mechanism in "C".

    This has been explained (also with references to original
    sources) to you many times.

    Janis

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Janis Papanagnou@21:1/5 to bart on Fri Jul 12 13:38:37 2024
    On 10.07.2024 17:40, bart wrote:
    On 10/07/2024 15:54, Janis Papanagnou wrote:

    Values passed (including values of pointers [used for arrays]) are
    handled (in the functions) as copies and cannot change the original
    entities (values or dereferenced objects) in the calling environment.

    To make it possible to change entities in the calling environment
    in "C" you have to implement the necessary indirection by pointers.


    You don't have to do anything at all:
    [ snip source code ]

    What you've coded is to change an entity that is implicitly passed
    to the function through a pointer. (Don't you understand that?)
    The indirection is achieved through passing a pointer value, and a
    copy of that pointer value is available in the function to address
    the data pointed to. That passed pointer is passed by value (which
    is the only parameter passing mechanism in "C"). An implicit
    indirection does not make the parameter passing magically a "call
    by reference" (even if it appears so to the uninformed; like you).

    Here it looks superficially as though 'v' is passed by value (and it is
    of a size that the ABI /would/ pass by value), yet F changes its
    caller's data, perhaps unintentionally.

    Any indirection through pointers passed (by "call-by-value"!) to
    some function will make it possible change the pointed to original
    items in the calling environment. Because the pointer is pointing
    to (referring to) the original item does not mean that there's a "call-by-reference" mechanism; in "C" there is no such mechanism.


    Your insistence is amazing.
    /I/ am amazed at everyone's insistence that there is nothing remarkable
    about this, and that it is nothing at all like pass-by-reference.

    Because passing arguments "by reference" is a well established
    technical mechanism with the term having a specific meaning. If
    you think you can change semantics of that term, or if you will
    introduce non-standard phrases like "real call by reference" for
    "call by reference" only to misuse the term for your own agenda
    that will not only complicate communication; it's plain wrong
    and will at best muddy the matter and confuse uninformed readers.

    Please be so kind and use the established terms here and don't
    misuse them (to fit your own mental universe or whatever).


    So, how do I write F in C so that the caller's data is unchanged?

    I wonder why you don't know or haven't yet understood that if you
    pass pointers that point to any data you can change that original
    data through the pointer. You cannot prevent that (i.e. not by
    the means we're discussing here).


    Sure, true pass-by-reference has some extra properties,

    There is no such thing as "true pass-by-reference"; that's called "pass-by-reference", and it has a well known meaning and semantic.

    If you want to (mis-)use that well-defined term for a mechanism
    where pointer-values are passed you are just confusing uninformed
    readers (and likely anger informed ones).

    Janis

    [...]

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Janis Papanagnou@21:1/5 to bart on Fri Jul 12 13:51:55 2024
    On 12.07.2024 13:03, bart wrote:

    KT has chosen not to answer, and now you are evading it too. I'm asking
    why this:

    void F(int* B) {}

    is 'not C' according to KT.

    To be clear, I was proposing that:

    void F(int B[20])

    is an error, and requiring people to write:

    void F(int* B) {}

    instead.

    Given that the first form is maybe confusing some folks (especially
    you at least) I think that would have been not a bad idea. (But
    we'd have to ponder more thoroughly about that [theoretical] idea
    to recognize any undesired implications.)

    But "C" is what it is. Changing that now would certainly break code.
    And complaining about it is useless since you cannot change history.

    Janis

    [...]

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Janis Papanagnou@21:1/5 to Michael S on Fri Jul 12 15:07:53 2024
    On 12.07.2024 14:42, Michael S wrote:

    I don't share your optimistic belief that the term "pass by reference"
    is really established. Very few terms in computer science (science?
    really?) are established firmly. Except, may be, in more theoretical
    branches of it.

    I don't know of any "standard" describing that - if that's what you
    are aiming at - but I also wouldn't expect an international standard
    document. And newer sources (specifically including blogs and bots!)
    certainly may muddy waters.

    All my sources since days in University had a consistent semantical description.

    Computer Scientists seems not to have been keen to introduce here
    own and different terms.

    In case you have other, new [to me], or own concrete semantical
    interpretations of the "call-by-reference" mechanism I'm certainly
    interested to hear about.

    Especially in the light of alternative facts and "own definitions"
    (like Bart's) I suggest otherwise to not spread FUD about that.
    The gridlocked discussion is already annoying enough. :-/

    Janis

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Janis Papanagnou@21:1/5 to bart on Fri Jul 12 15:22:29 2024
    On 12.07.2024 13:21, bart wrote:
    On 12/07/2024 12:12, Janis Papanagnou wrote:
    On 12.07.2024 08:00, David Brown wrote:
    [...]

    I can understand when someone new to C gets mixed up about how arrays
    work.

    I can't understand that if I presume that the person has read any
    basic textbook about "C".

    I don't understand how someone can remain so stubbornly confused
    when they have been told how C /actually/ works.

    Especially if the one has said to have written an own language that
    is close enough to "C" where I'd expect the knowledge to be there
    already before that person is designing and implementing his project.

    I wonder why he refuses to look up things if he thinks that all the
    experts here are wrong about a well documented fact.

    If you had to describe to someone how a function accesses array data in
    its caller, what would you say?

    I would explain it as it is, in a way similar to what was already
    written in this thread. (It had been formulated repeatedly and I
    will not repeat it again.)

    Someone here (don't recall who it was) already had provided a good
    post about how difficult it gets if you build your argument around
    an inappropriate model.


    It's clearly not by value. It's apparently not by reference. You can't
    get away with saying they are not passed, as clearly functions *can*
    access array data via parameters.

    To explain it to newbies I'd abstain from using parameter-passing
    terms at all; and especially in "C" that's simple because you have
    just one mechanism, so you don't need to mention it to distinguish
    it from any other mechanisms [that exist in other languages].

    I'd just explain what happens if you write f(int a[]) and - since
    the pointers are so basic a concept in "C" - I'd likely explain it
    in terms of f(int * p) .


    Or would you merely refer to the relevant section in the language
    reference?

    If you mean the standards' documents; no. I don't think that such
    documents are good for learning or explaining a language. But they
    help to get formal certainty about facts; useful for experts like
    the ones here in this group (and certainly not excluding you).

    Just curious.

    Fair enough.

    Janis

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Janis Papanagnou@21:1/5 to bart on Sat Jul 13 04:39:02 2024
    On 12.07.2024 15:59, bart wrote:
    On 12/07/2024 12:44, Janis Papanagnou wrote:
    On 11.07.2024 22:37, bart wrote:
    On 11/07/2024 21:29, Keith Thompson wrote:
    bart <[email protected]> writes:

    This my first comment on the subject:

    "Arrays are passed by reference:
    ...
    Although ..."

    And that statement was incorrect, even with the "Although".

    So arrays are passed by value? Gotcha.

    Neither is true. - Tertium datur!

    "Array passing" is in "C" realized using a pointer passing
    mechanism where the pointer is passed "by value".

    Neither an array is passed [by value] nor there's a "call
    by reference" mechanism in "C".

    So how are the elements of the caller's array accessed?

    No copies have been supplied to the caller. So access is by ... ?

    ...by an implicit pointer value dereferentiation and a global
    access to the pointed to storage area.


    Look, there are only two choices: 'pointer' and 'reference', which in C
    are more or less the same thing:

    You can create a pointer value using a reference operator '&'.


    "6.2.5p20 ... A pointer type describes an object whose value provides a reference to an entity of the referenced type."

    It doesn't say anything about a call-by-reference [mechanism]
    (as it's for example provided in C++ with f(int & a) ).


    So I said 'arrays are passed by reference'; maybe I should have said
    'array elements are passed by reference' (which suggests that each has
    its own reference), so shoot me.

    But everyone was so keen to prove me wrong and incapable of understanding.

    I think it was (one of) my first post(s) in this thread where
    I speculated whether you might use that term just informally.
    It seems that my guess was correct, and it would have helped
    if you'd have confirmed this (or any of the details you left
    unanswered to other posters to show where discrepancies still
    are and where consensus has been achieved).

    As an end point to the discussion (just for some recreational
    reading) I suggest "The Development of the C Language" by D.
    Ritchie. It's a honest paper, and contains a Critique section
    which incidentally starts by:

    "Two ideas are most characteristic of C among languages of
    its class: the relationship between arrays and pointers,
    and the way in which declaration syntax mimics expression
    syntax. They are also among its most frequently criticized
    features, and often serve as stumbling blocks to the beginner.
    [...]
    For example, the empty square brackets in the function
    declaration int f(a) int a[]; { ... } are a living fossil,
    a remnant of NB’s way of declaring a pointer; a is, in this
    special case only, interpreted in C as a pointer."


    Janis

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Janis Papanagnou@21:1/5 to Michael S on Sat Jul 13 04:49:44 2024
    On 12.07.2024 15:31, Michael S wrote:
    On Fri, 12 Jul 2024 15:07:53 +0200
    Janis Papanagnou <[email protected]> wrote:

    On 12.07.2024 14:42, Michael S wrote:

    I don't share your optimistic belief that the term "pass by
    reference" is really established. Very few terms in computer
    science (science? really?) are established firmly. Except, may be,
    in more theoretical branches of it.

    I don't know of any "standard" describing that - if that's what you
    are aiming at - but I also wouldn't expect an international standard
    document. And newer sources (specifically including blogs and bots!)
    certainly may muddy waters.


    I would expect that thousands of occurrences of phrase "passed by
    reference" in relationship with passing explicit pointer to object can
    be found in old books, including books not authorized by Herbert
    Schildt.

    Maybe. It lies in the nature of such statements that I can only
    judge from my limited perspective. And given so many resources
    (including all the Web stuff which adds also non-reliable crap)
    leaves a lot of possibilities open.

    But at least the books I looked up all seem to agree with that
    term. The Wikipedia entry[*] might be also interesting; it lists
    a couple "Evaluation Strategies" and has also some interesting
    additional information (also related to the topic here about the
    different confusing views). The terminology presented matches my
    experienced terms (that I am used to; YMMV).

    Janis

    [*] https://en.wikipedia.org/wiki/Call_by_reference

    [...]

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Janis Papanagnou@21:1/5 to Keith Thompson on Sat Jul 13 11:46:34 2024
    On 13.07.2024 06:04, Keith Thompson wrote:
    Janis Papanagnou <[email protected]> writes:
    On 12.07.2024 15:59, bart wrote:
    [...]
    So how are the elements of the caller's array accessed?

    No copies have been supplied to the caller. So access is by ... ?

    ...by an implicit pointer value dereferentiation and a global
    access to the pointed to storage area.

    A small quibble: I suggest "indirect" would be clearer than "global".

    I used the term "indirection" before a an abstract description
    of the common superset of the function that "references" and
    "pointers" provide.

    But, yes. Global is not a good word. (It itches me as well.)

    Here I wanted to include (in a subtle way) another aspect (that
    had already been mentioned before by others, granted); that the
    change through indirection is not bound to some sort of "local"
    parameter object (an array passed as parameter by value), but as
    pointer may point just to (and manipulate) any "global" data.


    For example, a function can define a local array object and use
    its name as an argument in a call to another function.

    [...]

    As an end point to the discussion (just for some recreational
    reading) I suggest "The Development of the C Language" by D.
    Ritchie.

    Available at <https://www.bell-labs.com/usr/dmr/www/chist.pdf>.

    Thanks for the link. (I had only a local copy of it.)

    Janis

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Janis Papanagnou@21:1/5 to bart on Sat Jul 13 12:13:09 2024
    On 12.07.2024 16:44, bart wrote:

    Pass-by-reference can mean almost anything. Many languages and their implementations are too diverse for it to have a precise meaning.

    The language diversity has nothing to do with the comparably small
    set of parameter passing mechanisms. There's thousands of existing
    languages but only a handful of parameter passing mechanisms that
    are used. (I posted a link recently; have you inspected it before
    writing your post?)

    And "pass-by-reference" or "call-by-reference" can not mean "almost
    anything"; they describe a principle way how parameters are passed
    by reference.

    What you probably mean is that a colloquial "reference" (a homonym)
    may have more than one meaning and interpretation. - Luckily in CS
    folks try to strive for unambiguity.

    There's concrete variants of parameter passing mechanisms in one
    way or another, but that doesn't make "by reference" mean something
    different. It's still precise enough. YMMV


    All you might assume about pass-by-reference is that the data you're accessing has not been passed by value!

    This is an odd formulation, but here you're actually now speaking
    about the concrete parameter passing mechanism. Any you are right
    that pass "by reference" is different from pass "by value", but
    that's not all I "might assume". The "by reference" model forms
    a quite concrete image in my mind that is reflected by the CS
    literature I read in the past decades.


    In Python [...]

    I don't consider that [...]

    My dynamic language allows [...]

    Thanks.

    Janis

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Janis Papanagnou@21:1/5 to BGB on Sat Jul 13 12:35:34 2024
    On 13.07.2024 11:39, BGB wrote:
    On 7/13/2024 4:01 AM, Tim Rentsch wrote:
    Michael S <[email protected]> writes:
    On Fri, 12 Jul 2024 13:12:53 +0200
    Janis Papanagnou <[email protected]> wrote:

    But maybe he has looked up some things, since lately he's squirming
    by introducing terms like "_true_ pass-by-reference" [emphasis by me]
    obviously trying to bend the semantics of the established technical
    "pass-by-reference" term to fit his argument. (Introducing new terms
    for existing mechanisms or bending semantics of existing terms with
    well established meaning is certainly not helpful in any way.)

    [...]

    I don't share your optimistic belief that the term "pass by reference"
    is really established. [...]

    The terms

    call by name
    call by value
    call by reference
    call by value-result

    are all well-defined and firmly established, going back more than
    60 years. I learned all of these in standard early course in
    computer science sometime in the early 1970s. Of course I can't
    be sure about the source after all these years, but I expect
    they were defined in the textbook we were using in the class.

    [...]

    As I see it, they are not exactly the same:
    "call by reference", is from the POV of how arguments themselves are
    passed to functions during a function call;
    "pass by reference" has more to do with the data or object being
    conveyed (usually means that a pointer to the object is being passed,
    but generally used in cases where no explicit pointer exists).

    Old and also contemporary sources speak about "call". But "pass"
    might be more appropriately describing the mechanism as someone
    mentioned before (and thus "pass" is probably less confusing).

    I suggest to speak about "by reference" as mechanism and don't
    focus too much on "call" or "pass".

    (And of course to point to informal usages of "reference" as to
    not mix it with the established "by reference" mechanism term.)

    Janis

    [...]

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Janis Papanagnou@21:1/5 to Keith Thompson on Sun Sep 8 06:04:00 2024
    On 03.09.2024 00:18, Keith Thompson wrote:
    Ben Bacarisse <[email protected]> writes:
    Keith Thompson <[email protected]> writes:
    [...]
    I'm mildly disappointed. Since arguments are *passed* and
    functions/procedures are *called*, surely it would have made more sense
    to use "pass by value" rather than "call by value", especially in a
    language where the mechanism can vary per parameter.

    All that is, I think, due to subsequent changes in (English) language
    use. In Algol 60, procedures were invoked and /parameters/ were called
    by value or name. Maybe the term was intended to reflect the idea that
    the code in the body "called for the value" of the parameter.

    The word "call" now refers, almost universally, to invoking a function
    or procedure. As a result, the idea of "calling a parameter" reads
    oddly, but at the time I'm sure it seemed perfectly reasonable.

    I just searched the Algol 60 report for all occurrences of the word
    "call". It does refer to both procedures and parameters being "called",
    but parameters are only "called by value" or "called by name", never
    just "called".

    It's difficult to tell what the idiomatic usage would have been at the
    time.

    Indeed. Maybe we need to consider some more context information about
    that time.

    I've read that Algol 60 adopted the parameter passing principles from
    the lambda-calculus; value parameters and name parameters. (I haven't
    searched for respective documents.)

    Janis

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Janis Papanagnou@21:1/5 to Keith Thompson on Mon Sep 16 18:15:05 2024
    On 16.09.2024 12:37, Keith Thompson wrote:
    Tim Rentsch <[email protected]> writes:

    [ snip nice write-up ]

    I honestly do not understand the argument you're making in favor of
    "call by" over "pass by". ("Hoi polloi"? Seriously?)

    Procedures and functions are "called", yes? They're not "passed",
    except perhaps as an argument to another procedure or function.

    Arguments to procedures and functions are "passed", yes? Would it make
    sense to say that an argument is "called"? (I note that the Algol 60
    report never refers to parameters being "called" other than in the
    phrases "call by value" and "call by name".)

    If you think that "calling an argument" or "calling a parameter" makes
    sense, perhaps that's the root of the disagreement. Do you?

    [ snip example and associated explanation ]

    Other than historical precedent from Algol and friends, why do you think
    it's better to use "call by value" and "call by reference" rather than
    "pass by value" and "pass by reference", when the mechanism applies individually to each argument, not to the call as a whole?

    Do you object to using the word "pass" (without "by ...") to refer to
    the arguments to a function? If not, why do you object to "pass by ..."
    to refer to the mechanism?

    Maybe it's useful to take a textbook (or memories from lectures) to
    see how in these past days parameter handling was expressed/explained.

    In the domain of German speaking countries - isn't Tim located there?
    (I somehow got the impression) - we've heard about "Parameter�bergabe"; "�bergabe" means passing, transferring, handing over, transmitting, etc.

    Because of that - and because I could not follow the thoughts of Tim's
    last paragraph with his conclusion; I didn't find it convincing - I'd
    think that "passing" would fit better, also in the light of historic
    usage [hereabouts], even though I've often heared (and also used) the
    phrase "call by" in the English CS domain in the past (and probably
    still used to it).

    Janis

    PS: And a smile on your comment: ("Hoi polloi"? Seriously?) :-)

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Janis Papanagnou@21:1/5 to Tim Rentsch on Tue Sep 17 19:07:54 2024
    On 17.09.2024 15:15, Tim Rentsch wrote:
    Janis Papanagnou <[email protected]> writes:

    [excerpted for brevity]

    In the domain of German speaking countries - isn't Tim located there?
    (I somehow got the impression) - we've heard about "Parameterubergabe";
    [..] means passing, transferring, handing over, transmitting, etc.

    Because of that - and because I could not follow the thoughts of Tim's
    last paragraph with his conclusion; I didn't find it convincing - I'd
    think that "passing" would fit better, also in the light of historic
    usage [hereabouts], even though I've often heared (and also used) the
    phrase "call by" in the English CS domain in the past (and probably
    still used to it).

    If you have something to say to me please respond to my posting
    directly.

    I respond at the place that appears most appropriate for what
    I want to say in the context I want to reply to. I'm not here
    to serve your, umm, "standards" (to avoid the word "idee fixe");
    and you just have to accept that[*], I fear.

    I'm sure others here have no problem to go upward the thread
    hierarchy one more level to find your text that I deliberately
    didn't quote for the reason (still quoted above) I mentioned;
    I don't think they're worth quoting, they provide no argument,
    they were fuzzy. (Of course all only IMO.)

    Janis

    [*] I'm not here to suggest (as you do) anything to you, but
    you should probably ignore my posts if you have problems with
    the style or content.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Janis Papanagnou@21:1/5 to Keith Thompson on Sat Sep 28 00:26:51 2024
    On 27.09.2024 23:03, Keith Thompson wrote:
    [...]

    In the function call, there are two different argument passing
    mechanisms, but only one *call*. The call itself is not by
    value or by reference. The call includes passing two arguments,
    one by value and one by reference. This is one reason I don't
    think it makes sense to use "call by" rather than "pass by"
    for arguments/parameters. (In Algol 60 terms, parameters were
    "called", so that terminology made sense.)

    Just note that in Simula - which has Algol 60 as [small] subset -
    the couple books I have also speak about "passing" parameters,
    or speak about associating actual parameters to the formal ones;
    depending on what abstraction level they formulate.


    The "call by name" semantics turned out to be more complicated
    than expected,

    It's also inefficient (and it shows some IMO undesired effects).

    and as far as I can tell was never adopted by any
    language other than Algol 60.

    Yes; Simula inherited that mechanism; it has 'value', 'name' (and
    also, for objects of class T types, 'ref(T)').

    Janis

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Janis Papanagnou@21:1/5 to Keith Thompson on Sat Sep 28 06:43:58 2024
    On 27.09.2024 23:03, Keith Thompson wrote:
    [...]

    I don't know whether the idea of "calling" parameters originated in
    the Algol 60 report, or whether it was just common usage at the time. Studying the early documentation for languages like Fortran, Cobol,
    and perhaps PL/I might be illuminating, but I have not (yet) done so.

    Concerning this I stumbled across an (a bit vague) comment in a
    book from F.L.Bauer (CS pioneer and member of the Algol committee)
    and H.W�ssner (from 1984)...

    "[...] Insbesondere die Nichtunterscheidung von Eingabe- und Resultatparametern, einer der sch�dlichen Ausfl�sse von FORTRAN,
    machte als Ersatz die eigenartigen Parameter�bergabemechanismen
    ('call by value', 'call by name', 'call by reference') erforderlich.
    [...]"

    "[...] In particular, the failure to distinguish between input
    and result parameters, one of the harmful effects[*] of FORTRAN,
    made as replacement the strange parameter passing mechanisms
    ('call by value', 'call by name', 'call by reference') necessary.
    [...]"

    Unfortunately it doesn't say what exactly it was (in FORTRAN) that
    lead to the decisions for the parameter passing mechanisms and its
    naming. Non-existing mechanisms [in FORTRAN] wouldn't quite explain
    why they haven't done a better job in Algol 60. (Details are still
    unclear to me.)

    Janis

    [*] Not sure about the best word for "Ausfl�sse"; maybe effluences
    fits better?

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)