Leonidas changed the topic of #ocaml to: Discussion about the OCaml programming language | http://www.ocaml.org | OCaml 5.1.1 released: https://ocaml.org/releases/5.1.1 | Try OCaml in your browser: https://try.ocamlpro.com | Public channel logs at https://libera.irclog.whitequark.org/ocaml/
Tuplanolla has quit [Quit: Leaving.]
jmcantrell has quit [Quit: WeeChat 4.2.1]
__jmcantrell__ has joined #ocaml
__jmcantrell__ is now known as jmcantrell
kaptch has joined #ocaml
kaptch has quit [Client Quit]
kaptch has joined #ocaml
kaptch has quit [Client Quit]
alexherbo2 has quit [Ping timeout: 250 seconds]
jmcantrell has quit [Quit: WeeChat 4.2.1]
__jmcantrell__ has joined #ocaml
__jmcantrell__ has quit [Quit: WeeChat 4.2.1]
__jmcantrell__ has joined #ocaml
__jmcantrell__ is now known as jmcantrell
rgrinberg has joined #ocaml
rgrinberg has quit [Ping timeout: 264 seconds]
rgrinberg has joined #ocaml
rgrinberg has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
jabuxas has joined #ocaml
<discocaml> <Et7f3 (@me on reply)> Hy
<discocaml> <Et7f3 (@me on reply)> We have a nix channel on the reason server (but we use it for ocaml/melange question also because it use the same stack)
rwmjones_ has quit [Ping timeout: 260 seconds]
rwmjones_ has joined #ocaml
rgrinberg has joined #ocaml
rgrinberg has quit [Ping timeout: 272 seconds]
jabuxas has quit [Ping timeout: 264 seconds]
<discocaml> <mbacarella> Good news! The White House just implicitly endorsed OCaml
<discocaml> <Kali> so true
<discocaml> <idontwantausernamefeckoff> i’m waiting for the white house to endorse memory unsafety
<companion_cube> maybe next white house
<discocaml> <metallynx> memory danger
<discocaml> <idontwantausernamefeckoff> executive order to bring back strcpy
<discocaml> <metallynx> yes!
<discocaml> <idontwantausernamefeckoff> endorsing memory safety doesn’t mean type safety. they could be converting all government software to unlinted javascript
rgrinberg has joined #ocaml
rgrinberg has quit [Ping timeout: 272 seconds]
rgrinberg has joined #ocaml
rgrinberg has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
szkl has quit [Quit: Connection closed for inactivity]
azimut has quit [Ping timeout: 255 seconds]
rgrinberg has joined #ocaml
<toastal> mdupont: I’m awake now :)
mbuf has joined #ocaml
azimut has joined #ocaml
pi3ce has joined #ocaml
azimut has quit [Ping timeout: 255 seconds]
bartholin has joined #ocaml
rgrinberg has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
Serpent7776 has joined #ocaml
jmcantrell has quit [Ping timeout: 255 seconds]
__jmcantrell__ has joined #ocaml
<discocaml> <reynir> fwiw I think he doesn't use opam himself
waleee has quit [Ping timeout: 240 seconds]
waleee has joined #ocaml
rgrinberg has joined #ocaml
rgrinberg has quit [Ping timeout: 256 seconds]
__jmcantrell__ is now known as jmcantrell
rgrinberg has joined #ocaml
<discocaml> <bluddy5> It's also an endorsement of Rust
torretto_ has quit [*.net *.split]
jmcantrell has quit [Quit: WeeChat 4.2.1]
__jmcantrell__ has joined #ocaml
rgrinberg has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
__jmcantrell__ has quit [Quit: WeeChat 4.2.1]
__jmcantrell__ has joined #ocaml
__jmcantrell__ is now known as jmcantrell
jmcantrell has quit [Quit: WeeChat 4.2.1]
waleee has quit [Ping timeout: 264 seconds]
fweht has joined #ocaml
<darchitect> clear; dune build; dune exec $(basename $PWD)
darchitect has quit [Quit: WeeChat 4.1.1]
rgrinberg has joined #ocaml
pi3ce has quit [Quit: No Ping reply in 180 seconds.]
pi3ce has joined #ocaml
neiluj has joined #ocaml
neiluj has quit [Client Quit]
neiluj has joined #ocaml
bibi_ has joined #ocaml
neiluj has quit [Quit: Konversation terminated!]
a51 has joined #ocaml
Square2 has joined #ocaml
rgrinberg has quit [Ping timeout: 272 seconds]
neiluj has joined #ocaml
<discocaml> <idontwantausernamefeckoff> huh interesting
<discocaml> <idontwantausernamefeckoff> it all works fine pinned but it’s still a bit of a hassle. i found an issue and apparently uploading it under a different name would break things
<discocaml> <dinosaure> you can not link two module together with the same name
<discocaml> <dinosaure> that's the initial issue where implementations differ but you must choose one of these implementations
<discocaml> <dinosaure> then, `httpaf` from inhabitedtype was the first to come
<discocaml> <dinosaure> (however it's possible to fork a use another name and publish it on opam, I mean the license permits that)
jabuxas has joined #ocaml
<discocaml> <idontwantausernamefeckoff> https://github.com/anmonteiro/httpaf/issues/33
dnh has joined #ocaml
darchitect has joined #ocaml
dnh has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
dnh has joined #ocaml
<discocaml> <fab5581> How come languages like rust or go are fully compatible on windows from day one and OCaml still isn't?
<darchitect> hey guys, is there any feature in Merlin or Emacs for OCaml I can use for generating all necessary functions with their appropriate number of params and a body of 'failwith "unimplemented"' or something ?
<darchitect> I want to be able to say module T : A = struct (and at this point press some key to generate everything required for B to be an implementation of A)
darchitect has quit [Quit: WeeChat 3.8]
darchitect has joined #ocaml
<discocaml> <deepspacejohn> isn't OCaml itself compatible with Windows? It's just that OPAM and a lot of the ecosystem isn't.
<discocaml> <octachron> OCaml 4 is; OCaml 5 had the problem that MSVC was either missing support for C11 atomics, or having a bugged implementation until very recently.
<discocaml> <octachron> (where very recently is apparently the 14 February this year)
darchitect has quit [Quit: WeeChat 3.8]
darchitect has joined #ocaml
azimut has joined #ocaml
torretto has joined #ocaml
jabuxas has quit [Quit: oops :p]
<discocaml> <bluddy5> They prioritized it early on, and had the massive resources to keep compatibility between the OSs.
jabuxas has joined #ocaml
jabuxas has quit [Client Quit]
jabuxas has joined #ocaml
<discocaml> <mbacarella> is there a figure re: how much money mozilla foundation has poured into rust?
dhil has joined #ocaml
<discocaml> <bluddy5> It's not just them. Rust has been picked up at this point by many large companies.
szkl has joined #ocaml
<discocaml> <Et7f3 (@me on reply)> The compiler is the ecosystem isn't
<companion_cube> mozilla is not a main backer of rust at this point
<discocaml> <mbacarella> still, if mozilla spent $10-25 million to push rust through the door that's a fairly huge advantage
<companion_cube> that seems like a lot.
<companion_cube> I mean, mozilla engineers aren't cheap indeed. The servo team was probably quite expensive, but they were not working _on_ rust proper
<discocaml> <mbacarella> not implausible. they've made $500m/year for at least a decade
<companion_cube> true
<companion_cube> at this point OCaml also has had significant personpower over the years, tbh
<discocaml> <mbacarella> sure, but a lot less coordinated i suppose
<companion_cube> maybe. I don't think Rust has had a lot more reach than OCaml just because it got more money, really.
<companion_cube> it's not that simple :p
<discocaml> <mbacarella> firefox needs to run on windows so they made rust run on windows. everyone else thinks windows is kinda a drag and builds yet another async io library instead
<companion_cube> Rust is the first language in a long time to enter a very specific niche and with truly new features
<discocaml> <mbacarella> (not to pick on async io libraries it's just a fun current example)
<discocaml> <bluddy5> yep. Rust is the first language to dethrone c++
<companion_cube> sure, rust's stdlib tried to be compatible with windows from the start
<companion_cube> and it's a tastefully done stdlib, too
<discocaml> <bluddy5> the design had to be good enough to attract money. Now the money and attention is there.
<discocaml> <mbacarella> yeah i'm not saying rust doesn't have its merits, but if one reclusive nocturnal anime shut-in guy produced rust and threw it on github it'd probably have been ignored
<companion_cube> oh sure, now Rust is seeing tons of attention
<companion_cube> ofc, but it's not like they gave money to Graydon from day 1
<companion_cube> he worked on it for a long time, and only then did mozilla show some interest (as they were interested in replacing some C++)
<companion_cube> and then, between, say, 2015 and 2020, Rust's growth was mostly because of fans, not big companies
<discocaml> <mbacarella> ok, so, plan: infiltrate mozilla org, make them rewrite huge parts of their infra in ocaml
average has joined #ocaml
<companion_cube> you might want to pick a less dysfunctional org :/
waleee has joined #ocaml
<discocaml> <mbacarella> candidates?
rgrinberg has joined #ocaml
<companion_cube> nobody cares :D
<companion_cube> I mean, JST
<zozozo> I don't think JST cares about windows tbh
<companion_cube> indeed not
<companion_cube> but imho OCaml isn't really good to deploy a binary on users' machines, at this point
<discocaml> <idontwantausernamefeckoff> i’m hoping opam 2.2 will improve things
<discocaml> <idontwantausernamefeckoff> i haven’t tried to build for windows in a while
<companion_cube> the problem is also the Unix module, a lot of it doesn't really work on windows
<discocaml> <idontwantausernamefeckoff> well it is in the name
<companion_cube> Rust has a kind of portable IO/subprocess/threads layer, and then some modules that are (say) linux specific
<discocaml> <idontwantausernamefeckoff> jk
<discocaml> <idontwantausernamefeckoff> rusts done that for a lot of things
<octachron> ? that's a strange statement, taking in account that there is some moderately widely deployed OCaml binaries like unison, zero-install, the xen client
<discocaml> <idontwantausernamefeckoff> it’s so easy to do multi platform guis in rust because they wrote their own libraries and renderers
<companion_cube> octachron: and it's somewhat painful
<companion_cube> granted, even Rust is more painful than Go in this regard
<discocaml> <idontwantausernamefeckoff> surprisingly it’s really easy to compile a static binary with dune
<companion_cube> unless you have C dependencies
<discocaml> <idontwantausernamefeckoff> yeah that’s true
<companion_cube> (I mean I assume you mean using a musl switch, anyway?)
<discocaml> <idontwantausernamefeckoff> i’ve only tried with libcurl and that links nicely, can’t imagine trying with say gtk
Serpent7776 has quit [Ping timeout: 264 seconds]
<companion_cube> octachron: I don't mean to ignore the work of OCaml's maintainers, the team is great
<octachron> Well, if you are not Google, deciding to rewrite syscall bindings is a quite daring decision.
<companion_cube> but some choices were made decades ago, and it's just what we have to live with
<octachron> I don't disagree with the "somewhat painful", my impression is that it is unfortunately the default state without a lot of works
<companion_cube> it's also harder if you don't make the right choices from the start
<companion_cube> and in 1990, clearly, things were different! that's understandable
<octachron> Considering how painful binary signing can be on the Apple side (or the wild change to the linker); or the state of C/C++ libraries packaging on Windows.
<companion_cube> that's fair, but even writing _code_ that would work ok on windows is hard
<companion_cube> I complain a lot about OCaml because I use it a lot (see the Stroustrup quote) :-)
<companion_cube> although sometimes some choices do drive me nuts
<discocaml> <mbacarella> i've never met anyone who actually uses unison, and that includes people who used to work on it
<discocaml> <mbacarella> anyway
<companion_cube> I tried it a long time ago, and it was really kneecaped by its use of Marshal
<companion_cube> (which I think is now fixed, btw)
<discocaml> <mbacarella> but you just use rsync instead right
<companion_cube> rsync, git, restic, synmcthing
<companion_cube> -m
<discocaml> <mbacarella> yeah
<discocaml> <idontwantausernamefeckoff> go does things easier because it’s fundamentally not got a lot to do with C
<discocaml> <dinosaure> or bob.com :p (and it works on Windows, you just need to trust me)
<companion_cube> Go people try very hard to avoid C
<discocaml> <idontwantausernamefeckoff> with good reason
<companion_cube> that said they also have some shortcomings too: https://fasterthanli.me/articles/i-want-off-mr-golangs-wild-ride
<companion_cube> nah, some C libraries are just good
<discocaml> <idontwantausernamefeckoff> the ABI doesn’t line up you have to translate everything in and out of C land
<companion_cube> I don't want to reinvent GMP, curl, sqlite
<discocaml> <idontwantausernamefeckoff> i didn’t mean that, go would be a better language if i could use curl in it
<discocaml> <idontwantausernamefeckoff> i mean the design of the language makes it impractical
<companion_cube> ah yes, indeed
<discocaml> <idontwantausernamefeckoff> but yeah go is deeply flawed and i’m slowly porting a lot of my go code to ocaml
<companion_cube> people have even ported sqlite to go apparently
<discocaml> <idontwantausernamefeckoff> people will rewrite anything to go. even if the performance characteristics mean they could’ve just used tokio and got the same results in less time
<discocaml> <mbacarella> the number of times a week i accidentally enable some accessibility feature because i held a key too long is too damn high
<discocaml> <mbacarella> good thing there's an H100 GPU standing by at OpenAI to help me figure it out
<discocaml> <idontwantausernamefeckoff> go was designed without anything that google didn’t use. but if i wanted to code like google i would hire 3000 people and laugh while they write exception free c++ and ten different languages nobody is ever going to use, then can the entire product anyway
mbuf has quit [Quit: Leaving]
<discocaml> <mbacarella> obligatory: my understanding is they use C++ because hurling developer bodies at the problem is significantly cheaper than the cost of computation of higher-level languages across all of their datacenters
<companion_cube> someone I know also showed me some kotlin (they moved from OCaml to kotlin at work)
<companion_cube> and damn am I jealous of what the JVM offers
<discocaml> <mbacarella> so, even things that already existed and mature were rewritten in C++ if they were written in Java
<discocaml> <mbacarella> so, even things that already existed and mature and had no ongoing maintenance issues were rewritten in C++ if they were written in Java
<discocaml> <idontwantausernamefeckoff> people keep inventing really cool runtimes and running java on them.
<companion_cube> (or kotlin)
<discocaml> <idontwantausernamefeckoff> the way google writes a lot of code reminds me of game devs
<discocaml> <mbacarella> rust is kind of a drag though? once you ascend above a "small" codebase the compilation times for a release build take *forever*
<discocaml> <idontwantausernamefeckoff> highly boring code because that’s where the performance and libraries are
<discocaml> <mbacarella> nobody can resist doing the single-thread link time optimization pass
<discocaml> <idontwantausernamefeckoff> game dev is the only other place i can think of where strict exception less c++ is very common
<discocaml> <mbacarella> my guess is it's also common in some quant trading shops
<discocaml> <idontwantausernamefeckoff> probably
<discocaml> <idontwantausernamefeckoff> personally after writing go for a bit i tend to lean maximalist with my language choice
<discocaml> <idontwantausernamefeckoff> weird and elegant and hope the compiler makes it fast
<discocaml> <idontwantausernamefeckoff> i think rust is eating into the boring languages though. it’s syntax and tooling is definitely better than c++ and it’s what i would use if i had to write really really perf critical code
<discocaml> <mbacarella> it's also common in embedded shops still isn't it. the kind you don't want to work in as a software engineer because they're following hardware company economics rather than plush SV economics
<discocaml> <idontwantausernamefeckoff> rust is doing some cool things in embedded!
<discocaml> <idontwantausernamefeckoff> honestly when i look at all the use cases for c++ i’m shocked nobody wrote rust earlier
<companion_cube> wasn't easy to get it all together, I guess
<companion_cube> (and I'd also pick rust for high performance softwarE)
<discocaml> <idontwantausernamefeckoff> yeah
<discocaml> <idontwantausernamefeckoff> easier to add features and libraries to c++ than start from scratch and hope it pays off
<discocaml> <mbacarella> well, that's because writing the rust proof of concept was contingent on ocaml being ready enough for prime time 🧐
<companion_cube> 😁
rgrinberg has quit [Ping timeout: 255 seconds]
<discocaml> <mbacarella> #law-of-accelerating-returns #kurzweil
<companion_cube> #ugh
waleee has quit [Ping timeout: 264 seconds]
<discocaml> <mbacarella> i'm coming around to the rather trivial idea that ocaml is excellent if you have a 10,000+ line program because you can go right into any part of it and make changes and not be paralyzed with fear due to functional by default, strong types, etc. it's not necessarily an edge for compilers because it was designed for compilers, so much that compilers are just one of those kinds of applications that tend to be 10,000+ lines per stage.
<discocaml> <mbacarella> on the other hand, the community of Lesser Languages just kinda solve this problem by keeping the units small and enforcing process boundaries and doiung microservices for everyting
<companion_cube> I agree, refactoring in OCaml is great, even at scale
<companion_cube> (well, "at scale" for me is in the 50k~100k range, haven't gone above)
<dh`> all of that's a property of types, not of being functional
<dh`> being functional just means inadequate type tools for handling state :-)
darchitect has quit [Ping timeout: 272 seconds]
gentauro has quit [Read error: Connection reset by peer]
gentauro has joined #ocaml
<neiluj> yeah, always feel guilty when performing inplace operations that don't show up in the types (they return unit)
neiluj has quit [Remote host closed the connection]
neiluj has joined #ocaml
<companion_cube> dh`: it's a mix of both
<companion_cube> immutable values are easier to reason about
<discocaml> <lukstafi> Holy Moly. I'm doing `Bigarray.blit` and the effect is only visible after a while. I don't think that's possible. (Existential crisis: typical state of a programmer.)
<discocaml> <lukstafi> Ah. I wasn't synchronizing the worker. All good.
<discocaml> <idontwantausernamefeckoff> using mutable arrays does make me feel a bit dirty
rgrinberg has joined #ocaml
jabuxas has quit [Quit: oops :p]
jabuxas has joined #ocaml
darchitect has joined #ocaml
Square2 has quit [Ping timeout: 246 seconds]
<discocaml> <scarfyoid> Hello ! I'm a new computer science student doing ocaml on my first year. I really like what I've seen of the language and thought this would be a good place to go ^^
neiluj has quit [Quit: Konversation terminated!]
<discocaml> <coollcat> Is OCaml your first language? Haven’t met many people who do functional programming so early 🤔
<discocaml> <idontwantausernamefeckoff> computer science student doesnt necessarily mean early
<discocaml> <scarfyoid> My school makes people who never programmed before do java and the rest do java plus ocaml
<discocaml> <idontwantausernamefeckoff> its far from my first language and the only cs course ive ever taken is a year of java game design to not get kicked out of school
<discocaml> <scarfyoid> I haven't made any big project yet
neiluj has joined #ocaml
rgrinberg has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
pi3ce has quit [Quit: No Ping reply in 180 seconds.]
pi3ce has joined #ocaml
jabuxas has quit [Ping timeout: 272 seconds]
waleee has joined #ocaml
dnh has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
jabuxas has joined #ocaml
dnh has joined #ocaml
rgrinberg has joined #ocaml
dhil has quit [Quit: Leaving]
jabuxas has quit [Remote host closed the connection]
dnh has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<discocaml> <idontwantausernamefeckoff> what’s the time complexity of array.append
<discocaml> <octachron> Sum of lengths of both arrays.
<discocaml> <idontwantausernamefeckoff> thanks!
<discocaml> <Kali> my second language was ocaml, after lua
torretto has quit [Remote host closed the connection]
torretto has joined #ocaml
<discocaml> <idontwantausernamefeckoff> how did that happen
dnh has joined #ocaml
<dh`> companion_cube: until you start going through contortions to try to pretend you don't have state when you actually do
<dh`> it's a lot easier to reason about a module with encapsulated global state, for example, than threading your global state through everywhere with a monad
<dh`> and you can certainly have modules with encapsulated global state in ocaml; there just aren't a lot of tools for handling them
<dh`> (e.g. session types)
<dh`> not that most other languages have these either
<companion_cube> oh I mean, if you have 95% immutable and a few mutable things around it can be easier
<companion_cube> e.g. I have relatively complex immutable state and a `Immlock.t` around it
<companion_cube> this way I can easily get a snapshot to read it, or update the whole thing atomically
<dh`> ...at the cost of copying it when you might otherwise not need to
<dh`> and what if it contains inherently mutable things like say socket connections? :-)
<dh`> writing your code so you can reason about it is great but immutability isn't a magic bullet
<discocaml> <Kali> ada: other than my father teaching me a few basic programming concepts in C when i was about 10, and a bit of dabbling in python, i essentially learned to program by myself on PICO-8 (which uses lua), and after using lua for a couple of years, and becoming increasingly interested in functional programming, i found ocaml by it being mentioned on the rust wikipedia page and it attracted me partially through its syntax (as haskell syntax thoroughly
<companion_cube> dh`: persistent structures are there to reduce the amount of copying
<discocaml> <idontwantausernamefeckoff> ah cool
<companion_cube> it's not exactly as fast but it can be worth it if you have a lot of concurrency
<dh`> anyway I wasn't intending to start a religious war, only point out that types are a much more important factor
<companion_cube> why not both??
<dh`> well, partly because you don't get to choose the bad decisions other people make that leads you to have to rework their code :-)
<dh`> s/leads/lead/
<companion_cube> that's also true with types though
<companion_cube> you might have bad code with `string list option * (int * string) list` or stuff like that
<companion_cube> "just use types ffs"
<dh`> yeah but it's easier to sell juniors on types than it is to teach them how to structure code well
<dh`> you can change string list option * (int * string) list reasonably safely
<dh`> unlike the python equivalent
bibi_ has quit [Quit: Konversation terminated!]
<discocaml> <idontwantausernamefeckoff> iirc i started learning ocaml because i wanted a fast, strongly typed language with good concurrency that wasn't fully imperative or java-style objects
<discocaml> <idontwantausernamefeckoff> and wasn't something like rust where i would have to engage directly with memory management and the like (which i think is just extra complexity for web development)
marc_ has joined #ocaml
marc_ is now known as mccd
bartholin has quit [Quit: Leaving]
<dh`> I have been using ocaml because I write a lot of compiler code and you want a language with working sum types
<dh`> these days that does include rust but rust seems to have a lot of other disads
<discocaml> <lroche> Does someone know what’s the status of Merlin for metaocaml? If it’s supposed to work, is there a need for any kind of tweaks?
mccd has quit [Ping timeout: 246 seconds]
omegatron has quit [Quit: Power is a curious thing. It can be contained, hidden, locked away, and yet it always breaks free.]
Square2 has joined #ocaml
<discocaml> <tatsou0524> Is OCaml a better option compared to Go or Ruby?
dnh has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
Tuplanolla has joined #ocaml
<neiluj> define "better option" :)
neiluj has quit [Quit: Konversation terminated!]
<discocaml> <froyo> yes
<discocaml> <froyo> no
<discocaml> <froyo> maybe
<discocaml> <Kali> `Some Better : better option`
<discocaml> <coollcat> Isn’t that subjective 😛
<discocaml> <coollcat> Or use case dependent
<discocaml> <idontwantausernamefeckoff> go and ruby don’t do the same thing at all
<discocaml> <idontwantausernamefeckoff> i like ocaml more than go. but i still write plenty of ruby
jabuxas has joined #ocaml
jabuxas has quit [Ping timeout: 240 seconds]
rgrinberg has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
jabuxas has joined #ocaml
rgrinberg has joined #ocaml
rgrinberg has quit [Client Quit]