Re: excel-d v0.0.1 - D API to write functions callable from Excel
On Tuesday, 25 April 2017 at 22:21:33 UTC, Ali Çehreli wrote: Just by guessing, what we don't see here is that there is a wrapping layer that does the copying. Disposal logic is called by that layer. So, your scope(exit) takes place at a higher layer. Here is made-up-pseudo-code by me. :) TypeForExcel wrapper_actually_called_by_excel(/* ... */) { /* ... */ double[] ret_from_your_function = FuncReturnArrayNoGc(/* ... */); scope (exit) disposal_function(ret_from_your_function); TypeForExcel arg_to_excel = copy_for_excel(ret_from_your_function); return arg_to_excel; } That makes it more obvious. So it still is really like a scope(exit), just some other function is managing when that occurs.
Re: excel-d v0.0.1 - D API to write functions callable from Excel
On 04/25/2017 01:20 PM, jmh530 wrote: > On Monday, 24 April 2017 at 21:59:34 UTC, Atila Neves wrote: >> >> Enter the `@Dispose` UDA: >> > > I found this really interesting. > > Am I understanding the process correctly: apply map to numbers, allocate > and return a new array in D, copy it to Excel, call dispose to free the > D memory. Yes. > So if you instead used something like > scope(exit) Mallocator.instance.dispose(dArg); > then Excel wouldn't be able to use it because it would be freed by D > already? Correct. > It seems like your @Dispose UDA could have many uses outside of just the > excel-d package. If I understand correctly, it's similar to C++ smart > pointers, but not exactly the same. I'm still not sure I totally grok it > though. Just by guessing, what we don't see here is that there is a wrapping layer that does the copying. Disposal logic is called by that layer. So, your scope(exit) takes place at a higher layer. Here is made-up-pseudo-code by me. :) TypeForExcel wrapper_actually_called_by_excel(/* ... */) { /* ... */ double[] ret_from_your_function = FuncReturnArrayNoGc(/* ... */); scope (exit) disposal_function(ret_from_your_function); TypeForExcel arg_to_excel = copy_for_excel(ret_from_your_function); return arg_to_excel; } Ali
Re: excel-d v0.0.1 - D API to write functions callable from Excel
On Monday, 24 April 2017 at 21:59:34 UTC, Atila Neves wrote: Enter the `@Dispose` UDA: I found this really interesting. Am I understanding the process correctly: apply map to numbers, allocate and return a new array in D, copy it to Excel, call dispose to free the D memory. So if you instead used something like scope(exit) Mallocator.instance.dispose(dArg); then Excel wouldn't be able to use it because it would be freed by D already? It seems like your @Dispose UDA could have many uses outside of just the excel-d package. If I understand correctly, it's similar to C++ smart pointers, but not exactly the same. I'm still not sure I totally grok it though.
Re: Fastest JSON parser in the world is a D project
you could check it out on http://jsontuneup.com for treeview your json object and wrong inside your json.
Re: "Competitive Advantage with D" is one of the keynotes at C++Now 2017
On Tuesday, 11 April 2017 at 06:08:16 UTC, Ali Çehreli wrote: I have to say it took me a very long time to come up with the title and the abstract. How could I sell D to C++ experts? Luckily, I asked Manu and among a long list of ideas he said "it's about saving time" and "time is money". How can you argue with that? ;) I do agree, but C++ people may be less open to buy the whole package at once... The other speakers (Rust, Haskell) will talk about specific things that they regard as nicer in their languages compared to C++ (safe memory access, concurrency in Rust; side effect safety in Haskell). C++ users can more easily agree to these individual points and later become interested in the other languages. It's true that D's paradigm is less different from C++ and it's more about being better designed and safer as a whole. It's like, sure you can write 80% of D programs in C++ with only twice the typing at most, as long as your compiler supports C++14 at least, and you're super careful with memory... but you'll still be driven insane by the remaining 20% ;)
Re: "Competitive Advantage with D" is one of the keynotes at C++Now 2017
On Sunday, 23 April 2017 at 12:29:24 UTC, Guillaume Piolat wrote: On Sunday, 23 April 2017 at 12:04:08 UTC, Guillaume Piolat wrote: Hence Rust that sanctified this style. And why it's not that interesting to the modern C++ programmer. Actually, writing Rust made me realise how bad my C++ code actually is. Even with unique_ptr et al. Atila