Related articles |
---|
Reference to "First-Class Data Type" reid@vtopus.cs.vt.edu (1992-02-18) |
re: First-class data types lotus!wildbill@uunet.uu.net (1992-03-05) |
Re: First-class data types norman@a.cs.okstate.edu (1992-03-05) |
Re: First-class data types rockwell@socrates.umd.edu (Raul Deluth Miller-Rockwell) (1992-03-06) |
Re: First-class data types pk@cs.tut.fi (1992-03-06) |
Re: First-class data types kend@data.rain.com (1992-03-05) |
Re: First-class data types tmb@ai.mit.edu (1992-03-09) |
Re: First-class data types norman@a.cs.okstate.edu (Norman P. Graham) (1992-03-11) |
Newsgroups: | comp.compilers |
From: | Raul Deluth Miller-Rockwell <rockwell@socrates.umd.edu> |
Keywords: | types |
Organization: | Compilers Central |
References: | 92-02-085 92-03-024 |
Date: | Fri, 6 Mar 1992 05:53:20 GMT |
Bill Torcaso:
There is a nit to pick with the definition of 'first class
datatype' that asserts any operation can be applied to any object
of any first class datatype. Consider a language in which functions
are first-class:
Is that supposed to be a statement about the domain of every function
in the language? [e.g. that the empty function, which has no domain,
is not a proper member of the language?] If so that statement strikes
me as suspicious.
What is the XOR of two functions? What is the AND of two
functions?
let h = f XOR g where f and g are functions.
then h(x) is f(x) XOR g(x)
Similarly for AND.
What is the function-invocation of the integer constant 17? Of
the floating-point constant 0.5?
let h = the function 17
then h(x) is 17
Similarly for 0.5
Any language that admits arithmetic types and arithmetic operations
will have a hard time supporting first-class types. And of course,
once you subset the domain of datatypes and the operators that
apply in each sub-domain, the definition loses all generality.
This assertion may be true, but the above cases are easily resolvable.
[For people who aren't aware of this yet: both of the above features
are available, albeit with slightly different syntax, in the language
J. But so far J's just an interpreted language.]
--
Raul Deluth Miller-Rockwell <rockwell@socrates.umd.edu>
--
Return to the
comp.compilers page.
Search the
comp.compilers archives again.