[HN Gopher] The New OCaml Website
___________________________________________________________________
The New OCaml Website
Author : bvaldivielso
Score : 211 points
Date : 2022-04-29 14:23 UTC (8 hours ago)
(HTM) web link (ocaml.org)
(TXT) w3m dump (ocaml.org)
| agumonkey wrote:
| It's not new, it's function of the old.
| _benj wrote:
| What is OCaml mostly used for? Like Ada for aerospace or Erlang
| for concurrency, does OCaml has a niche like that?
| UncleOxidant wrote:
| In addition to what others have mentioned, it's a great
| language for writing compilers and interpreters.
| bhawks wrote:
| Tezos's reference node Octez is written in OCaml and one of the
| main smart contract languages Ligo really shows it's OCaml
| roots.
|
| https://tezos.gitlab.io/
|
| https://ligolang.org/
|
| It's a nice change of pace from the Ethereum ecosystem.
| jamal-kumar wrote:
| Yeah especially considering the safety guarantees that ocaml
| offers over say solidity. If tezos ever went above 10$ maybe
| I'd be able to convince people who are going all in on
| ethereum to start projects with it.
| melissalobos wrote:
| People will mention Jane Street for financial stuff, but mostly
| academia and compilers.
| curiousgal wrote:
| There's also LexiFi for finance.
| fancyfredbot wrote:
| Does LexiFi use vanilla OCaml now? I remember that in the
| past they had created their own custom dialect.
| xvilka wrote:
| Program analysis and formal verification.
| junon wrote:
| I've seen it in things where performance isn't super important
| (OCaml is _slow_ as per my experience). Many, many provers
| /theorum solvers use OCaml because it reduces the bugs in the
| provers themselves.
| sweetsocks21 wrote:
| It's surprisingly general purpose. I mostly use it for toy side
| projects. I've used it for basic CRUD apps, like a reddit
| aggregator. I've written a couple opengl graphics libraries
| with it. Used it instead of JS for a web implementation of a
| board game. a toy Datomic clone, and I'm currently working on
| an alternative unix shell.
|
| It's pretty comfortable for organizing and refactoring because
| of the nice module and type system. And once you grok Dune (the
| build system) you can get going pretty quick. Builds are very
| fast compared to most of the languages I use at work. And if
| you're not doing anything egregious the optimizing compiler
| (Flambda) can usually be within ~2x of C for most things. When
| it's not dropping down to C is very easy because the FFI system
| is very straight forward, and has built in support in Dune.
|
| It is lacking a bit in libraries and when you need to drop down
| to imperative features you may find it a bit rough. For example
| not having a return keyword can make it annoying to port over
| libraries.
|
| Overall I like it because I think the pros outweigh the cons,
| but I've also been using it for a decade so I'm probably
| getting set in my ways now. I'd say it's worth trying at least
| to understand Sum types (and maybe GADTs), and use a language
| with first class modules, it can change your approach to
| problems once you see some extra tools.
| hyperhopper wrote:
| This is totally a biased cop out, but I'd say "most things".
|
| Like, what's java's niche? I'd say it doesn't really have one
| anymore, it's just a generalist language. Ocaml is also a
| generalist language, but it has much better language paradigms,
| is safer, more concise, has more features with less baggage,
| etc. It's just good all around.
|
| As a functional programming advocate, I'd point to safety,
| readability, and development velocity as features, but those
| are all around good and desirable, not really a niche.
|
| I wish more companies were using languages like
| ocaml/f#/clojure vs c++/python/java when there is no specific
| reason to use the former.
| progre wrote:
| Maybe it's more usefull to talk about a 'slant'? Like, you
| can totaly do desktop apps with custom GUI components in Java
| but those _tends_ to be written in C++ for some reason.
|
| Like java, python, c# 'slants' towards web services and
| maaybe CRUD apps, C++ 'slants' towards games and graphicly
| complex apps.
| nicoburns wrote:
| I have no personal experience, but I've heard OCaml is
| particularly excellent for writing compilers.
| afandian wrote:
| Which side would you put Kotlin in? Feels equidistant between
| Clojure and Java.
| WastingMyTime89 wrote:
| It was written in tandem with a prover and is generally very
| nice to use to develop compilers and analysers. The biggest
| company using it does algorithmic trading with it.
| anuragsoni wrote:
| I've used OCaml at day-jobs for the past couple of years. It
| has an excellent concurrency story, and I've used OCaml for
| lots of "boring" work (web services, database drivers, data
| processing, etc).
| giraffe_lady wrote:
| Wait how did you go about finding ocaml day jobs? I pretty
| much never even tried it seems so niche, and jane street
| doesn't appeal to me at all.
|
| I sneak it in at my jobs when I can justify it but it seems
| like there are very very few jobs that use it primarily.
| whimsicalism wrote:
| I think FB uses OCaml at least to some extent.
| giraffe_lady wrote:
| Yeah I think that's a good example of what I mean though.
| That'll be a couple tiny teams within a huge org, with a
| lot of people willing/desiring to transfer internally
| onto it. Those rarely if ever get filled from outside the
| org, and when they do they're looking for experts not
| competent part-time users.
| anuragsoni wrote:
| The first time was hearing about a startup that used OCaml
| on one of the monthly hackernews Who is hiring thread. The
| current day job was also somewhat similar in that I had
| read about a startup's job listing on the OCaml forum [1],
| checked with them again a while later (the startup was
| acquired by another company), and found an open role on the
| team that continued to use OCaml after the acquisition.
|
| > it but it seems like there are very very few jobs that
| use it primarily.
|
| I completely agree. I never tried looking for an OCaml job
| mostly because there weren't enough options at-least in the
| US (I'm based in USA), and I am picky about who I work for
| and wasn't interested in exploring job opportunities at
| companies working on cryptocurrencies. I just got lucky
| that I stumbled upon two different companies that used
| OCaml. The first time around I applied for the job because
| of OCaml, the second time around it was because I liked the
| company and OCaml was an added bonus on top.
|
| [1] https://discuss.ocaml.org/
| giraffe_lady wrote:
| Ugh yeah that pretty much confirms what I suspected. It's
| a few huge players using it for small internal projects,
| jane street, and a bunch of crypto shit I'm not willing
| to touch.
|
| The language I work in is not even one of my top
| priorities when looking for work, but still it would be
| cool. I'm lucky enough to have enough freedom to work in
| it from time to time, which is good enough for me.
|
| Thanks for the response!
| anuragsoni wrote:
| > The language I work in is not even one of my top
| priorities when looking for work, but still it would be
| cool.
|
| Same! I've made the mistake of overlooking certain things
| just because I wanted to get some real world OCaml
| experience in the past, and I will not make the same
| mistake again.
|
| At my current job I mostly use OCaml and Python, with
| some Typescript for whenever I need to touch a frontend
| application. As much as I like using OCaml, I'm more
| thrilled about working on a team where I enjoy working
| with everyone, and having a work environment that
| provides flexibility about picking the best tool for a
| job. Most of my OCaml hacking still takes place on my
| free time, and on my personal open-source explorations
| :-)
|
| > Thanks for the response!
|
| You are welcome! Sorry if my responses weren't too useful
| with respect to using OCaml at work.
| giraffe_lady wrote:
| I really think it's such a good fit for most of the daily
| non-web work I've had to do. It lets you keep the core logic
| clean & fun and then you can just shrug and let rip with the
| mutations or whatever when that makes the most sense.
|
| I'm well out of my FP fanboy phase now but ocaml feels great
| for my favorite parts of that without being judgmental when
| I'm not in the mood.
| anuragsoni wrote:
| > It lets you keep the core logic clean & fun and then you
| can just shrug and let rip with the mutations or whatever
| when that makes the most sense.
|
| Very true! I've used mutations and imperative OCaml quite a
| few times. Sometimes it was for performance reasons (I've
| been working on a web server library), and other times when
| loops either made the implementation a little easier to
| read, and/or helped avoid some allocations. I am glad that
| the language is pragmatic enough that I can still use
| mutation or imperative code where it makes sense, while
| still being able to present a nice clean api on top.
| chazeon wrote:
| I know Jane Street use the hell out of OCaml, the whole company
| is almost built on top of it.
| asymmetric wrote:
| The "Carbon Footprint" page[0] is a nice touch. Not much in terms
| of concrete action there, but the fact it has been written (and
| linked to in the footer) is a good start.
|
| [0]: https://ocaml.org/carbon-footprint
| QuikAccount wrote:
| OCaml is a language that I'd really like to use more in my day to
| day but can't find a use for.
| Erlangen wrote:
| The new layout for "99 problems" looks much better than before.
| It's a huge improvement.
|
| https://ocaml.org/problems
| Orangeair wrote:
| Initial impression: why do the first two blocks of text say
| almost exactly the same thing?
| sigzero wrote:
| The second line is what the REPL prints out.
| bvaldivielso wrote:
| They mean the copy, not the code snippets
| cultofmetatron wrote:
| I love that we now live in an age where older languages can
| suddenly start seeing a renaissance. I hope something similar
| comes to common lisp.
| _benj wrote:
| same. I think something along those lines might be happening
| with projects like Janet, Fennel and Clojure. But I'd love to
| be able to experience that so talked about CL teaching a system
| how to behave in CL/Small Talk
| zem wrote:
| and D!
| nix23 wrote:
| Like Mozart/OZ, i just love that language.
|
| https://github.com/mozart/mozart2
| zem wrote:
| have you used it for anything? i followed it hopefully when
| it first came out but it never seemed to make the leap beyond
| "research/teaching language" and was finally abandoned :(
| cannam wrote:
| > I hope something similar comes to common lisp.
|
| When you say "something similar", what are you thinking about?
| Simply this rather professional presentation, or something
| social, or something technical? Or the fact of a renaissance?
| Is this sort of revamp a cause or a symptom of a renaissance?
|
| For Common Lisp it's always seemed to me that SBCL (disclaimer:
| never used it, only read about it) is the "modern" option in
| the sense that it's well maintained, portable and fast, but it
| has the most amazingly old-school web presence.
|
| Another great example is Poly/ML (https://polyml.org/) - one of
| the best implementations of Ocaml's close relative SML, but
| it's very much lacking a Bootstrap theme and "trusted by"
| testimonials and it has a splendid naive-art parrot. I like all
| that about it, but you wouldn't look at the page and think
| "I'll choose that for my new green-field project with venture
| capital money".
|
| I would love to see a renaissance of Prolog as well.
| plainOldText wrote:
| I know these languages are both members of the ML language, but
| why would one pick OCaml over F#?
|
| I've toyed a bit with both and F# seems a bit more ergonomic:
| pipes, computation expressions, a more concise syntax, etc. I do
| like how fast the OCaml compiler is though.
| wk_end wrote:
| The most straightforward reason to pick OCaml over F# is that
| OCaml's not tethered to the .NET world. Though this is also an
| excellent reason to pick F# over OCaml!
|
| OCaml's type and module system is generally more sophisticated
| than F#'s - F# doesn't have GADTs, all the functor-y goodness
| of OCaml's module system, or even OCaml's weird-but-brilliant
| structurally typed object system. The new algebraic effects
| that OCaml's getting imminently are pretty killer, too. F#, of
| course, has several awesome features that OCaml lacks.
| amelius wrote:
| > but why would one pick OCaml over F#?
|
| For me it would be because OCaml is supported by Ubuntu as a
| package. In contrast, for installing F# you need to add an
| external repository and mess with GPG keys etc. which seems
| odd. Perhaps I'm wrong but what it tells me is that F# is not
| yet fully embraced by the open source/Linux community.
| hardwaregeek wrote:
| It's a nice website and certainly an improvement from the older
| one. I just hope that this isn't the only area where OCaml
| improves. I'd love a consistent documentation source a la
| docs.rs, better support for language servers, and maybe an
| explicit effort to build out a good package ecosystem.
|
| I really want to like OCaml but the usability story is so far
| behind Rust. The language is stunning but the ecosystem needs a
| lot of work.
| anuragsoni wrote:
| OCaml has a pretty decent language server [1]. You can pair it
| with the excellent OCaml vscode plugin [2], or any other LSP
| plugin for the editor of your choice.
|
| [1] https://github.com/ocaml/ocaml-lsp/
|
| [2]
| https://marketplace.visualstudio.com/items?itemName=ocamllab...
| ChadNauseam wrote:
| The VSCode plugin and language server are really good.
| They're not quite on par with rust-analyzer, but I very
| rarely have issues with them, especially when using esy as
| the package manager (because you can easily set the version
| of the language server and be sure that everyone on the team
| is on the same version).
| glenda wrote:
| The docs.rs part is actually included in the new website:
| https://ocaml.org/packages
|
| I've been using ocaml-lsp-server with nvim-lspconfig and it's
| been great, I'm wondering what issues you've had? From my
| perspective the ecosystem is evolving pretty quickly!
| d3nj4l wrote:
| I can second your experience of using ocaml-lsp-server - I
| use it with VSCode and it's been incredibly pleasant with
| lots of active and ongoing work to make it even better. Gone
| are the days when writing OCaml basically meant using emacs
| (thought that's still a good option if you want it!)
| hardwaregeek wrote:
| Perhaps the README[1] is out of date, but it appears to note
| that textDocument/implementation is not done? That's a pretty
| big hole.
|
| [1]: https://github.com/ocaml/ocaml-lsp/#features
| giraffe_lady wrote:
| I don't think the ocaml tooling is _great_ but I don 't find it
| too much of an outlier compared to other languages I work with.
| I haven't used rust but I do believe it's better there. Ocaml
| has been improving steadily over the last few years though, and
| none of those things has been a major barrier to anything I
| needed to do recently.
| continuational wrote:
| > General-Purpose, Industrial-Strength, Expressive, and Safe
|
| > Here's how to do square and factorial.
|
| Show, don't tell.
| conroy wrote:
| This landing page includes a pet peeve: zero-context social
| proof.
|
| It's great to know that Microsoft, Docker, and Facebook use
| OCaml. Buy do they use it seriously? The industrial users
| (https://ocaml.org/industrial-users) page links directly the
| company websites. Only two logos from the home page have case
| studies. Don't just tell me that Microsoft uses OCaml, tell me
| how!
| duxup wrote:
| I don't even put much faith in those. I've seen enough that I
| was sure they were BS... they're just noise to me.
| ilaksh wrote:
| Same way Microsoft uses Java, mainly. They copied it, paid a
| bunch of geniuses massive amounts of money to make it better
| and run on their platform, then spent millions and millions of
| dollars recruiting Ocaml (Java) developers into their
| proprietary F# (C#) universe.
| activitypea wrote:
| I know that Facebook's Typescript competitor, Flow, was both
| written in OCaml and tried to introduce the HM type system into
| the JS world. It was quite popular back in the day, but
| eventually lost the war to TS.
|
| Perhaps more notably, they are still actively working on
| Rescript (formerly ReasonML), which is an Ocaml dialect with JS
| as the primary compilation target (think Clojurescript but
| Ocaml). They also maintain a flavor of React specific for
| Rescript. I don't know how much they dogfood it, but it seems
| like they're at least somewhat betting on an ML future.
|
| Disclaimer: Not a FB/Meta employee
| zem wrote:
| their python type checker, pyre, is also written in ocaml
| tmattio wrote:
| Hi! I am a contributor of this new version of ocaml.org.
|
| Just wanted to also link the announcement post here:
| https://discuss.ocaml.org/t/v3-ocaml-org-we-are-live/9747.
|
| This new website comes with lots of improvements over the
| previous version, and in particular, the team has been working
| hard on the following:
|
| - Central OCaml package documentation, which contains the
| documentation of every version of every OCaml packages.
| (https://ocaml.org/packages)
|
| - OCaml job board, which lists job opportunities from the
| community. (https://ocaml.org/opportunities)
|
| - OCaml success stories which explore how major OCaml industrial
| users solved real-world challenges using OCaml.
| (https://ocaml.org/industrial-users)
|
| - An interactive OCaml playground to try OCaml code directly in
| the browser. (https://ocaml.org/play)
|
| - A syndicated blog, which links to blog articles from the
| community and offers original blog posts.
| (https://ocaml.org/blog)
|
| I'm thrilled that the website is live after more than a year of
| development! We hope that this will help new comers to have a
| smoother experience when trying OCaml (in particular with OCaml 5
| coming soon), so don't hesitate to share feedback on how we can
| improve it further!
| skybrian wrote:
| The graph on the front page is unclear. Is it the fast compiler
| or the slow computer? The columns are labelled with mysterious
| words like "menhir" and "opam." I don't know what a reader new
| to OCaml is supposed to learn from it.
| ninala wrote:
| Can I talk to you about the job board? What's the best way to
| get in touch?
| munk-a wrote:
| OCaml has a particularly easy to associate mascot that's been
| prominently featured in the past - is there a reason the
| website is moving away from the more familiar camel
| iconography?
| muglug wrote:
| The camel (in the top left corner) was the first thing I
| noticed!
| agumonkey wrote:
| what website / community is the most warm on ocaml these days ?
| reddit ? irc ? I don't know, I'm curious where to find people
| thinking and working with *caml.
| tmattio wrote:
| Both the Discord (https://discord.com/invite/cCYQbqN) and
| Discuss (https://discuss.ocaml.org/) are very active.
| agumonkey wrote:
| thanks a lot :)
| baruchel wrote:
| You can ask on Matrix: #ocaml-language:matrix.org and
| generally being answered very quickly. I think this channel
| is also murrored on IRC.
| valcron1000 wrote:
| What's the current state of OCaml regarding parallelism &
| concurrency? Is it like Node.js where I have single threaded
| async/await model or do I have access to parallelism?
| masklinn wrote:
| OCaml is more like Python in that it has true OS threads, but
| it has a GIL (it also has an async ecosystem via `lwt` and
| `Async`).
|
| This will change when OCaml 5 is released, though it is likely
| that will require test driving and fixes in both ocaml itself
| and the ecosystem.
|
| Multicore OCaml was merged in PR #10831, and 5.0 was originally
| targeted to be cut in March or April 2022, but it seems there
| are still blockers: https://github.com/ocaml/ocaml/milestone/40
| pjob wrote:
| Multicore support announcement:
| https://discuss.ocaml.org/t/the-road-to-ocaml-5-0
|
| Latest monthly update: https://discuss.ocaml.org/t/multicore-
| ocaml-march-2022
|
| Github for the multicore project: https://github.com/ocaml-
| multicore/ocaml-multicore
| TheMagicHorsey wrote:
| Is MirageOS (Ocaml unikernel) still making forward progress? Ten
| years ago I thought security sensitive apps would all move to
| unikernals, but it never happened.
| anuragsoni wrote:
| Yes it is. There was a new major release last month:
| https://mirage.io/blog/announcing-mirage-40
| mrcrumb1 wrote:
| Why do functional programming examples always use such short
| names? I feel like it adds extra cognitive overhead to trying to
| learn something that's got plenty of foreign concepts to grok.
| zem wrote:
| a lot of the time there are patterns and idioms that occur very
| frequently in the language, and have evolved a set of standard
| short names, e.g. "xs" for a list and then "x" for the element
| in an iteration, or "acc" for an accumulator parameter in a
| recursive function.
| giraffe_lady wrote:
| I suspect the ideal behind that is the "variables with small
| scope should have shorter names" concept. So in a one-liner
| it's ok to abbreviate.
|
| I don't necessarily agree with this especially for examples.
| But in practice I haven't found the fp communities I'm familiar
| with (clojure and ocaml) to be too bad about using confusingly
| terse names. Php and go are by far the worst there, again at
| least from my experience.
| brucie wrote:
| Isn't it a kind of proof that a function is generic? I can
| map over some xs with an f and produce ys.
| junon wrote:
| Kind of an annoying point but I'm tired of seeing factorial-like
| functions as the first demos of PL sites. It does nothing to
| explain how the language works, what it looks like, what any
| defining/unique features are, what the standard library - if any
| - might have included, etc.
| Jtsummers wrote:
| Actually, it does here. Definitions with _let_ in OCaml are
| _not_ recursive. _let rec_ permits you to have recursive
| definitions. A simple numeric function is probably the fastest
| way to show something that a user can type in that illustrates
| how you 'd write a simple recursive function.
| yawaramin wrote:
| The site is on GitHub--feel free to send a PR if you have a
| better suggestion!
| hbn wrote:
| I see those Tailwind classes!
| __david__ wrote:
| A nit about the code sample syntax highlighting, shouldn't "rec"
| be highlighted as a keyword and "fac" be the yellowish color that
| "square" was in the first line?
| asplake wrote:
| What is the OCaml web development story now? What is it like to
| use?
| frou_dh wrote:
| The new hotness is Dream, which technically isn't 1.0 yet, but
| is very well documented and example'd
|
| https://aantron.github.io/dream/
|
| https://github.com/aantron/dream/tree/master/example
| dna_polymerase wrote:
| It's probably the best open source OCaml project in terms of
| documentation and in my opinion it really sets the bar for
| all oss project a little higher. Aantron really did some
| amazing work here.
| wawjgreen wrote:
| gmfawcett wrote:
| The "build time" graph is missing a time unit on its y-axis.
| MrZander wrote:
| I have no familiarity with OCaml at all, so I really don't know
| what the unit should be here. If it's milliseconds, that's
| really, really, impressive. If it's seconds though, that seems
| on par with other languages/compilers I've used.
___________________________________________________________________
(page generated 2022-04-29 23:01 UTC)