[Prev][Next][Index][Thread]

Re: Is Dylan a functional language?



On Tue, 9 Oct 2001, Bruce Hoult wrote:
> In article <3BC2532B.5030707@staffware-spokane.com>, Doug Hockin
> <dhockin@staffware-spokane.com> wrote:
>
> > Should Dylan show up in this list of functional languages?
> >
> > http://dmoz.org/Computers/Programming/Languages/Functional/

What is a "functional language"? To me, it has less to do with being
side-effect free than with providing "first class" functions. I would
also add block structure and lexical scope as criteria to really be a
functional language. Does Dylan have first class functions, block
structure, and lexical scope? Yes, so I'd put it in there without
hesitation.

> If Common Lisp and Scheme and OCaml are there (which they are) then
> Dylan certainly should be too.

I'm mostly an OCaml programmer these days, and I'd agree OCaml is
(not just) a functional programming language, as is Dylan.

I'd have a much tougher time saying Java is an FPL. C sort of has first
class functions, but since it's flat they're really trivial. Ditto
for C++. Pascal is part of the way there, since it has downward funargs,
but has to be rejected since there aren't function values. Same with Ada
83. Ada 95 adds functional values but puts C like restrictions on them
(the accessibility rules) so it's out too.

> Like them Dylan has all the features needed to be used in a purely
> functional style, but doesn't force you into programming that way.

A more interesting question IMO is to what extent a functional style is
used in common Dylan programming. My OCaml style is largely functional
but there is almost *always* some bit of imperative code, and the use of
exceptions (which some people, not me, consider non-functional).

-- Brian





Follow-Ups: References: