8 ms·
Oxidizing OCaml: Locality
- malkia 3y agoFound this video too which is worth watching - https://www.youtube.com/watch?v=yGRn5ZIbEW8 https://www.youtube.com/watch?v=yGRn5ZIbEW8
- daxfohl 3y agoSeems like nim could be a good replacement? GC when you need it and explicit control when you need that.
- amelius 3y agoFrom the article: > Ideally, a language could provide a spectrum of allocation strategies freely interoperable within a single application. With modes, users can write OCaml with all the usual GC guarantees—but when performance is paramount, opt into the consideration of lifetimes, ownership, and concurrency.
- nerdponx 3y agoNim is such a nice language, I would really love to see some high-visibility corporate adoption for it.
- geodel 3y agoI think it is not getting enough usage because a lot of people love that others should adopt it first.
- nerdponx 3y agoI can sneak it into a few scripts here and there at work, and I can write my side projects in it, but there's only so much I can do.
- dlahoda 3y agowhere it fits? it feels languages are alive as soon as it fits somewhere. rust and zig for example. seems roc or bosque too. go and ts had fit into some industry slot. where nim fits? how it can compete with other new fits and other old?
- yawaramin 3y agoNot for Jane Street. They likely have millions of lines written in OCaml and rely heavily on its type system safety guarantees.
- deleted 3y ago[deleted]
- Laaas 3y agoI believe this is an explanation (part of) of this proposal: https://github.com/ocaml-flambda/ocaml-jst/blob/main/jane/doc/proposals/data-race-freedom.md https://github.com/ocaml-flambda/ocaml-jst/blob/main/jane/do...
- ReleaseCandidat 3y agoIt's this proposal: https://github.com/ocaml-flambda/ocaml-jst/blob/main/jane/doc/local-intro.md https://github.com/ocaml-flambda/ocaml-jst/blob/main/jane/do... and these problems: https://github.com/ocaml-flambda/ocaml-jst/blob/main/jane/doc/local-pitfalls.md https://github.com/ocaml-flambda/ocaml-jst/blob/main/jane/do...
- TheNumbat 3y agoYes - upcoming posts will cover the uniqueness and data-race-freedom designs.
- still_grokking 3y agoOT: Funny, I start to see here more and more Heise expats. Welcome @ReleaseCandidat! :-D
- yafbum 3y agoThis 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 :)
- malkia 3y agoI've been listening to Signals and Threads podcast, and I remember listening to this episode - https://signalsandthreads.com/memory-management/ https://signalsandthreads.com/memory-management/ (I don't know neither Ocaml, nor Haskell, or any ML language), but the podcast is always fun to listen to (not only programming also) Now would relisten this, and may actually understand it!
- deleted 3y ago[deleted]
- davidatbu 3y agoI'm curious, which episodes are describable as "not only programming"? I ask since I can't think of one.
- malkia 3y agoYou are probably right, wrong recollection then, or it might've been an episode where some time was spent on talking about other important points - culture, life, etc. Podcasts (not only this one) have evolved a lot! (another fav of mine is "Go Time" and many others).
- josh_frome 3y agoThere was a good one about NTP and microsecond precision that had programming but was more a discussion of how hard time is to get right at great precision.
- yla92 3y agoI have not been listening to them in the past but stumbled upon this episode "Multicast and the Markets" and I feel this has a lot of stuff about hardware and network than the software. Highly recommend to check it out. https://signalsandthreads.com/multicast-and-the-markets/ https://signalsandthreads.com/multicast-and-the-markets/
- pjmlp 3y agoThis the best way, productivity of automatic memory management, and low level features for when that extra performance actually makes a difference.
- Decabytes 3y agoIs Ocaml actually good or is it a meme that people use it and become obsessed with it. How is the transition if you mostly code imperatively? Are there things that are not ergonomic for it to do like GUIs or games?
- moonchrome 3y agoDisclaimer : I didn't try Ocaml (weird numeric operators turned me off of it a decade ago) but I did use F# which is supposedly similar. But I don't know what you mean by imperative - for loops and stuff ? Most languages these days support functional programming concepts. Unless you're coming from C it shouldn't be that groundbreaking. Note that Ocaml isn't lazy by default like Haskell - now that makes things... interesting I guess.
- xixixao 3y agoNowadays my primary concern is readability and understandability. Thrown into a codebase, can I understand what's going on? OCaml (which at FB was used to write the Flow typechecker and Hack compiler afair) favored higher order functions. I enjoyed playing with these in my Haskel-based introduction course at university, and I even wrote a similar language that favored them. But I now heavily dislike if `a b c` means "call to a with functions b and c with unknown arguments". I need to read all three (a, b, c) to really get what's going on. This was my biggest gripe with OCaml as it was used at FB. (purely syntactically compare this to `a(parent => b(parent), child => c(child))`, for some verbosity I get a clearer syntax - a is the callee, and I got some information about what b and c possible do - this is a contrived example of course). I think the strength of ML and Haskell got eroded as more "mainstream"y languages got decent type systems (TS/Flow, Hack, Kotlin, even Rust, Python is getting there).
- hardwaregeek 3y agoYeah I think it’s kind of like how pg wrote about how using lisp gave him a disproportionate advantage. Sure, when people used fewer dependencies and the alternatives were C++, Python v1, and Perl, but these days a lot of languages have Lisp features and the cost of using a niche language is worse dependencies and tooling.
- hardwaregeek 3y agoI’ve been critical of OCaml, but I gotta hand it to them, it does feel like the language is going through a renaissance. It’ll be interesting if 5-10 years down the line it manages to significantly improve the usability story while also adding on modes and unboxed types. I’m more focused on usability but these features are compelling too.
- evmar 3y agoMy understanding is that Go does a similar kind of optimization (where locals that don't escape don't go on the heap) but it does it automatically. This has the positive that you don't need annotations but the negative that you can assume some code is benefitting from the optimization when it isn't and there's no warning about it. I'm curious whether the authors here considered this. I didn't see any discussion of related work in the post.
- georgyo 3y agoMy reading seems to be that the compiler can and will do it automatically. The annotations make enforcement. It's easy to make the compiler put something on the heap by accident.
- ianthehenry 3y agoFrom the post: > Even without explicit mode annotations, the compiler can statically determine which variables may escape their enclosing region. Such variables are assigned the global mode; all others are automatically inferred to be local. There's a little more info about mode inference in the proposal: https://github.com/ocaml-flambda/ocaml-jst/blob/main/jane/doc/local-intro.md#inference https://github.com/ocaml-flambda/ocaml-jst/blob/main/jane/do... So arguments to "public functions" do require explicit annotations in order to be local, but otherwise the compiler is able to infer locality and this acts as a transparent optimization.
- andrewstuart 3y agoCan someone explain to me why Jane Street - a trading firm - is so all in on OCaml? There's lots of other choices that would be easier to recruit for, with wider community and industry support. Where does the Jane Street commitment to Ocaml come from?
- cosmic_quanta 3y agoMy recollection is that their systems used to be based on Excel (in the very beginning). A new hire (Yaron Minsky) started using Ocaml for some research project and it stuck.
- emmelaich 3y agohttps://blog.janestreet.com/why-ocaml/ https://blog.janestreet.com/why-ocaml/
- ng12 3y agoIt lets them hire the types of people excited by Ocaml.
- NikkiA 3y agoI think it started off because they needed more speed than the higher level languages like ruby and python could give them (at the time), but couldn't justify writing in a low-ish level like C/C++. I suppose they might have landed on something like Pascal or Fortran, maybe even a lisp, if they'd hired a different developer who had to make the search.
- still_grokking 3y agoInteresting read. What I would like to know is why they didn't take more direct inspiration form the "ML with Python syntax", namely Scala 3, and its "capture checking"[1]. Those OCaml "modi" look just like special cases of capture checking to me. Was that more general approach considered? And if, why was it dismissed? [1] https://docs.scala-lang.org/scala3/reference/experimental/cc.html https://docs.scala-lang.org/scala3/reference/experimental/cc...