Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

> Maybe it was Dave Long that pointed out that lerp is a generalization

iirc it was email among the three of us where I brought that up and pointed out that identities about Bézier splines looked pretty with infix lerp notation. (Blurry memory as usual, though.)

> to get the C/JS semantics, bool ? x succeeds with the value of x if bool is true, or fails if bool is false, and x : y succeeds with the value of x if x succeeds, but if x fails, does y.

There's a potential snag in that if x in (bool ? x) can fail then (true ? x : y) could run y. Of course this can be addressed...



Apologies! I didn't mean to steal your valor! My memory is pretty bad these days.

My intent with the split between the true/false world of values and the success/failure world was to avoid the situation where a false x would run y, but you're right that if bool ? x can fail (for example if x fails), we haven't really solved anything. And if a failing x doesn't cause bool ? x to fail, we have some other knotty problems: does it return a value, and if so, what? Doesn't that eliminate the possibility of using the failure construct as a model of exceptions? (Is that bad?)

It's fun to think about what semantics you'd need to decompose lerp into two such operations. Maybe (a/b) : (c/d) evaluates to (a+c)/(b+d), for example.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: