azolotko
azolotko on Hacker News
Posted by
azolotko on Saturday March 16, 2024 @01:03PM
from the old.reddit.com dept.
You have a pretty narrow definition of a platform. Consider
https://en.m.wikipedia.org/wiki/Computing_platformYes, you are right, I didn't consider the checkcast instruction.
Yes, F# does not have this particular limitation, but has few of its own in different places. Most notably, it lacks HKT (arguably, because of CLR awareness of generics).
BTW, alternative approaches to stack-safe recursion do exist in Scala. For example, https://github.com/slamdata/matryoshka
I suppose you meant boxing/unboxing. If so, yes, that's necessary for primitive types. As for regular objects, no casts are needed.
Regarding TCO, that's a well known limitation of the current Scala compiler. Hardly a "horror story".
Let me assure you, there are plenty of platforms where F# is nowhere to be seen. Thus, "can run on any platform [I care about]", which is a different set for different people anyway. For example, F# does not run on JVM, does it?
JVM knows nothing about generics. What kind of casts are you talking about?
Trampolines are a common technique to implement tailcalls on platforms that don't support them natively. What are the horror stories then?
Why would you bother with F# or Scala when iOS has Swift?
AFAIK there was a Postgres extension that did something like that. But than it became deprecated and was eventualy removed.
In Datomic you can setup a function the transactor can call within a transaction. This function takes the current value of the database and other supplied arguments (e.g. $100 and -$50 from your example) and according to its logic produces and returns a list of "changes" the transactor should apply to the database. The function is pure in sense that it doesn't have any side effects, it just "expands" into new data. And of course this "expantion" and application of its results happens in the same transaction.