Closed khoshroomahdi closed 4 years ago
it's a good question, but it's a caracteristic of most funcional languages, right? I find a question in stackoverflow here about that. But i did want know about that on Bosque
I think we need to separate how one expresses such things in an economical but straightforward manner. Then worry about how implementations can expedite operation by virtue of the supplied means of expression.
The question of syntax and language for this came up in #14. See https://github.com/Microsoft/BosqueLanguage/issues/14#issuecomment-489163033
As @khoshroomahdi remarks, there are difficulties with purely-functional approaches, although array/dictionary types help, along with techniques such as those in Chris Okasaki's book, Purely Functional Data Structures.
For me, the bugaboo is over-reliance on assignment and needing, instead, some efficient form of copying if immutability is to be kept as reliable as possible, including "efficient" access to interiors of large structured entities. Millions of records is very akin to a database system problem, not so much a programming-language problem.
Having read the various mission statements of sorts that Bosque has provided so far, it does seem to me that the focus is primarily on developer experience & complexity management over a deep focus on language performance.
With that said, there are potential solutions to the performance concerns. If I understand the runtime correctly, Bosque runs in Nodejs and is built on TypeScript. Being that TypeScript is an extension of JavaScript, other solutions from the JS community should be fairly applicable here as well.
For example, last I checked, ImmutableJS deals with large data structures by making a new instance of only the new/altered elements and leaving a link to the rest of the original data structure to "fill in" the rest.
This isn't necessarily the solution that Bosque wants, but I think it could help shine some light on creative solutions that other people working with a similar language have developed.
@NWCalvank I speculate that the use of node.js and TypeScript is more proof-of-concept than the ultimate intended platform/environment. I agree that some form of copy-on-write can be looked into, and the next performance case has to do with access to constituents, not just deep alterations.
I still contend that "millions of records" should not be an use case, no matter however appealing it is to express such a thing. The amortization of overhead is just too different, I suspect.
Merge with issue #103
As i know functional programming is slower than oop to update list with million records because they make a copy of list and then update that copy. How do you handle thus issue on bosque to improve performance?