Article View: comp.lang.misc
Article #324Re: side effects
From: Andy Turk
Date: Mon, 24 Jul 1989 21:22
Date: Mon, 24 Jul 1989 21:22
52 lines
2835 bytes
2835 bytes
In article <MYltLT200VsiM0U3Yx@andrew.cmu.edu>, gb17+@andrew.cmu.edu (George Thomas Baggott) writes:
> Is there some way to have a language with no side effects, yet still be
> able to solve this class of problems in a practical way? If not what is
> the minimum amount of comprimise that must be made?
>
> George
It would be really nice to be able to write programs that obey some
reasonable set of semantics and are efficient to boot. Unfortunately,
this doesn't happen very often.
#define SOAPBOX
This happens because when a language is designed with a semantics in
mind, the semantics usually caters to the mathematician rather than
the machine. Things that are easy for the mathematician (e.g., sets,
closures, and mappings) are very difficult for the idiot savants we
call computers. That's why it's easy to write a declarative
description of a dictionary that runs really S L O W. If only
programs ran at the Speed of Mathematics (tm).
One possible solution is to build new machines that are designed to
work well with our current notions of semantics. Many strange and
wonderful architectures have resulted from this kind of exploration.
However, they seem to be very specific in the types of problems that
they solve.
A better idea is to work on the mathematical end of things so we can
design efficient Von Neuman type languages that have a strong semantic
foundation.
#undefine SOAPBOX
As far as the dictionary example is concerned, you always want to
modify (rather than copy) the state of the dictionary when you can do
so without breaking the semantics of the program.
If there is just one reference to the dictionary during the execution
of your program, then it's ok to modify it. If there is more than one
reference, then you need to copy it. (If there are no references,
then get rid of it).
If your program were written in the Most Perfect Language (MPL), then
you should be able to combine the semantics of MPL with the semantics
of your program to determine which implementation of dictionary_add()
is best.
-------------------------------------------------------------------------------
Andrew K. Turk
visix!andyt@uunet.uu.net
"I don't know what happened to my face." -- Dizzy Gillespie
-------------------------------------------------------------------------------
Technical Details
Message-ID:
<212@visix.UUCP>Path:
arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!iuvax!cica!ctrsol!ginosko!uunet!visix!andytReferences:
<MYltLT200VsiM0U3Yx@andrew.cmu.edu>Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!iuvax!cica!ctrsol!ginosko!uunet!visix!andyt From: andyt@visix.UUCP (Andy Turk) Newsgroups: comp.lang.misc Subject: Re: side effects Summary: Declarative Languages & Changes in State Message-ID: <212@visix.UUCP> Date: 24 Jul 89 21:22:22 GMT References: <MYltLT200VsiM0U3Yx@andrew.cmu.edu> Organization: Visix Software, Arlington, Virginia Lines: 52