dada-lang / dada

I speak only of myself since I do not wish to convince, I have no right to drag others into my river, I oblige no one to follow me and everybody practices his art in his own way.
https://dada-lang.org
Apache License 2.0
444 stars 28 forks source link

Question: thunk terminology #105

Open nikomatsakis opened 2 years ago

nikomatsakis commented 2 years ago

I decided to move away from the Rust term Future after hearing a number of people get confused about it. For one thing, the normal use of the term Future involves a parallel process, and in Rust that's not the case. I think that thunk is accurate enough, but not widely used and perhaps confusing (though kind of fun to say). I find myself not wanting to use it in error messages.

I am wondering if "suspended function" would be a better term? Or perhaps "suspension"? (I think Kotlin uses a similar term, actually, and perhaps even avoids the keyword await.)

The idea would be that when you call an async fn, it immediately suspends execution until it is awaited, and what you get back is a "suspended fn".

crlf0710 commented 2 years ago

Maybe something like "action" or "microtask"? Not sure how that sounds in English.

brson commented 2 years ago

I've always been unsure of what exactly "thunk" means. I haven't heard much confusion about the term future in Rust, but what about "promise"? It must be the most common word for this type of thing since js uses it, and it is not parallel.

brson commented 2 years ago

Though also if we assume dada users will often come from rust, there's something to be said for using rust terminology, just like with rust there was always a decision about whether to use established terms from languages like c++ and js.

nikomatsakis commented 2 years ago

I've heard confusion in talking to folks at AWS, caused I think by Java's terms. They pointed out that Rust's future is closer to Java's Callable. I may be over-rotating on this feedback. I do genuinely feel the term is a bit confusing -- promise is maybe better, yes. Hmm.