🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.lang.misc
Article #2555

Re: Complexity of syntax

#2555
From: Lennart Augustsson
Date: Sat, 29 Dec 1990 10:12
35 lines
2512 bytes
In article <304@coatimundi.cs.arizona.edu> gudeman@cs.arizona.edu (David Gudeman) writes:
>In article  <1990Dec19.222059.6878@mathrt0.math.chalmers.se> Lennart Augustsson writes:
>]>
>]C does not have functions as first class data, you can only use functions
>]pointers as data.  To see the difference just try to write a function
>]that does function composition.
>
>C does not let you construct functions at run time (which makes the
>first-class functions rather anemic) but C does have first class
>functions by the usual definition of the term.  The term "first-class"
>just means that the type of object in question can be passed as an
>argument to procedures and returned from procedures as a result.  In
>procedural languages like C, it also means that you can assign the
>values to variables.  First-class does not imply any particular
>primitive operations on the objects (like construction), and the only
>operation that an object needs to make it a function is function
>application.
>
I was a bit sloppy in my posting since I did not make clear what I mean
by "first class".  There are several definitions, but the one I have in
mind is that for a type to be first class it should be possible to do the
same things with its objects as with objects of other types, such as
integers.  What this means depends on the language, but typical things would
be: send as an argument, return as a result, be expressible without giving it a
name (this a crucial point where C fails for functions, you can write 5 as it is
(i.e. you don't have to write "int five=5;"), but you cannot write an unnamed function),
read, write, etc.

C allows passing and returning, but not the others (well, C as such does not allow
reading/writing of integers either).  C also lacks first class structs (in my
definition of the term), because you cannot write unnamed struct values (you
can in GCC).

	-- Lennart Augustsson
[This signature is intentionally left blank.]
Technical Details
Message-ID: <1990Dec29.101233.1894@mathrt0.math.chalmers.se>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!swrinde!zaphod.mps.ohio-state.edu!rpi!uupsi!sunic!chalmers.se!mathrt0.math.chalmers.se!augustss
References: <304@coatimundi.cs.arizona.edu>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!swrinde!zaphod.mps.ohio-state.edu!rpi!uupsi!sunic!chalmers.se!mathrt0.math.chalmers.se!augustss
From: augustss@cs.chalmers.se (Lennart Augustsson)
Newsgroups: comp.lang.misc
Subject: Re: Complexity of syntax
Message-ID: <1990Dec29.101233.1894@mathrt0.math.chalmers.se>
Date: 29 Dec 90 10:12:33 GMT
References: <304@coatimundi.cs.arizona.edu>
Sender: news@mathrt0.math.chalmers.se (Evald Nyhetsson)
Organization: Dept. of CS, Chalmers, Sweden
Lines: 35