News for hackers. Stuff that matters.
Re:OCaml on Baremetal Shakti RISC-V Processor by abhinai on Friday March 29, 2019 @11:20AM (#19522431)
OCaml is a beautiful language but I haven't seen any big non language projects written in OCaml. Does any one know why? OR do such projects exist and it is only that I am not aware of them?
Re:OCaml on Baremetal Shakti RISC-V Processor by progman on Friday March 29, 2019 @02:08PM (#19524078)
Companies using OCaml: https://ocaml.org/learn/companies.html

What is OCaml used for? https://www.quora.com/What-is-OCaml-used-for?share=1

Further infos:

awesome-ocaml - A curated collection of awesome OCaml tools, frameworks, libraries and articles: https://github.com/ocaml-community/awesome-ocaml

OCamlPro Research and Development: https://www.ocamlpro.com/research-and-development/

OCaml Weekly News (RSS): http://alan.petitepomme.net/cwn/cwn.rss

Re:OCaml on Baremetal Shakti RISC-V Processor by cosmic_quanta on Friday March 29, 2019 @01:52PM (#19523954)
The Fastest Fourier Transform in the West (FFTW) library is an example of a ubiquitous software product using OCaml. The FFTW library is a C library, but it is in large parts generated by an OCaml program, genfft (from the FAQ http://www.fftw.org/faq/section2.html#languages)
Re:OCaml on Baremetal Shakti RISC-V Processor by wtetzner on Friday March 29, 2019 @11:53AM (#19522712)
Re:OCaml on Baremetal Shakti RISC-V Processor by thinkpad20 on Friday March 29, 2019 @12:13PM (#19522913)
ReasonReact is a fantastic project that is written in OCaml (with Reason syntax). In addition to being a wonderful frontend framework, it's also a great introduction to the language.
Re:OCaml on Baremetal Shakti RISC-V Processor by msvan on Friday March 29, 2019 @12:33PM (#19523145)
This is OCaml's problem: it's a great language with no users. ReasonML is trying to solve this by making it more approachable, and they're making steady progress.
Re:OCaml on Baremetal Shakti RISC-V Processor by bryanphe on Friday March 29, 2019 @01:49PM (#19523933)
There are some really cool projects popping up with ReasonML - here are a few:

- A package manager like NPM, but for native code: https://github.com/esy/esy

- A fast Node version manager: https://github.com/Schniz/fnm

- A fast replacement for dotenv-cli: https://github.com/ulrikstrid/reenv

- A fast JS bundler: https://github.com/fastpack/fastpack

- A native language server: https://github.com/jaredly/reason-language-server

The OCaml language and toolchain is very powerful... and I do believe ReasonML makes it more approachable, at least for a wider audience of developers comfortable with JavaScript-style syntax.

Re:OCaml on Baremetal Shakti RISC-V Processor by ihnorton on Friday March 29, 2019 @09:18PM (#19526930)
I think you forgot one ;)

- A native GUI: https://github.com/revery-ui/revery

Re:OCaml on Baremetal Shakti RISC-V Processor by progman on Friday March 29, 2019 @02:17PM (#19524150)
> This is OCaml's problem: it's a great language with no users.

My other post in this thread proves the opposite.

Re:OCaml on Baremetal Shakti RISC-V Processor by msvan on Friday March 29, 2019 @02:26PM (#19524228)
It's hyperbole. Relative to larger languages, there are few users.
Re:OCaml on Baremetal Shakti RISC-V Processor by progman on Friday March 29, 2019 @02:40PM (#19524356)
Yes, there are also poor languages with many users :-)
Re:OCaml on Baremetal Shakti RISC-V Processor by swingthesickle on Friday March 29, 2019 @11:59AM (#19522777)
There's a (unofficial) FUSE file system for Google Drive written in OCaml: https://github.com/astrada/google-drive-ocamlfuse
Re:OCaml on Baremetal Shakti RISC-V Processor by sanxiyn on Friday March 29, 2019 @11:42AM (#19522610)
Unison File Synchronizer is written in OCaml.
Re:OCaml on Baremetal Shakti RISC-V Processor by rixed on Friday March 29, 2019 @12:55PM (#19523383)
OCaml is very good at symbolic computations, and not so good at floating point computations. Therefore it's a very good language for writing compilers etc.

Further than that, there are no more programs written in it for the same reason than there are no more programs written in any interesting languages, I guess; ie largely accidental.

Re:OCaml on Baremetal Shakti RISC-V Processor by oconnor0 on Friday March 29, 2019 @01:04PM (#19523480)
> and not so good at floating point computations

What does this mean? I was under the impression the OCaml compiler did a decent number of floating point specific optimizations, like unboxed arrays and what not.

Re:OCaml on Baremetal Shakti RISC-V Processor by noir_lord on Friday March 29, 2019 @01:09PM (#19523538)
Surprised me as well janestreet are a well known user of ocaml and I can't imagine they don't use a lot of floats.
Re:OCaml on Baremetal Shakti RISC-V Processor by pjmlp on Saturday March 30, 2019 @01:53AM (#19528009)
I guess it is the typical complain about using separate operators for ints and floats.

It never bothered me in Caml Light, let alone when Objective Caml was introduced.

Re:OCaml on Baremetal Shakti RISC-V Processor by andrepd on Sunday March 31, 2019 @12:34AM (#19533893)
You can write floating point operators in several different ways. You can write with the normal floating point operators

    x *. y +. z
or, since `Float.(+) = (+.)`, `Float.() = (.)`, etc,

    let open Float in
    x * y + z
or simply

    Float.(x * y + z)
Re:OCaml on Baremetal Shakti RISC-V Processor by xyproto on Monday April 01, 2019 @03:09AM (#19541170)
That is pretty neat. Does it mean that one could do something similar for vectors and quaternions?

    let open Quaternion in
    x * y + x
Re:OCaml on Baremetal Shakti RISC-V Processor by andrepd on Tuesday April 02, 2019 @08:30AM (#19553314)
Yep. You could write

    module Quaternion = struct
      let (+) =
        ...
    
      let ( * ) =
        ...
    end
then

    let open Quaternion in
imports the contents of Quaternion into local scope, so you can write

    x * y + z
Re:OCaml on Baremetal Shakti RISC-V Processor by vrotaru on Monday April 01, 2019 @04:05AM (#19541405)
Yes.
Re:OCaml on Baremetal Shakti RISC-V Processor by oconnor0 on Saturday March 30, 2019 @06:46PM (#19532431)
Ah, maybe, perhaps I am in the minority that liked the different operators for ints and floats. :D
Re:OCaml on Baremetal Shakti RISC-V Processor by rixed on Sunday March 31, 2019 @01:21AM (#19534039)
Symbols (variants with our without parameters) and integers are unboxed, while floats are not (but in a few specific cases such as arrays of floats, and iiuc that's an inelegant special case on its way out, as it prevents other optimisations).
Re:OCaml on Baremetal Shakti RISC-V Processor by parley on Friday March 29, 2019 @11:18PM (#19527471)
I’ll add to all the examples in this thread that the Rust (also partly of ML descent) compiler was written in OCaml until it became self hosting.

I’ll also +1 the comments about ReasonML which is very promising.

Though I suppose these are both ”language” related — just not strictly the OCaml language.

Re:OCaml on Baremetal Shakti RISC-V Processor by z3phyr on Friday March 29, 2019 @12:03PM (#19522807)
Re:OCaml on Baremetal Shakti RISC-V Processor by cedricbonhomme on Friday March 29, 2019 @06:32PM (#19526209)
Re:OCaml on Baremetal Shakti RISC-V Processor by zukzuk on Friday March 29, 2019 @12:24PM (#19523044)
The Tezos blockchain / dapp platform is based on OCaml. This to me makes it really appealing, if I were to find some actual use case for a blockchain application :)
Re:OCaml on Baremetal Shakti RISC-V Processor by isaachier on Friday March 29, 2019 @11:33AM (#19522538)
When you say non-language, do you mean unrelated to OCaml specifically or any language? Facebook implemented its infer linter for C, C++, Java, and Objective-C in OCaml: https://github.com/facebook/infer. When I worked at Bloomberg, they released BuckleScript for JS development. Not sure if that caught on though.
Re:OCaml on Baremetal Shakti RISC-V Processor by richeyryan on Friday March 29, 2019 @11:55AM (#19522733)
Bucklescript has caught on to some extent. Its sister syntax ReasonML is getting a little traction which means that Bucklescript is getting a little traction as they share the same build chain.

Facebook Messenger is built using Reason. A few other smaller companies are using it too: https://reasonml.github.io/en/users-of-reason

Wow Air were using it though one probably can't blame that for their collapse.

I guess that list doesn't include straight Bucklescript users either. There are definitely companies out there who use it outside of Reason so the OCaml, in general, is getting some use in industry which is nice.

Re:OCaml on Baremetal Shakti RISC-V Processor by microcolonel on Friday March 29, 2019 @11:34AM (#19522540)
Re:OCaml on Baremetal Shakti RISC-V Processor by amelius on Friday March 29, 2019 @04:06PM (#19525146)
I'd love to use it, but there seems to be no multicore support.
Re:OCaml on Baremetal Shakti RISC-V Processor by kcsrk on Friday March 29, 2019 @10:06PM (#19527160)
Re:OCaml on Baremetal Shakti RISC-V Processor by nickpeterson on Friday March 29, 2019 @04:12PM (#19525202)
I obviously don't t know your use case, but the more I look into multi-core code, the less impressed with it I am. I think you're almost always better with a tight loop and a good persistence strategy. If the thing you're doing really benefits trivially from easy paralellism, I'd lean on gpus anyways...
Re:OCaml on Baremetal Shakti RISC-V Processor by amelius on Friday March 29, 2019 @04:17PM (#19525236)
Well one usecase I have in mind is a fast distributed datastore that integrates well with the rest of the language. This means I need threads, to do transaction processing. And I also need shared memory at the language's object level, allowing structural sharing for efficiency.
Re:OCaml on Baremetal Shakti RISC-V Processor by BubRoss on Saturday March 30, 2019 @10:11AM (#19529464)
It could be worth taking a look at this, it sounds like an example of what you want (C++11)

https://github.com/LiveAsynchronousVisualizedArchitecture/si...

Re:OCaml on Baremetal Shakti RISC-V Processor by nikofeyn on Friday March 29, 2019 @11:04PM (#19527400)
basically every program i have written has been concurrent and benefited from multi core support. a language that doesn’t have it just isn’t an option.
Re:OCaml on Baremetal Shakti RISC-V Processor by pjmlp on Saturday March 30, 2019 @01:56AM (#19528017)
Security exploits and plugin crashes on the other hand prove there is a benefit in using multiple processes instead.
Re:OCaml on Baremetal Shakti RISC-V Processor by BubRoss on Saturday March 30, 2019 @10:16AM (#19529497)
I think both are more a matter of architecture. There are many different ways of finding parallelism and they all have their place. There is no single silver bullet and more parallelism and concurrency are generally the right direction to make use of modern hardware.
Re:OCaml on Baremetal Shakti RISC-V Processor by nikofeyn on Saturday March 30, 2019 @03:18AM (#19528273)
well, trade offs are trade offs because then one has to worry about intraprocess communication. can you elaborate on security exploits? i would assume a closed off system with interprocess communication would be less vulnerable than that with intraprocess communication, which seems like it could be intercepted. but i do not know much about security.

process crashes are of course a problem in terms of bringing down the whole process, but that generally isn’t a problem for me.

Re:OCaml on Baremetal Shakti RISC-V Processor by pjmlp on Saturday March 30, 2019 @05:54AM (#19528650)
Each process would execute with the minimal set of permissions that it needs to perform its tasks.

Whereas in interprocess, each thread can do everything that the whole process is allowed to do, so a security exploit in e.g. file parser, opens the door for doing other stuff that a file parser shouldn't be allowed to start with.

An easy to use IPC is to use pipes, mailboxes, message queues, just like channels.

Yes it might be slower, but for a large set of problems it is fast enough.

Re:OCaml on Baremetal Shakti RISC-V Processor by yawaramin on Saturday March 30, 2019 @02:43AM (#19528157)
Do you have any analytical benchmarks regarding the benefits you've gotten from multicore support?
Re:OCaml on Baremetal Shakti RISC-V Processor by nikofeyn on Saturday March 30, 2019 @03:14AM (#19528262)
well just today i sped up a simple algorithm by a factor of two or three on larger data sets by simply turning on parallelism in a for loop, which distributes iterations across cores and then merges them afterwards. so multicore performance came for free.

in other instances, when programming concurrent programs, i have no worry of performance losses because, again, multicore support comes for free. that is more qualitative, but it is important. and it means my concurrent programs are actually concurrent.

Re:OCaml on Baremetal Shakti RISC-V Processor by yawaramin on Saturday March 30, 2019 @04:53PM (#19531770)
Regarding your simple algorithm, that's great but map/reduce is a well-known 'embarrassingly parallelizable' algorithm. If the majority of your code is map/reduce that's great for you but a lot of code is not trivially parallelizable like that.

The problem with 'no worry of performance losses' with multicore is that using multiple cores itself has a cost. You need to split up your workload, schedule the work across the cores, pass the actual data as messages to whatever 'task' abstraction you're using, and unless the garbage collector has fancy tricks, this will mean having to deep-copy the data to preserve thread safety. So again, there's no such thing as a free lunch in multicore.

Re:OCaml on Baremetal Shakti RISC-V Processor by nikofeyn on Saturday March 30, 2019 @08:30PM (#19532880)
> If the majority of your code is map/reduce that's great for you

who said it was? (it isn’t.) you asked for examples, and i gave the most recent one.

> You need to split up your workload, schedule the work across the cores, pass the actual data as messages to whatever 'task' abstraction you're using, and unless the garbage collector has fancy tricks, this will mean having to deep-copy the data to preserve thread safety.

you’re making a huge amount of assumptions and supposed “costs” here based upon the rather limiting nature of most programming languages when it comes to concurrency. most of the multicore programming i do is with actors with a data flow language. multicore programming is so trivial you don’t even think about it.

Re:OCaml on Baremetal Shakti RISC-V Processor by yawaramin on Saturday March 30, 2019 @09:52PM (#19533225)
> who said it was? (it isn’t.) you asked for examples, and i gave the most recent one.

OK, but then, outside of that kind of use case, most applications are not trivially parallelizable like that.

> most of the multicore programming i do is with actors with a data flow language. multicore programming is so trivial you don’t even think about it.

Maybe I miscommunicated, but I don't mean that you literally are doing all these things, but that something is–some combination of the language, the runtime, and the developer. My point is that no matter who is doing it, these things have costs–runtime performance, memory use, limits on the usable data structures and programming techniques.

Re:OCaml on Baremetal Shakti RISC-V Processor by oneplane on Friday March 29, 2019 @12:22PM (#19523017)
A lot of Xen is built in OCaml
Re:OCaml on Baremetal Shakti RISC-V Processor by lelf on Friday March 29, 2019 @02:49PM (#19524430)
> any big non language projects written in OCaml

Coq proof assistant (https://coq.inria.fr). Well, you can say it is language-related, but it’s a lot more than that.

Re:OCaml on Baremetal Shakti RISC-V Processor by the_why_of_y on Saturday March 30, 2019 @07:18AM (#19528872)
The tooling around libguestfs, a library for manipulating disk images that is typically used with KVM/Qemu based virtualization, is implemented in OCaml; the library itself is implemented in C.

https://rwmj.wordpress.com/2017/06/04/new-in-libguestfs-rewr...

http://libguestfs.org/

Re:OCaml on Baremetal Shakti RISC-V Processor by snaky on Friday March 29, 2019 @08:27PM (#19526750)
> MetaOCaml has been successfully used for the most optimal stream fusion, specializing numeric and dynamic programming algorithms, building FFT kernels, compilers for an image processing and database query DSLs, OCaml server pages, generating families of specialized basic linear algebra and Gaussian Elimination routines, and high-performance stencil computations.

http://okmij.org/ftp/ML/MetaOCaml.html

Re:OCaml on Baremetal Shakti RISC-V Processor by thosakwe on Friday March 29, 2019 @06:24PM (#19526169)
I’m a huge OCaml fan, but really it lacks a lot of things that you get out of the box with the runtimes of other languages. Multi core support is the most obvious one.

It’s definitely great for things like compilers, though. But I wouldn’t necessarily use it for a Web server.

Re:OCaml on Baremetal Shakti RISC-V Processor by kcsrk on Friday March 29, 2019 @10:04PM (#19527148)
We're working on it. You can install and play around with Multicore compiler today though the wider library ecosystem is yet to catch up. https://github.com/ocamllabs/ocaml-multicore
Re:OCaml on Baremetal Shakti RISC-V Processor by yawaramin on Friday March 29, 2019 @08:55PM (#19526857)
Multicore support is imho nowhere near OCaml's top problem :-) that would probably be a toolchain that lends itself to easy reproducible package management. But we're getting there.
Re:OCaml on Baremetal Shakti RISC-V Processor by cedricbonhomme on Friday March 29, 2019 @07:29PM (#19526476)
It's even great to draw nice fractals: https://github.com/cedricbonhomme/iterated-function-systems ;-)
Re:OCaml on Baremetal Shakti RISC-V Processor by pjmlp on Saturday March 30, 2019 @01:59AM (#19528023)
Not everything needs to be usable for a Web server. I also wouldn't use C or C++ for anything directly plugged into the network. Morris worm proved what happens 30 years ago.

Besides, there are also multiple processes as possible solution.

Re:OCaml on Baremetal Shakti RISC-V Processor by floatboth on Friday March 29, 2019 @01:40PM (#19523843)
Frama-C and Why3. Okay, maybe they're somewhat "language" projects since one is parsing C and another has its own language :)
Re:OCaml on Baremetal Shakti RISC-V Processor by baby on Friday March 29, 2019 @07:53PM (#19526591)
As someone who tried to get into it :

- the syntax is not great. I've heard it's one of the reasons why F# was born

- not many people use Ocaml, which makes it hard to find help

- not many good resources. The official documentation is really hard to parse and there isn't much besides it and the reference book (which reads more like a book than a reference).

- no good ways to debug, print objects, test, etc.

- no one seems to agree on what is the standard library or the correct packages to import (for example there are several Option package)

Re:OCaml on Baremetal Shakti RISC-V Processor by monocasa on Friday March 29, 2019 @11:53AM (#19522717)
A lot of thereom proving is done in Isabelle/HOL, a DSL in OCaml.
Re:OCaml on Baremetal Shakti RISC-V Processor by fspeech on Friday March 29, 2019 @12:11PM (#19522899)
Hol is in sml. HolLight is OCaml.