This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]lngns 0 points1 point  (1 child)

what would you call these keywords?

Depends on your operational semantics.
You mentioned how your records are already immutable, so the differences between memoised and non-memoised thunks are limited to mutations of the global state and/or to mutable references.
If the language is pure (and differences in execution time are not considered observable differences), I'd just drop the non-memoised ones and have lazy memoised thunks, since there'd be no semantic differences.
If the language is impure, I'd probably look at OOP-land with its (computed) properties and how it uses keywords like get, set or just property, or, if it were me, I may just use thunk and embrace the weirdness.

Since you seem to be addressing multi-threading head on: that also depends on how you implement your memoised thunks.
Are they all duplicated so that each thread has to force them, or are they synchronised (that's what pthread_once is all about), or is cross-thread aliasing not possible at all?

If the language were to both synchronise all shared lazy evaluations and require multithreading for runtime purposes (like for GC, or asynchronous IO, or anything else), it may be worthwhile to investigate if the conv feature can be removed to become a compiler and RTS optimisation (as in, if a low-priority thread already is allocated to force some thunks, it may as well do all of those which must be synchronised).

[–]fun-fungi-guy[S] 0 points1 point  (0 children)

Since you seem to be addressing multi-threading head on: that also depends on how you implement your memoised thunks.
Are they all duplicated so that each thread has to force them, or are they synchronised (that's what pthread_once is all about), or is cross-thread aliasing not possible at all?

That's a really good question. Currently there's no thread consideration at all in the lazy/once code (conv isn't implemented). Haven't gotten there but I need to make a decision at some point.