|
Home
>
1. intro
>
1.1 'what is' about Dylan
>
1.1.1 What is Dylan? A imperative, functional and OOP language
>
1.1.1.2 functional view
>
1.1.1.2.2 Should Dylan show up in this list of functional languages?
|
Previous
Next
|
|
|
|
|
|
Doug Hockin
|
|
|
Scott McKay
|
Well, it works for *me*. ;-)
A lot of my Dylan code is written in a purely functional style.
Dylan does not preclude doing this, and in fact, it is easy to do so.
However, purists could rightfully point out that Dylan does not *require* a
functional style. Me, I think it should be on the list, but I'm not a purist...
|
|
Bruce Hoult
|
If Common Lisp and Scheme and OCaml are there (which they are) then
Dylan certainly should be 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.
|
|
Brian Rogoff
|
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.
> 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).
|
|
|
Honestly, my Dylan code is more functional than my Ocaml code. This
is because I find it easier to write in a state-passing or monadic style in
Dylan than in Caml.
I find Dylan nicer for writing state-passing code because of a nasty
habit: I care about memory allocation. Dylan's multiple return values can
be stack allocated, whereas using a tuple won't be. Even though I
*know* that I shouldn't care, I do. :) The combination of generic functions
makes a modular monadic style almost ridiculously easy to do. I tend to
cheat a bit, and use macros to eliminate the overhead of a monadic
style, too.
|
|
|
|
|
|