🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.lang.misc
Article #308

side effects

#308
From: George Thomas Baggott
Date: Fri, 21 Jul 1989 21:30
19 lines
1038 bytes
In a truly functional language (i.e. no side effects at all), a function
for altering a large data structure (adding an entry to a dictionary,
for example) would be written as:

	dictionary_add(dictionary, entry) returns dictionary;
	/* return a copy of dictionary with entry added to it */

This is very costly, however.  If side effects were allowed, you could
do it at a much smaller cost:

	dictionary_add(dictionary, entry);
	/* add entry to dictionary */

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
Technical Details
Message-ID: <MYltLT200VsiM0U3Yx@andrew.cmu.edu>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!tut.cis.ohio-state.edu!pt.cs.cmu.edu!andrew.cmu.edu!gb17+

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!tut.cis.ohio-state.edu!pt.cs.cmu.edu!andrew.cmu.edu!gb17+
From: gb17+@andrew.cmu.edu (George Thomas Baggott)
Newsgroups: comp.lang.misc
Subject: side effects
Message-ID: <MYltLT200VsiM0U3Yx@andrew.cmu.edu>
Date: 21 Jul 89 21:30:07 GMT
Organization: Carnegie Mellon, Pittsburgh, PA
Lines: 19