Re: Recursion, Yo

Liste des GroupesRevenir à cl c  
Sujet : Re: Recursion, Yo
De : david.brown (at) *nospam* hesbynett.no (David Brown)
Groupes : comp.lang.c
Date : 13. Apr 2024, 20:04:14
Autres entêtes
Organisation : A noiseless patient Spider
Message-ID : <uveheu$34hm7$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
User-Agent : Mozilla Thunderbird
On 13/04/2024 19:17, Janis Papanagnou wrote:
On 12.04.2024 16:51, David Brown wrote:
On 12/04/2024 15:03, Janis Papanagnou wrote:
>
Another one is that you can write (e.g. in Algol 68 or many other
higher level languages) the equivalent of - again a simple example -
>
    int x = 2 * pi * r
>
without necessity to know whether pi is a constant, the result of a
function (calculation), the result of a function implicitly called
just once on demand, or whatever else. Conceptually as a programming
language user you want the value.
>
>
But is that a good thing?
 In my book it is a good thing (but I wouldn't overestimate it)...
 
For some programming, especially with
higher-level languages, then it is fine.  For other types of
programming, you want to know if functions are called in order to have a
better idea of the flow of control and the efficiency of the code, plus
perhaps thread safety.
 ...because the (in practice valid!) topics you mention _should_ not
be of concern to the programmer. The "idea of the flow" should, IMO,
certainly not depend on parenthesis. I'll try an example from a C++
context... - Say, I want to get the "length" of a container. What I
indeed care about is the complexity of that operation, but that
should be part of the library specification. C++/STL provides me
with O(1), O(N), O(x) information that I can count on. Though the
procedure to determine some length() might depend on the type of
the container; it may be just an attribute access, it might be a
difference computation (last-first+1), or it might be an iteration.
Despite that could be hidden in a function length() you need the
O(x) information to be sure about efficiency. (Or to look into the
function's source code of the function, if available, to analyze
the algorithm.)
 
For most C++ programming, if you read code :
int len = xs.length;
you'll assume that is O(1).  But if you read :
int len = xs.length();
you won't make that assumption.  If you need to know the complexity, you'll check exactly what type of container "xs" is, and look up the complexity guarantees.  (And while I showed a way to make calls in C++ without parentheses, I am not suggesting it's a good idea to invalidate the assumptions readers will typically make about code.)
Again, this stuff is often not important, or at least not critical - but sometimes it is.

What I'm basically trying to say is that length() doesn't provide
the certainty or information that one needs or likes to have. All
it provides is a syntactical, technical detail of the language.
With it you get the uncertainty of "Uh-oh, there's parentheses;
now does it mean that it's expensive to use it?" - But you don't
get relevant information from the parentheses!
 
Agreed.  But it will often lead to assumptions.
However, those assumptions are based on the language.  People who are used to Pascal or Ada would have other assumptions (or lack of assumptions) when reading Pascal or Ada.

For the [general, non-C] programmer it's (IMO) clearer to not put
(unnecessary) syntactical burden on him. He wants a value 'len'?
He just gets the value 'len' (and not len())!
 I think I've already said that it's to a large degree probably
personal experience and preferences whether one comes to the
conclusion that it's a good thing, a bad thing, or even "mostly
harmless" (meaningless).
 (These are the thoughts from someone who did not start his CS life
with C-like languages. From someone who has seen a lot of languages
with good concepts that needed decades to only slowly - if at all -
find their way into the modern, mainstream, or hyped languages. I
thought that evolution in programming languages would benefit from
good concepts. But "Not Invented Here" principle seems to dominate.
<end-of-rant>)
I started with BASIC (a half dozen varieties), then assembly and machine code on multiple systems, brief flirtations with Logo, Forth, and even Prolog and APL (/very/ briefly for these), then Pascal, then university with Orwell (very similar to Haskell), Modula 2, C, Occam, then real life with Pascal, assembly (many types), C, C++, Python, some hardware design languages, and bits and pieces of a number of other languages for fun or profit.  It's nice to have a variety of experiences, even if the great majority of work is in only a few of these languages.

 
>
Just for fun, this is a way to let you define a function-like object
"pi" in C++ that is called automatically, without parentheses :
[...]
I am not giving an opinion as to whether or not this is a good idea (and
obviously it is completely redundant in the case of a compile-time
constant).  Some people might think C++ is great because it lets you use
tricks like this, some people might think C++ is terrible because it
lets you use tricks like this :-)
 (Nice example.) - Well, to me C++ is (or was) great because it
supported what I've learned to love from using Simula; classes
and inheritance, the whole OO paradigm, "living objects" and a
lot more that's still "undiscovered" by other languages. What I
found terrible was that it inherited the whole uncertainty from
using a low level language like C.
 
A lot of C++'s poorer parts are due to compatibility with C. Compatibility with C is of course useful in many ways too, but it has always been a millstone around C++'s neck.

Date Sujet#  Auteur
7 Apr 24 * Recursion, Yo102Lawrence D'Oliveiro
7 Apr 24 +* Re: Recursion, Yo100fir
9 Apr 24 i`* Re: Recursion, Yo99Janis Papanagnou
9 Apr 24 i +* Re: Recursion, Yo7Lawrence D'Oliveiro
9 Apr 24 i i+* Re: Recursion, Yo5Janis Papanagnou
9 Apr 24 i ii`* Re: Recursion, Yo4Ben Bacarisse
9 Apr 24 i ii `* Re: Recursion, Yo3Janis Papanagnou
9 Apr 24 i ii  `* Re: Recursion, Yo2Keith Thompson
10 Apr 24 i ii   `- Re: Recursion, Yo1Janis Papanagnou
9 Apr 24 i i`- Re: Recursion, Yo1bart
9 Apr 24 i `* Re: Recursion, Yo91Ben Bacarisse
9 Apr 24 i  +- Re: Recursion, Yo1Ben Bacarisse
10 Apr 24 i  `* Re: Recursion, Yo89Lawrence D'Oliveiro
10 Apr 24 i   +- Re: Recursion, Yo1Chris M. Thomasson
10 Apr 24 i   +* Re: Recursion, Yo86David Brown
10 Apr 24 i   i+* Re: Recursion, Yo84Lawrence D'Oliveiro
10 Apr 24 i   ii`* Re: Recursion, Yo83David Brown
10 Apr 24 i   ii +* Re: Recursion, Yo73bart
10 Apr 24 i   ii i+* Re: Recursion, Yo71David Brown
11 Apr 24 i   ii ii`* Re: Recursion, Yo70Lawrence D'Oliveiro
11 Apr 24 i   ii ii +* Re: Recursion, Yo4Kaz Kylheku
11 Apr 24 i   ii ii i`* Heh heh... (Was: Recursion, Yo)3Kenny McCormack
11 Apr 24 i   ii ii i `* Re: Heh heh... (Was: Recursion, Yo)2Kaz Kylheku
11 Apr 24 i   ii ii i  `- Re: Heh heh... (Was: Recursion, Yo)1Kenny McCormack
11 Apr 24 i   ii ii `* Re: Recursion, Yo65David Brown
11 Apr 24 i   ii ii  +* Re: Recursion, Yo62Kaz Kylheku
11 Apr 24 i   ii ii  i+- Re: Recursion, Yo1David Brown
12 Apr 24 i   ii ii  i`* Re: Recursion, Yo60Lawrence D'Oliveiro
12 Apr 24 i   ii ii  i +* Re: Recursion, Yo2Kaz Kylheku
12 Apr 24 i   ii ii  i i`- Re: Recursion, Yo1Dan Cross
12 Apr 24 i   ii ii  i `* Re: Recursion, Yo57Janis Papanagnou
12 Apr 24 i   ii ii  i  +* Re: Recursion, Yo6David Brown
12 Apr 24 i   ii ii  i  i`* Re: Recursion, Yo5Janis Papanagnou
12 Apr 24 i   ii ii  i  i +* Re: Recursion, Yo3David Brown
13 Apr 24 i   ii ii  i  i i`* Re: Recursion, Yo2Janis Papanagnou
13 Apr 24 i   ii ii  i  i i `- Re: Recursion, Yo1David Brown
13 Apr 24 i   ii ii  i  i `- Re: Recursion, Yo1Lawrence D'Oliveiro
12 Apr 24 i   ii ii  i  +* Re: Recursion, Yo45Lawrence D'Oliveiro
12 Apr 24 i   ii ii  i  i`* Re: Recursion, Yo44Janis Papanagnou
12 Apr 24 i   ii ii  i  i +- Re: Recursion, Yo1bart
13 Apr 24 i   ii ii  i  i `* Re: Recursion, Yo42Lawrence D'Oliveiro
13 Apr 24 i   ii ii  i  i  +* Re: Recursion, Yo14Michael S
14 Apr 24 i   ii ii  i  i  i+* Re: Recursion, Yo11Ben Bacarisse
14 Apr 24 i   ii ii  i  i  ii`* Re: Recursion, Yo10Michael S
15 Apr 24 i   ii ii  i  i  ii `* Re: Recursion, Yo9Janis Papanagnou
15 Apr 24 i   ii ii  i  i  ii  `* Re: Recursion, Yo8Keith Thompson
15 Apr 24 i   ii ii  i  i  ii   `* Re: Recursion, Yo7Ben Bacarisse
15 Apr 24 i   ii ii  i  i  ii    `* Re: Recursion, Yo6Keith Thompson
15 Apr 24 i   ii ii  i  i  ii     +* Re: Recursion, Yo2bart
15 Apr 24 i   ii ii  i  i  ii     i`- Re: Recursion, Yo1Ben Bacarisse
15 Apr 24 i   ii ii  i  i  ii     `* Re: Recursion, Yo3Janis Papanagnou
15 Apr 24 i   ii ii  i  i  ii      +- Re: Recursion, Yo1Janis Papanagnou
15 Apr 24 i   ii ii  i  i  ii      `- Re: Recursion, Yo1Keith Thompson
14 Apr 24 i   ii ii  i  i  i`* Re: Recursion, Yo2Lawrence D'Oliveiro
14 Apr 24 i   ii ii  i  i  i `- Re: Recursion, Yo1Keith Thompson
13 Apr 24 i   ii ii  i  i  `* Re: Recursion, Yo27Janis Papanagnou
14 Apr 24 i   ii ii  i  i   `* Re: Recursion, Yo26Lawrence D'Oliveiro
14 Apr 24 i   ii ii  i  i    `* Re: Recursion, Yo25Ben Bacarisse
14 Apr 24 i   ii ii  i  i     +* Re: Recursion, Yo2bart
14 Apr 24 i   ii ii  i  i     i`- Re: Recursion, Yo1Ben Bacarisse
15 Apr 24 i   ii ii  i  i     `* Re: Recursion, Yo22Lawrence D'Oliveiro
15 Apr 24 i   ii ii  i  i      +* Re: Recursion, Yo20Chris M. Thomasson
15 Apr 24 i   ii ii  i  i      i+* Re: Recursion, Yo5Ben Bacarisse
16 Apr 24 i   ii ii  i  i      ii`* Re: Recursion, Yo4Lawrence D'Oliveiro
17 Apr 24 i   ii ii  i  i      ii `* Re: Recursion, Yo3Ben Bacarisse
18 Apr 24 i   ii ii  i  i      ii  `* Re: Recursion, Yo2Lawrence D'Oliveiro
22 Apr 24 i   ii ii  i  i      ii   `- Re: Recursion, Yo1Janis Papanagnou
15 Apr 24 i   ii ii  i  i      i`* Re: Recursion, Yo14Janis Papanagnou
16 Apr 24 i   ii ii  i  i      i +* Re: Recursion, Yo2Lawrence D'Oliveiro
22 Apr 24 i   ii ii  i  i      i i`- Re: Recursion, Yo1Janis Papanagnou
16 Apr 24 i   ii ii  i  i      i `* Re: Recursion, Yo11Michael S
19 Apr 24 i   ii ii  i  i      i  +* Re: Recursion, Yo9Tim Rentsch
19 Apr 24 i   ii ii  i  i      i  i+* Re: Recursion, Yo4bart
20 Apr 24 i   ii ii  i  i      i  ii`* Re: Recursion, Yo3Ben Bacarisse
20 Apr 24 i   ii ii  i  i      i  ii +- Re: Recursion, Yo1Keith Thompson
20 Apr 24 i   ii ii  i  i      i  ii `- Re: Recursion, Yo1Kaz Kylheku
19 Apr 24 i   ii ii  i  i      i  i+- Re: Recursion, Yo1Keith Thompson
19 Apr 24 i   ii ii  i  i      i  i+* Re: Recursion, Yo2Keith Thompson
20 Apr 24 i   ii ii  i  i      i  ii`- Re: Recursion, Yo1Tim Rentsch
20 Apr 24 i   ii ii  i  i      i  i`- Re: Recursion, Yo1Tim Rentsch
22 Apr 24 i   ii ii  i  i      i  `- Re: Recursion, Yo1Janis Papanagnou
15 Apr 24 i   ii ii  i  i      `- Re: Recursion, Yo1Ben Bacarisse
12 Apr 24 i   ii ii  i  +* Re: Recursion, Yo4bart
12 Apr 24 i   ii ii  i  i+* Re: Recursion, Yo2Janis Papanagnou
12 Apr 24 i   ii ii  i  ii`- Re: Recursion, Yo1bart
13 Apr 24 i   ii ii  i  i`- Re: Recursion, Yo1Keith Thompson
13 Apr 24 i   ii ii  i  `- Re: Recursion, Yo1Tim Rentsch
11 Apr 24 i   ii ii  `* Re: Recursion, Yo2Keith Thompson
12 Apr 24 i   ii ii   `- Re: Recursion, Yo1David Brown
14 Apr 24 i   ii i`- Re: Recursion, Yo1fir
10 Apr 24 i   ii +- Re: Recursion, Yo1Janis Papanagnou
10 Apr 24 i   ii +* Re: Recursion, Yo2Kaz Kylheku
10 Apr 24 i   ii i`- Re: Recursion, Yo1David Brown
11 Apr 24 i   ii +* Re: Recursion, Yo2Lawrence D'Oliveiro
12 Apr 24 i   ii i`- Re: Recursion, Yo1Ben Bacarisse
11 Apr 24 i   ii `* Re: Recursion, Yo4Lawrence D'Oliveiro
11 Apr 24 i   ii  +- Re: Recursion, Yo1Kaz Kylheku
11 Apr 24 i   ii  `* Re: Recursion, Yo2David Brown
11 Apr 24 i   ii   `- Re: Recursion, Yo1Lawrence D'Oliveiro
10 Apr 24 i   i`- Re: Recursion, Yo1Kaz Kylheku
10 Apr 24 i   `- Re: Recursion, Yo1Tim Rentsch
9 Apr 24 `- Re: Recursion, Yo1Lawrence D'Oliveiro

Haut de la page

Les messages affichés proviennent d'usenet.

NewsPortal