basic language question
Michael Peuser
mpeuser at web.de
Thu Sep 4 16:27:36 EDT 2003
"John Roth" <newsgroups at jhrothjr.com>
> "Michael Peuser" <mpeuser at web.de>
> > There is a very old religious law saying: Thou shalt not cause side
>> effects by a function.
> > There is some wisdom in it but it is easily forgotten with languages
which
> > do not differ between functions and routines.
>
> Like most "religious laws," it's a rule that has a multitude of
exceptions.
> You can't do I/O without having side effects, something that the designers
> of functional languages have learned, sometimes the hard way.
Stream I/O can never be done right in functional languages. The only
solution is to use something like memory mapped files (which I do more and
more ...)
But look at this mess:
twolines=f.readline()+f.readline()
There are solutions in some languages with _routines_ and
_call-by-reference_ but it it is generally very clumpy.
On the other there is a growing popularity of generators and iterators which
by concept are *heretic*
Kindly
Michael P
More information about the Python-list
mailing list