Am Mi., 7. Sept. 2022 um 20:02 Uhr schrieb Wolfgang Corcoran-Mathe < [email protected]>:
> On 2022-09-07 08:28 +0200, Marc Nieper-Wißkirchen wrote: > > > On Tue, Sep 6, 2022 at 5:39 PM Marc Nieper-Wißkirchen < > [email protected]> wrote: > > > > > >> there cannot be an > > >> implementation, portable or not, on every Scheme implementation that > > >> is allowed by R7RS. (As I tried to explain earlier, even access to > > >> something like "%true-promise" would not help.) > > > > > > > > > I continue to find your explanation incomprehensible, but I'll add a > warning saying that on an unusual implementation of Scheme promises, it is > not possible to treat promises as thunks; however, no such implementations > are known. > > > > Wolfgang, have you understood my point? Maybe you can explain it > > differently and better. > > If I'm understanding correctly, the problem is that, by > the standard, promises don't form a type, and it may be nonsense > to try to detect them with 'promise?', just it would be nonsense > to try to define an 'isPromise' predicate in Haskell. Further, > the implementation may not be able to do any better because of > how it represents values/expressions ("there is no %true-promise"). > > So, for example, in an implicit-forcing implementation which > completely hides promises, the following would return 1, because > "everything is a promise": > > (lazy-or-procedure 1 2) > > But it should be a type error. This is the kind of problem that > we run into if we try to distinguish a type that "isn't there". > > Is this something like what you mean? > Exactly! Thanks. And (lazy-or-procedure (lambda () 'foo)) should return `foo` because its argument is a thunk to be evaluated and should return a procedure simultaneously because its argument is a promise of a procedure (in particular models of R7RS-small promises). > > In any case, I strongly suggest writing a SRFI dealing exclusively > > with lazy evaluation and combinators for promises instead of making > > SRFI 235 polymorphic. > > I think I agree. > > > I imagine that Wolfgang could be in the mood to write such a SRFI. > > It'll need research, but yes, I'd be willing to do that at some point. > That would be great! Thanks, Marc
