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-Language: ENGLISH,ASCII X-Google-Thread: 107f24,626a0a064b320310 X-Google-Attributes: gid107f24,public X-Google-Thread: f4fd2,626a0a064b320310 X-Google-Attributes: gidf4fd2,public X-Google-Thread: 10259a,626a0a064b320310 X-Google-Attributes: gid10259a,public X-Google-Thread: 103d24,626a0a064b320310 X-Google-Attributes: gid103d24,public X-Google-Thread: 1164ba,626a0a064b320310 X-Google-Attributes: gid1164ba,public X-Google-Thread: 114809,626a0a064b320310 X-Google-Attributes: gid114809,public X-Google-Thread: 103376,ea8ea502d35ca2ce X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2001-05-16 14:10:09 PST Path: archiver1.sj.google.com!newsfeed.google.com!sn-xit-03!supernews.com!logbridge.uoregon.edu!arclight.uoregon.edu!news.tufts.edu!uunet!dca.uu.net!ash.uu.net!nntphub.cb.lucent.com!news.research.bell-labs.com!news From: Matthias Blume Newsgroups: comp.lang.ada,comp.lang.lisp,comp.lang.smalltalk,comp.lang.basic,comp.lang.functional,comp.lang.scheme,comp.lang.perl Subject: Re: Beginner's Language? Date: Wed, 16 May 2001 16:49:39 -0400 Organization: Lucent Technologies, Bell Labs Message-ID: <3B02E7E3.D3640D53@research.bell-labs.com> References: <9cukad$nn68@news-dxb> <9d6b6e$1bt$1@nh.pace.co.uk> <87snihxiwc.fsf@frown.here> <9dbi83$sji$1@nh.pace.co.uk> <87heyu7cqd.fsf@frown.here> <9dc20p$hh15e$1@ID-37382.news.dfncis.de> <3B003CA2.D24D083C@research.bell-labs.com> <3b02a7d0$1@news.microsoft.com> NNTP-Posting-Host: blume-pcmh.research.bell-labs.com Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit X-Mailer: Mozilla 4.75 [en] (X11; U; Linux 2.2.16-3 i686) X-Accept-Language: en, de, ja Xref: archiver1.sj.google.com comp.lang.ada:7592 comp.lang.lisp:10176 comp.lang.smalltalk:9735 comp.lang.functional:5679 comp.lang.scheme:3855 comp.lang.perl:2785 Date: 2001-05-16T16:49:39-04:00 List-Id: "J�rgen Exner" wrote: > > "Matthias Blume" wrote in message > news:3B003CA2.D24D083C@research.bell-labs.com... > > false and (in some sense) true > > (Functions _are_ first-class objects in C; and you cannot do _elegant_ > functional > > programming in C.) > > Sorry, that's not correct. > In C the only first-class objects are byte, chars, ints, doubles, ..., and > pointers. These are the only objects you can use > - as elements of a complex data structure (array, record or however you > want to call it) > - return value of a function/procedure > > Second class objects in C are e.g. strings, arrays, and functions/procedures A agree about the arrays, C does not have strings so the comment about them is pointless, and I DO NOT agree about functions. In C functions are function pointers, and they are completely first-class because they can be used "as elements of a complex data structure (array, record or however you want to call it)" and they can be the "return value of a function/procedure". > Of course, because C is so low-level, you can simulate functional > programming by using pointers to functions Functions and pointers to functions are the same in C. There is some slight syntactic confusion about that because of some apparent differences between f and (*f). But the difference is not really there. If you think about every function expression F as a pointer to the function, you get the right interpretation. In other words, there are no functions in C beyond function pointers. Matthias