Fwd: [plt-scheme] imperative vs functional

From: Raoul Duke (raould at gmail.com)
Date: Wed Nov 5 19:13:51 EST 2008

>> the second version obliges methods to create a new object instance at
>> each call. so it's necessary to initialize each fields of this new
>> object... if it's a complex class, that does not seem very
>> effective...

i should think it depends on how "pure" the particular FP system is:
in schemes and lisps and o'caml iirc you can more easily directly
mutate state than in, say, haskell. so you could implement your OO
system as mutating state directly in many otherwise-labeled "FP"
systems.

in systems which don't let you do the mutation and require copying,
one could do some trickery under the covers a la Okasaki's purely
functional data structures.

sincerely.


Posted on the users mailing list.