Related articles |
---|
Reference to "First-Class Data Type" reid@vtopus.cs.vt.edu (1992-02-18) |
Re: Reference to "First-Class Data Type" moss@cs.umass.edu (1992-02-19) |
Re: Reference to "First-Class Data Type" stachour@sctc.com (1992-02-20) |
Re: Reference to "First-Class Data Type" jwb@cepmax.ncsu.edu (1992-02-20) |
Re: Reference to "First-Class Data Type" mab@wdl39.wdl.loral.com (1992-02-20) |
Re: Reference to "First-Class Data Type" eric@tfs.COM (1992-02-22) |
Re: Reference to "First-Class Data Type" spot@CS.CMU.EDU (1992-02-24) |
Re: Reference to "First-Class Data Type" pardo@cs.washington.edu (1992-02-24) |
Re: Reference to "First-Class Data Type" glew@pdx007.intel.com (1992-02-25) |
[4 later articles] |
Newsgroups: | comp.compilers |
From: | stachour@sctc.com (Paul Stachour) |
Keywords: | types |
Organization: | SCTC |
References: | 92-02-085 92-02-090 |
Date: | Thu, 20 Feb 1992 11:50:03 GMT |
moss@cs.umass.edu writes:
>On 18 Feb 92 14:39:56 GMT, reid@vtopus.cs.vt.edu (Thomas F. Reid) said:
>> .. "First class datatype" ... Can someone give me the real definition and
>> possibly a reference to its origin?
>A first class type is one that can be manipulated in all ways permitted to
>any type in the language. For example, for procedures to be first class
>you must be able to store them in heap variables, pass them as arguments,
>etc.
I have also used the term "first class datatype" in my classes for over 10
years. I also have used it in the same sense as above, that is: "For a
datatype 'd' to be 'first-class', then all operations allowed on any
object of any type in the language must be allowed on all objects 'o' of
datatype 'd'."
I use this when teaching Ada, in pointing out that procedures are not
first-class in Ada, or C, but they are in PL/I. Indeed in PL/I, one can
declare an item of type "entry" (the PL/I term that encompasses both
procedures and functions), and then one can assign to it, pass it to a
subroutine, call it, etc. And in most implementations of PL/I, everything
works fine. [The exception is one well-known implementation of PL/I that
though an entry could be implemented by passing just the addesss of the
code-body of the procedure, they forgot that when you pass an internal
procedure that can be called recusively, and that has access to
semi-globals on the stack of its static parent, then you need to pass the
environment also, in order that said local procedure can access the
correct generation of the semi-globals.]
However, I can't tell you either where I first heard the term. Sorry.
--
Paul Stachour SCTC, 1210 West County Rd E, Suite 100
stachour@sctc.com Arden Hills, MN 55112-3739
[1]-(612) 482-7467
[I'd say that procedure pointers rather than procedures are first class
PL/I objects, just like they are in C. In other languages with 1st class
procedures, you can create procedures, not just pointers to them, at run
time. -John]
--
Return to the
comp.compilers page.
Search the
comp.compilers archives again.