[Haskell-cafe] Re: New slogan... (A long speculation)
ok at cs.otago.ac.nz
Wed Oct 10 18:05:10 EDT 2007
On 10 Oct 2007, at 12:49 pm, jerzy.karczmarczuk at info.unicaen.fr wrote:
> No, I am sorry, I know a little bit "R". This is not a functional
> There is some laziness (which looks a bit like macro-processing),
There is no macro processing in R (or S).
> The manual speaks about promises and about forcing them. But, at
> the same
> time we read that the call by value IS the protocol.
That is a misreading. Paragraph 2 of 4.3.3 says
The semantics of invoking a function in R argument are
But that is NOT to be read as "strict", but as contrasting with
"call-by-reference". The very next paragraph makes this clear:
R has a form of lazy evaluation of function arguments.
Arguments are not evaluated until needed. It is important
to realise that i some cases the argument will never be
A promise is forced when its value is needed.
"Promises" in R are part of the underlying implementation; they are
not (as in Scheme) a data type that the programmer can ever see or
deal with. They are, in fact, just the same as unevaluated arguments
> And the language is
> impure, with reassignments.
You were happy enough with Scheme. And you didn't say that there were
no *pure* lazy dynamically typed languages, only that there were no
lazy dynamically typed languages. If you think of R as a lazy and
somewhat purer Scheme with lots of number-crunching support and C-like
syntax, you won't go far wrong.
> I don't see how to make co-inductive
> constructions, infinite streams, etc. (Perhaps I didn't hard
I don't know what co-inductive constructions are.
At first sight it looks to be very easy to make infinite streams in R,
but it isn't, for an interesting reason. R doesn't evaluate function
*arguments*, but it does fully evaluate function *results*, so that
returning something that hasn't been fully evaluated requires you to
return a function. Fortunately, R is a higher order language (S isn't)
so any stream implementation in Scheme has a natural analogue in R.
Can we agree that the existence of R shows that a practically useful
programming language with dynamic typing and lazy argument evaluation
is possible, and that it isn't quite what you had in mind because it
evaluates function results in full?
More information about the Haskell-Cafe