SRFI 235 review Wolfgang Corcoran-Mathe (03 Sep 2022 13:51 UTC)
Re: SRFI 235 review Marc Nieper-Wißkirchen (03 Sep 2022 16:45 UTC)
Re: SRFI 235 review John Cowan (03 Sep 2022 17:21 UTC)
Re: SRFI 235 review Marc Nieper-Wißkirchen (03 Sep 2022 18:18 UTC)
Re: SRFI 235 review Wolfgang Corcoran-Mathe (04 Sep 2022 20:06 UTC)
Re: SRFI 235 review Marc Nieper-Wißkirchen (05 Sep 2022 06:31 UTC)
Re: SRFI 235 review John Cowan (05 Sep 2022 16:44 UTC)
Re: SRFI 235 review Marc Nieper-Wißkirchen (05 Sep 2022 17:58 UTC)
Re: SRFI 235 review John Cowan (05 Sep 2022 23:45 UTC)
Re: SRFI 235 review Marc Nieper-Wißkirchen (06 Sep 2022 06:27 UTC)
Re: SRFI 235 review Wolfgang Corcoran-Mathe (06 Sep 2022 19:46 UTC)
Re: SRFI 235 review Marc Nieper-Wißkirchen (06 Sep 2022 21:39 UTC)
Re: SRFI 235 review John Cowan (07 Sep 2022 01:46 UTC)
Re: SRFI 235 review Per Bothner (07 Sep 2022 05:04 UTC)
Re: SRFI 235 review John Cowan (07 Sep 2022 18:37 UTC)
Re: SRFI 235 review Per Bothner (07 Sep 2022 22:23 UTC)
Re: SRFI 235 review John Cowan (07 Sep 2022 23:29 UTC)
Re: SRFI 235 review Marc Nieper-Wißkirchen (09 Sep 2022 09:25 UTC)
Re: SRFI 235 review John Cowan (09 Sep 2022 19:54 UTC)
Re: SRFI 235 review Marc Nieper-Wißkirchen (09 Sep 2022 20:11 UTC)
Re: SRFI 235 review Marc Nieper-Wißkirchen (07 Sep 2022 06:29 UTC)
Re: SRFI 235 review Wolfgang Corcoran-Mathe (07 Sep 2022 18:02 UTC)
Re: SRFI 235 review Marc Nieper-Wißkirchen (07 Sep 2022 20:10 UTC)
Re: SRFI 235 review Lassi Kortela (07 Sep 2022 18:41 UTC)
Re: SRFI 235 review John Cowan (03 Sep 2022 17:17 UTC)
Re: SRFI 235 review Arvydas Silanskas (04 Sep 2022 08:35 UTC)

Re: SRFI 235 review Per Bothner 07 Sep 2022 22:23 UTC


On 9/7/22 11:37, John Cowan wrote:
>
>
> On Wed, Sep 7, 2022 at 1:04 AM Per Bothner <xxxxxx@bothner.com <mailto:xxxxxx@bothner.com>> wrote:
>
>     I haven't really been following the discussions, but I want to point out that
>     Kawa has implicit forcing for both (delay ...) and (future ...).
>     (display ...) does an implicit force; (write ...) does not.
>
>
> Good point; there should have been some discussion of the ad-hoc polymorphic procedures for I/O.  But do all other ad-hoc polymorphic procedures force their arguments, like + or `string-set!`?

Most do. `list` doesn't but it may not count as "ad-hoc polymorphic":

#|kawa:4|# (write (+ (delay 3) (future 12)))
15
#|kawa:5|# (write (list (delay 3) (future 12)))
(#<promise - not forced yet> #<future Thread-4>)

My hope is that promises with implicit forcing provides a useful
model for functional progarmming with lazy evaluation - but
with lazy having to be explict and eager the default, in contrast
to (say) Haskell.

This interacts with type-checking:
The type 'integer' refers to an actual forced value.
(This makes it easier to generate effecient code than if we have to
check for laziness.)
The type 'lazy[integer]' refers to a possibly-lazy value
which when forced is an integer.
You can freely convert between the two, but converting a
lazy[integer] to integer does a force if needed.

#|kawa:1|# (define (list2-lazy x::promise[integer]) (list x x))
#|kawa:2|# (write (list2-lazy (delay 34)))
(#<promise - not forced yet> #<promise - not forced yet>)
#|kawa:3|# (define (list2-eager x::integer) (list x x))
#|kawa:4|# (write (list2-eager (delay 34)))
(34 34)

There are probably some bugs and other issues in how Kawa handles
promises (because of limited use and testing), and also partly because how
the JVM handles parameterized types.  (You can't at runtime check if an
object is a Promise[integer] or a Promize[string].)
However, I do think this is an under-explored design space.

https://www.gnu.org/software/kawa/Lazy-evaluation.html
--
	--Per Bothner
xxxxxx@bothner.com   http://per.bothner.com/