6 ms·
This is a great idea, but I have questions * Is there a process for upstreaming this into the mainline language, or is this essentially JaneStML now? * Why ch
by yafbum 3y ago
This is a great idea, but I have questions
* Is there a process for upstreaming this into the mainline language, or is this essentially JaneStML now?
* Why choose such an obscure word as `exclave` to indicate return-value optimization? How about `return local` or something similarly approachable?
- ReleaseCandidat 3y agoThey always had their own version of the compiler: https://github.com/ocaml-flambda/ocaml-jst/tree/main https://github.com/ocaml-flambda/ocaml-jst/tree/main Many of their changes have been ported to the 'official' OCaml compiler.
- HyperSane 3y agoUsing obscure works makes some people feel smart.
- malkia 3y agoExplain std::launder then - https://en.cppreference.com/w/cpp/utility/launder https://en.cppreference.com/w/cpp/utility/launder - it's simple word, mostly used when talking about dirty money ;) - but hey - I've still no idea how/when/why to use it... ;)
- saghm 3y agoUsing simple words in confusing contexts also makes people feel smart. Essentially any way of being technically correct in confusing ways has this effect; "I'm so much smarter that you can't even understand _why_ I'm right" is too juicy a flex for some people to avoid.
- malkia 3y agohttps://twitter.com/ciura_victor/status/1662536472342192128 https://twitter.com/ciura_victor/status/1662536472342192128 "Rinse and repeat That’s my std::launder joke " best answer I've got so far :)
- still_grokking 3y agoActually the word "launder" seems to be quite to the point given what this does. I'm not a C/C++ developer and I have to admit: For me reading anything about those languages is every time just mind-bending! (And I have a hard time not to use any curse words right now in addition). It took me over 20 minutes to understand (more or less) what this `std::launder()` does. The spec is just gibberish! So I've tried a BS generator a.k.a "AI" than[1]. Together with a Stackoverflow entry[2] it finally made click. This function "launders" pointers from compiler assumptions. It will give you a "clean", pristine pointer back, without for example the information about the concrete object attached to it previously (because for example casting an object to its base class won't give you a proper pointer to the base class; at least that's what as SO comments says… Sounds quite ill, but so is C++). It will also for example "launder" away compiler assumptions about the `const` property of an object pointer. It's needed for example when you do "in-place replacement of an object" (replacing directly the bytes in some memory area of another object). Just casting won't make the compiler "forget" where this memory came from / to which object it was once attached. So you need to launder the pointer to the new object so the compiler forgets what it assumed previously about that memory area. But let's not talk about what it actually means when a language needs some mechanism like that… My "WTF per Minute" output just reached a new all time high, I guess. [1] https://www.phind.com/search?cache=91e3f5ce-dde2-422e-a3eb-689169479882 https://www.phind.com/search?cache=91e3f5ce-dde2-422e-a3eb-6... [2] https://stackoverflow.com/questions/66176720/why-introduce-stdlaunder-rather-than-have-the-compiler-take-care-of-it https://stackoverflow.com/questions/66176720/why-introduce-s...
- malkia 3y agoHoly - the explanation you provided clicked for me! Thank you! And I should use now `phind.com` - awesome!
- ReleaseCandidat 3y agoExclave is also a (PPX - that's a kind of preprocessor for generating the actual code) keyword: `[%exclave]`. Using this avoids name clashes. See: https://ocaml.org/docs/metaprogramming https://ocaml.org/docs/metaprogramming
- lpw25 3y agoOur long term aim is to upstream all of our work from our branch of the OCaml compiler. Of course, that is contingent on the ideas we’re developing there being accepted by the community. There are two main reasons we work on our own branch: 1. Language design is hard. At Jane Street we have a great opportunity to design new features, test them extensively in a realistic environment, and then change them. Because we have access to the entire code base where the features are deployed, we can even change concrete syntax relatively easily. So by developing internally, releasing internally, and then upstreaming with experience, we can be more confident that the feature design is correct. 2. We get a faster turnaround between idea conception and internal deployment. Working solely with upstream, we would develop an idea, go through a long design discussion with upstream, implement, merge, wait for release, wait for the rest of Jane Street to be ready to upgrade, and upgrade. Now, we can implement an idea in parallel with its design, rolling it out internally in stages (as appropriate), and then upstream later. This is a big win for us, and well worth the extra time spent moving changes back and forth. > Why choose such an obscure word as `exclave` We discussed a lot of possible choices and eventually decided this was the best one. I personally think names should either be self-explanatory or memorable -- so that once they have been explained they aren't forgotten -- here we went with memorable. As a word, exclave also captures what is going on in terms of part of the parent region being contained within the child region. `return local` was a strong contender, but it implies that `exclave` is always about functions -- whereas the actual feature is a bit more general than that. It is also a bit easier, when adding new keywords, if you pick a word that isn't used much, and `return` is used a lot.
- yawaramin 3y agoI was reading the post and thinking 'glocal' :-D
- c-cube 3y agoAs someone from the community, I absolutely love this design (and blog post). It would be especially great for returning options, tuples, results, etc. with no overhead at all. I suppose it could also be useful to allocate int64, floats, and maybe even bigints on the data stack? I suppose it's more difficult to put C blocks like bigints or bigarrays in a region.