Re: technology discussion → does the world need a "new" C ?

Liste des GroupesRevenir à l c 
Sujet : Re: technology discussion → does the world need a "new" C ?
De : bc (at) *nospam* freeuk.com (bart)
Groupes : comp.lang.c
Date : 11. Jul 2024, 11:04:13
Autres entêtes
Organisation : A noiseless patient Spider
Message-ID : <v6oamt$2d8nn$1@dont-email.me>
References : 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
User-Agent : Mozilla Thunderbird
On 11/07/2024 09:54, Michael S wrote:
On Thu, 11 Jul 2024 01:21:52 +0100
bart <bc@freeuk.com> wrote:
 
On 11/07/2024 00:01, Ben Bacarisse wrote:
bart <bc@freeuk.com> writes:
  
On 10/07/2024 14:32, Ben Bacarisse wrote:
>
I still consider arrays in C to be 'passed' by a
mechanism which is near-indistinguishable from actual
pass-by-reference.
>
I don't really care how you consider it, but I do care about how you
misrepresent the facts in public.
>
In another post you said that your language has pass by reference,
and we also know you have implemented C.  Either you are just very
confused and your language simply has call by value (after all, you
think C has pass by reference), or you know that pass by reference
in your language needs something from the implementation that was
not needed when you implemented C.  I can't decide if you are
confused or just lying.
>
>
The way it works in my language is very simple (this is what I do
after all):
>
      type T = int
>
      proc F(T x)=       # Pass by value
          println x.typestr
      end
>
      proc G(ref T x)=   # Manual pass-by-reference
          println x^.typestr
      end
>
      proc H(T &x)=      # Auto pass-by-reference
          println x.typestr
      end
>
      proc main=
          T a
>
          F(a)
          G(&a)
          H(a)
      end
>
I've written 3 functions using pass-by-value, pass-by-value emulating
pass-by-reference, and actual pass-by-reference.
>
The G function and the call to G show what the compiler has to add
when it processes function H: address-of ops and derefs. The cost is
a single & in the parameter list to get that convenience.
>
This programs works just the same if T was changed to an array:
>
      type T = [4]int
