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

Re: Can a functional language be sequential?



At 12:53 PM -0400 6/2/03, Michael St . Hippolyte wrote:
>On 2003.06.01 17:13 andrew cooke wrote:
>>
>>as far as i can tell, your programs do have side effects, just as many
>>functional programs have side effects - they change the state of the
>>"world" by doing output operations.  since the order of output is
>>generally important, functional languages need to sequence events just
>>as much as imperative ones.  (ok, i know you probably meant side
>>effects within the program).
>
>Yes, Bento connects very easily to the outside world, and once you do
>side effects are unavoidable.  This would be true of any functional
>language capable of calling external methods, no?  I'm assuming that
>such real-world exceptions are accepted by real-world functional
>programmers -- it would be hard to do many useful things otherwise.

It might be interesting to have a way to mark individual functions as 
having side-effects or not, with upward propagation of that mark, so 
the compiler and/or runtime would be able to tell which parts of the 
program are order-free and which parts need to maintain ordering. 
While it doesn't touch directly on your problem, having this 
information handy at runtime would give the execution engine more 
information about what has to be done in what order, which may give 
you some potential wins for optimization.
-- 
                                         Dan

--------------------------------------"it's like this"-------------------
Dan Sugalski                          even samurai
dan@sidhe.org                         have teddy bears and even
                                       teddy bears get drunk