This is the mail archive of the guile@sourceware.cygnus.com mailing list for the Guile project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: why undefined return values?


> > I can't see any design advantage in providing unspecified return values
> > and I expected to find a heated debate on this in some FAQ, but I didn't.
> > Scheme is said to be functional, but it looks rather procedureal, often
> > returning undefined or useless values, like C.

I can think of two reasons, various Scheme systems return various things
so when it came to writing a standard they could only please everybody by
not defining the return value. The other reason is the Scheme was pushed by
those folks interested in ``functional programming'' and they didn't want
anybody to do anything imperative so they put ! after various commands
(makes them look scary) and since that wasn't enough to stop people they
also wrote the standard to make those commands as useless as possible.

You can write your own (setq) if you want to using macros thingies,
I'm sure someone will explain it.

> Also, while Scheme is mostly functional, it also supports imperative
> programming, through set!, set-car! and set-cdr!.
> 
> It is a good idea to try to avoid these altogether.  It's likely that
> such operations won't be as efficient as purely functional code in
> future Scheme compilers and interpreters.

I've gotten a little wary of the claims for functional programming.
At the end of the day every language needs a namespace and every programmer
needs to modify that namespace -- what is this if not an imperative operation?
When functional programming works, there are a lot of niceties in the way it
works, but it never completely works. Which is not to suggest that we should
throw it out the window, just that being a purist is guaranteed to make you
worse off being pragmatic.

	- Tel

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]