>
(The output is 3 lots of '[4]i64' instead of 3 lots of 'i64'; 'int'
is an alias for int64/i64.)
>
This is regular and orthogonal, a complete contrast to C even though
both languages supposedly operate at the same level.
>
The behaviour of F, when written in C, is like my F function when T
is an int (obviously the C won't have '.typestr').
>
But when T is an array, its behaviour is more like that of my H
function.
>
So, my remark about arrays in C being passed by reference is
understandable.
>
 No, it isn't.
If [in C] it was possible to pass arrays to functions, either by value
or by reference, then callee would know the length of passed array. As
it is, callee does not know it.

The length can be passed in a separate parameter, but then it does not
have to be the same as an original.
That's rather specious. In my language (probably in C too), most passed arrays are unbounded, allowing the same function to work with arrays of different sizes.
So that would need a separate Length parameter, even using by-reference.
In that regard, it's no different from the C: my array by-ref and C's alledged by-ref both cannot determine the array length solely from the parameter.
(In my language, attempts to get the length yields 0, which makes sense as the parameter's bounds are zero. In C, it will yield the size of the pointer.)
But when the array IS bounded, then in C:
   typedef byte vector[4];
   void F(vector a) {
       printf("%zu\n", sizeof(a));
       printf("%zu\n", sizeof(vector));
   }
The first printf shows 8 (the pointer size); the second shows 4 (the array size). So it /can/ access the bounds.
(For unbounded arrays, my language offers an alternative: slices, which contain their length. This is available whatever the calling mechanism.)

Date Sujet#  Auteur
9 Jul 24 * Re: technology discussion → does the world need a "new" C ?213David Brown
9 Jul 24 +* Re: technology discussion → does the world need a "new" C ?205bart
9 Jul 24 i+* Re: technology discussion → does the world need a "new" C ?202Ben Bacarisse
9 Jul 24 ii`* Re: technology discussion → does the world need a "new" C ?201bart
9 Jul 24 ii +* Re: technology discussion → does the world need a "new" C ?192Ben Bacarisse
9 Jul 24 ii i+* Re: technology discussion → does the world need a "new" C ?3BGB
10 Jul 24 ii ii`* Re: technology discussion → does the world need a "new" C ?2Ben Bacarisse
10 Jul 24 ii ii `- Re: technology discussion → does the world need a "new" C ?1BGB
9 Jul 24 ii i`* Re: technology discussion → does the world need a "new" C ?188bart
9 Jul 24 ii i +- Re: technology discussion → does the world need a "new" C ?1Tim Rentsch
10 Jul 24 ii i `* Re: technology discussion → does the world need a "new" C ?186Ben Bacarisse
10 Jul 24 ii i  `* Re: technology discussion → does the world need a "new" C ?185bart
10 Jul 24 ii i   `* Re: technology discussion → does the world need a "new" C ?184Ben Bacarisse
10 Jul 24 ii i    +- Re: technology discussion → does the world need a "new" C ?1Thiago Adams
10 Jul 24 ii i    +* Re: technology discussion → does the world need a "new" C ?175bart
10 Jul 24 ii i    i+- Re: technology discussion → does the world need a "new" C ?1Janis Papanagnou
10 Jul 24 ii i    i+* Re: technology discussion → does the world need a "new" C ?54Tim Rentsch
10 Jul 24 ii i    ii+* Re: technology discussion → does the world need a "new" C ?14Michael S
10 Jul 24 ii i    iii+* Re: technology discussion → does the world need a "new" C ?8David Brown
11 Jul 24 ii i    iiii`* Re: technology discussion → does the world need a "new" C ?7Michael S
11 Jul 24 ii i    iiii `* Re: technology discussion → does the world need a "new" C ?6Kaz Kylheku
11 Jul 24 ii i    iiii  `* Re: technology discussion → does the world need a "new" C ?5Michael S
11 Jul 24 ii i    iiii   +- Re: technology discussion → does the world need a "new" C ?1Kaz Kylheku
11 Jul 24 ii i    iiii   +- Re: technology discussion → does the world need a "new" C ?1bart
11 Jul 24 ii i    iiii   +- Re: technology discussion → does the world need a "new" C ?1David Brown
11 Jul 24 ii i    iiii   `- Re: technology discussion → does the world need a "new" C ?1Ben Bacarisse
10 Jul 24 ii i    iii+- Re: technology discussion → does the world need a "new" C ?1Kaz Kylheku
11 Jul 24 ii i    iii`* Re: technology discussion → does the world need a "new" C ?4Tim Rentsch
11 Jul 24 ii i    iii `* Re: technology discussion → does the world need a "new" C ?3BGB
11 Jul 24 ii i    iii  `* Re: technology discussion → does the world need a "new" C ?2Tim Rentsch
11 Jul 24 ii i    iii   `- Re: technology discussion → does the world need a "new" C ?1BGB
10 Jul 24 ii i    ii`* Re: technology discussion → does the world need a "new" C ?39bart
10 Jul 24 ii i    ii +* Re: technology discussion → does the world need a "new" C ?37Michael S
10 Jul 24 ii i    ii i+* Re: technology discussion → does the world need a "new" C ?34bart
11 Jul 24 ii i    ii ii+- Re: technology discussion → does the world need a "new" C ?1Michael S
11 Jul 24 ii i    ii ii`* Re: technology discussion → does the world need a "new" C ?32Tim Rentsch
11 Jul 24 ii i    ii ii `* Re: technology discussion → does the world need a "new" C ?31bart
11 Jul 24 ii i    ii ii  +* Re: technology discussion → does the world need a "new" C ?2Tim Rentsch
11 Jul 24 ii i    ii ii  i`- Re: technology discussion → does the world need a "new" C ?1bart
11 Jul 24 ii i    ii ii  `* Re: technology discussion → does the world need a "new" C ?28Keith Thompson
11 Jul 24 ii i    ii ii   `* Re: technology discussion → does the world need a "new" C ?27bart
11 Jul 24 ii i    ii ii    +* Re: technology discussion → does the world need a "new" C ?25Keith Thompson
11 Jul 24 ii i    ii ii    i+* Re: technology discussion → does the world need a "new" C ?15bart
12 Jul 24 ii i    ii ii    ii`* Re: technology discussion → does the world need a "new" C ?14David Brown
12 Jul 24 ii i    ii ii    ii +* Re: technology discussion → does the world need a "new" C ?12bart
12 Jul 24 ii i    ii ii    ii i+- Re: technology discussion → does the world need a "new" C ?1Janis Papanagnou
12 Jul 24 ii i    ii ii    ii i+* Re: technology discussion → does the world need a "new" C ?7David Brown
12 Jul 24 ii i    ii ii    ii ii`* Re: technology discussion → does the world need a "new" C ?6bart
12 Jul 24 ii i    ii ii    ii ii +* Re: technology discussion → does the world need a "new" C ?2bart
13 Jul 24 ii i    ii ii    ii ii i`- Re: technology discussion → does the world need a "new" C ?1David Brown
13 Jul 24 ii i    ii ii    ii ii `* Re: technology discussion → does the world need a "new" C ?3David Brown
17 Jul 24 ii i    ii ii    ii ii  `* Re: technology discussion → does the world need a "new" C ?2Bart
17 Jul 24 ii i    ii ii    ii ii   `- Re: technology discussion → does the world need a "new" C ?1David Brown
12 Jul 24 ii i    ii ii    ii i`* Re: technology discussion → does the world need a "new" C ?3Keith Thompson
12 Jul 24 ii i    ii ii    ii i `* Re: technology discussion → does the world need a "new" C ?2James Kuyper
12 Jul 24 ii i    ii ii    ii i  `- Re: technology discussion → does the world need a "new" C ?1bart
12 Jul 24 ii i    ii ii    ii `- Re: technology discussion → does the world need a "new" C ?1BGB
11 Jul 24 ii i    ii ii    i`* Re: technology discussion → does the world need a "new" C ?9bart
11 Jul 24 ii i    ii ii    i +- Re: technology discussion → does the world need a "new" C ?1Keith Thompson
12 Jul 24 ii i    ii ii    i +- Re: technology discussion → does the world need a "new" C ?1David Brown
12 Jul 24 ii i    ii ii    i `* Re: technology discussion → does the world need a "new" C ?6Janis Papanagnou
12 Jul 24 ii i    ii ii    i  `* Re: technology discussion → does the world need a "new" C ?5bart
13 Jul 24 ii i    ii ii    i   +* Re: technology discussion → does the world need a "new" C ?3Janis Papanagnou
13 Jul 24 ii i    ii ii    i   i`* Re: technology discussion → does the world need a "new" C ?2Keith Thompson
13 Jul 24 ii i    ii ii    i   i `- Re: technology discussion → does the world need a "new" C ?1Janis Papanagnou
14 Jul 24 ii i    ii ii    i   `- Re: technology discussion → does the world need a "new" C ?1Tim Rentsch
12 Jul 24 ii i    ii ii    `- Re: technology discussion → does the world need a "new" C ?1Thiago Adams
10 Jul 24 ii i    ii i+- Re: technology discussion → does the world need a "new" C ?1Keith Thompson
10 Jul 24 ii i    ii i`- Re: technology discussion → does the world need a "new" C ?1James Kuyper
11 Jul 24 ii i    ii `- Re: technology discussion → does the world need a "new" C ?1Tim Rentsch
10 Jul 24 ii i    i+* Re: technology discussion → does the world need a "new" C ?2James Kuyper
10 Jul 24 ii i    ii`- Re: technology discussion → does the world need a "new" C ?1bart
11 Jul 24 ii i    i`* Re: technology discussion → does the world need a "new" C ?117Ben Bacarisse
11 Jul 24 ii i    i `* Re: technology discussion → does the world need a "new" C ?116bart
11 Jul 24 ii i    i  +* Re: technology discussion → does the world need a "new" C ?2Ben Bacarisse
11 Jul 24 ii i    i  i`- Re: technology discussion → does the world need a "new" C ?1Keith Thompson
11 Jul 24 ii i    i  +* Re: technology discussion → does the world need a "new" C ?112Michael S
11 Jul 24 ii i    i  i`* Re: technology discussion → does the world need a "new" C ?111bart
11 Jul 24 ii i    i  i +- Re: technology discussion → does the world need a "new" C ?1Michael S
11 Jul 24 ii i    i  i `* Re: technology discussion → does the world need a "new" C ?109David Brown
11 Jul 24 ii i    i  i  `* Re: technology discussion → does the world need a "new" C ?108bart
11 Jul 24 ii i    i  i   `* Re: technology discussion → does the world need a "new" C ?107David Brown
11 Jul 24 ii i    i  i    `* Re: technology discussion → does the world need a "new" C ?106bart
11 Jul 24 ii i    i  i     +- Re: technology discussion → does the world need a "new" C ?1Keith Thompson
12 Jul 24 ii i    i  i     +* Re: technology discussion → does the world need a "new" C ?103David Brown
12 Jul 24 ii i    i  i     i`* Re: technology discussion → does the world need a "new" C ?102Janis Papanagnou
12 Jul 24 ii i    i  i     i +* Re: technology discussion → does the world need a "new" C ?29bart
12 Jul 24 ii i    i  i     i i+* Re: technology discussion → does the world need a "new" C ?23Kaz Kylheku
12 Jul 24 ii i    i  i     i ii`* Re: technology discussion → does the world need a "new" C ?22Keith Thompson
25 Aug 24 ii i    i  i     i ii +- Re: technology discussion ? does the world need a "new" C ?1dave thompson 2
2 Sep 24 ii i    i  i     i ii `* Re: technology discussion → does the world need a "new" C ?20Tim Rentsch
2 Sep 24 ii i    i  i     i ii  `* Re: technology discussion → does the world need a "new" C ?19Keith Thompson
2 Sep 24 ii i    i  i     i ii   `* Re: technology discussion → does the world need a "new" C ?18Ben Bacarisse
2 Sep 24 ii i    i  i     i ii    +* Re: technology discussion → does the world need a "new" C ?2Keith Thompson
8 Sep 24 ii i    i  i     i ii    i`- Re: technology discussion → does the world need a "new" C ?1Janis Papanagnou
16 Sep 24 ii i    i  i     i ii    `* Re: technology discussion → does the world need a "new" C ?15Tim Rentsch
16 Sep 24 ii i    i  i     i ii     +* Re: technology discussion → does the world need a "new" C ?13Keith Thompson
16 Sep 24 ii i    i  i     i ii     i+* Re: technology discussion → does the world need a "new" C ?4Janis Papanagnou
17 Sep 24 ii i    i  i     i ii     ii`* Re: technology discussion → does the world need a "new" C ?3Tim Rentsch
17 Sep 24 ii i    i  i     i ii     ii `* Re: technology discussion → does the world need a "new" C ?2Janis Papanagnou
17 Sep 24 ii i    i  i     i ii     ii  `- Re: technology discussion → does the world need a "new" C ?1Tim Rentsch
26 Sep 24 ii i    i  i     i ii     i`* Re: technology discussion → does the world need a "new" C ?8Tim Rentsch
16 Sep 24 ii i    i  i     i ii     `- Re: technology discussion → does the world need a "new" C ?1Ben Bacarisse
12 Jul 24 ii i    i  i     i i+- Re: technology discussion → does the world need a "new" C ?1Janis Papanagnou
12 Jul 24 ii i    i  i     i i`* Re: technology discussion → does the world need a "new" C ?4Keith Thompson
12 Jul 24 ii i    i  i     i +* Re: technology discussion → does the world need a "new" C ?2Kaz Kylheku
12 Jul 24 ii i    i  i     i `* Re: technology discussion → does the world need a "new" C ?70Michael S
12 Jul 24 ii i    i  i     `- Re: technology discussion → does the world need a "new" C ?1James Kuyper
11 Jul 24 ii i    i  `- Re: technology discussion → does the world need a "new" C ?1Tim Rentsch
10 Jul 24 ii i    `* Re: technology discussion → does the world need a "new" C ?7Janis Papanagnou
9 Jul 24 ii `* Re: technology discussion → does the world need a "new" C ?8Kaz Kylheku
9 Jul 24 i+- Re: technology discussion → does the world need a "new" C ?1David Brown
9 Jul 24 i`- Re: technology discussion → does the world need a "new" C ?1Keith Thompson
9 Jul 24 +- Re: technology discussion → does the world need a "new" C ?1Michael S
9 Jul 24 `* Re: technology discussion → does the world need a "new" C ?6BGB

Haut de la page

Les messages affichés proviennent d'usenet.

NewsPortal