companion_cube changed the topic of #ocaml to: Discussion about the OCaml programming language | http://www.ocaml.org | OCaml 5.2.0 released: https://ocaml.org/releases/5.2.0 | Try OCaml in your browser: https://try.ocamlpro.com | Public channel logs at https://libera.irclog.whitequark.org/ocaml/
jabuxas has joined #ocaml
waleee has quit [Ping timeout: 260 seconds]
pi3ce has joined #ocaml
u0_a252 has joined #ocaml
u0_a2522 has joined #ocaml
u0_a252 has quit [Ping timeout: 240 seconds]
u0_a2522 has quit [Quit: WeeChat 4.3.1]
mbuf has joined #ocaml
jabuxas has quit [Ping timeout: 255 seconds]
kurfen has quit [Ping timeout: 268 seconds]
kurfen has joined #ocaml
ansiwen has quit [Quit: ZNC 1.7.1 - https://znc.in]
ansiwen has joined #ocaml
Serpent7776 has joined #ocaml
ansiwen has quit [Ping timeout: 256 seconds]
ansiwen has joined #ocaml
ansiwen has quit [Quit: ZNC 1.7.1 - https://znc.in]
gooby323 has joined #ocaml
ansiwen has joined #ocaml
bartholin has joined #ocaml
ansiwen has quit [Ping timeout: 246 seconds]
ansiwen has joined #ocaml
toastal has joined #ocaml
reynir has quit [Ping timeout: 272 seconds]
ansiwen has quit [Ping timeout: 268 seconds]
ansiwen has joined #ocaml
pi3ce_ has joined #ocaml
pi3ce has quit [Ping timeout: 268 seconds]
jabuxas has joined #ocaml
toastal has quit [Ping timeout: 256 seconds]
toastal has joined #ocaml
gooby323 has quit [Ping timeout: 255 seconds]
gooby323 has joined #ocaml
mro has joined #ocaml
YuGiOhJCJ has joined #ocaml
YuGiOhJCJ has quit [Quit: YuGiOhJCJ]
ansiwen_ has joined #ocaml
ansiwen has quit [Ping timeout: 264 seconds]
andrija has joined #ocaml
gooby323 has quit [Ping timeout: 268 seconds]
ansiwen_ has quit [Ping timeout: 264 seconds]
ansiwen has joined #ocaml
andrija is now known as gooby323
<discocaml> <lowlowcode_96272> Hello guys, Im struggling to use a file watcher in Ocaml any suggestions ? Fswatch doesnt works on debian, the package is broken...
h00man_bean has joined #ocaml
<discocaml> <aantron> I'm currently looking into using Cohttp in Dream. In case it helps planning or prioritizing the work
<discocaml> <aantron> Mainly because cohttp-eio itself has a direct-style API
<discocaml> <aantron> In how it reads and writes streams
trillion_exabyte has quit [Ping timeout: 268 seconds]
trillion_exabyte has joined #ocaml
waleee has joined #ocaml
h00man_bean has quit [Quit: Client closed]
mro has quit [Remote host closed the connection]
<discocaml> <lukstafi> Anyone using François Pottier's visitors? There's a few packages that depend on visitors, but not many. Anyone here having considered visitors decided against using them?
cr1901 has quit [Read error: Connection reset by peer]
cr1901_ has joined #ocaml
cr1901 has joined #ocaml
<discocaml> <otini_> Haven’t seen much content about them, but did you check this out? https://www.lexifi.com/blog/ocaml/dune-watch-mode-windows/# maybe the code is reusable
<gooby323> What's the point of visitors in a functional language x)
<companion_cube> sometimes visitors are convenient on large sum types (ASTs)
<discocaml> <lukstafi> Inheritance of default functionality.
<gooby323> companion_cube: to avoid manually matching you mean?
<companion_cube> yeah
cr1901_ has quit [Ping timeout: 246 seconds]
<companion_cube> especially, like @lukstafi says, in cases where you have default functionality on 90% of cases
<gooby323> Right fair enough
<companion_cube> e.g. a mapper that rebuilds a term as is, except for one case that you want to change
<discocaml> <otini_> is the AST mapper used in the compiler a visitor? It’s implemented with a record of functions and open recursion
<companion_cube> yeah
<companion_cube> it's just a hand-made visitor
<companion_cube> (AST mapper, AST iterator, etc. — I forget the exact name of the latter)
<gooby323> It's kinda like OOP recursion schemes in a sense x)
<discocaml> <lukstafi> Right, hand-made is an option, using classes from `@@deriving visitors` might not buy much.
alexherbo2 has joined #ocaml
<discocaml> <andreypopp> Handmade with copilot
cr1901 has quit [Ping timeout: 246 seconds]
<discocaml> <gooby_clown> Tbf, since the LSP has the `destruct` command, it could do the same but recurse on subterms as well
<discocaml> <lukstafi> Hand-made visitors example: slides 13-17 https://ii.uni.wroc.pl/~lukstafi/pmwiki/uploads/Functional/functional-lecture06.pdf
<discocaml> <lukstafi> The visitors package automates this (and more) but using classes.
alexherbo2 has quit [Remote host closed the connection]
<companion_cube> `visitors` seems nice, but it's another dep, yada yada
<companion_cube> my biggest qualm with fpottier's libraries is the absence of semver
<companion_cube> I kind of hate it
cr1901 has joined #ocaml
<discocaml> <lukstafi> 😅
gooby323 has quit [Ping timeout: 260 seconds]
<discocaml> <lukstafi> If we popularized `visitors`, they would become more familiar, which would make using them easier...
<discocaml> <lukstafi> They solve some issues where Haskell boasts it's better than OCaml.
<discocaml> <gooby_clown> Such as?
<discocaml> <lukstafi> Functions that are polymorphic wrt. data shapes, e.g. applicatives.
Tuplanolla has joined #ocaml
<discocaml> <otini_> Do you mean applicative functors? I fail to see how ocaml doesn’t have them (altough my mental model of an applicative functor is `'a option`, so I may be wrong)
<discocaml> <lukstafi> What `visitors` does, you can do in Haskell by some combination of type classes and kinds... E.g. you can write a function that collects strings from values of various ADT types.
<discocaml> <anmonteiro> Not really but thanks. There are a few production users outside Dream who’ve asked for releases
<companion_cube> can't represent Traversable at all, oh well
<discocaml> <lukstafi> and `Foldable`
jabuxas has quit [Ping timeout: 272 seconds]
<discocaml> <gooby_clown> If I'm understanding well, this would force us to either define our types as classes, or wrap our existing types in classes similarly to how we do with modules atm, no? I am not much of a fan of either options to be honest. This also kind of reminds me of F#, where each AST is a class underneath, so you can attach static methods and have a general operator look them up, mimicking higher kinded polymorphism in a sense
jabuxas has joined #ocaml
jabuxas has quit [Quit: oops :p]
jabuxas has joined #ocaml
mbuf has quit [Quit: Leaving]
<discocaml> <lukstafi> That's in response to my answer where I claim `visitors` can do these things (sort of, with a stretch) -- so the datatypes remain ADTs and records, but work is done at code generation time. So it's more in the C++ vein.
m5zs7k has quit [Ping timeout: 240 seconds]
m5zs7k has joined #ocaml
olle has joined #ocaml
<discocaml> <gabyfle> Hey, would you say that the super dope typing system in OCaml makes you weaker in other languages ?
<discocaml> <gabyfle> In my school we don't learn any OCaml and I'm focus on AI so I have lot of projects in Python
<discocaml> <gabyfle> The problem is that I love so much OCaml that all my personal projects are done with this language, and when I'm switching to Python, I end up debugging my algorithms so much more than in OCaml because of typing
<discocaml> <gabyfle> Usually, when I write an algorithm in OCaml and that the type checker pass, it works
<discocaml> <gabyfle> When writing in Python, my algorithm are super dumb and I pass much more time debugging them than writing them
<discocaml> <gabyfle> I'm wondering if relying to much on the strong typing is a good thing or not regarding to the logic wise. I've used Owl for some project (and I'm even building a very big one with owl), and even for machine learning or for dealing with NDarrays, I feel like when I'm doing this with OCaml its way more robust than in Python even tho I'm the same guy writing it (btw I'm not using any GPT to write my projects hehe, so the problem is really with my
<dh`> types are good
<dh`> the problem is the other languages being unsafe
<dh`> you will make roughly speaking the same mistakes, but in python you have to debug them at runtime
<discocaml> <Kali> you may be interested by some of the libraries dry-python makes https://github.com/dry-python
<dh`> it's definitely possible to become more sloppy, or conversely to specifically be more careful when writing in untyped languages
<discocaml> <Kali> in particular `returns` https://returns.readthedocs.io/en/latest/
<dh`> but the latter is also expensive and ultimately dynamically typed languages just aren't a winner
<dh`> of course, anyone here will tell you that, I'm sure you can find someone in #python or #scheme to tell you that static typing is a straitjacket
<discocaml> <Kali> dynamically typed languages have their place (easy serialization) but rarely is it much more than a really really annoying footgun when you're trying to anything other than that
<discocaml> <Kali> as much as i love lua it being dynamically typed meant that nil errors would take forever to find the source of and it was usually just something like forgetting to give an argument
<companion_cube> tbh "easy serialization" isn't even an argument now
<companion_cube> it's more "unchecked deserialization", it's not easier than serde and the likes
<discocaml> <Kali> yeah not if you have good derivers
gzar has joined #ocaml
toastal has left #ocaml [Error from remote client]
olle has quit [Ping timeout: 255 seconds]
olle has joined #ocaml
jabuxas has quit [Ping timeout: 256 seconds]
olle has quit [Ping timeout: 268 seconds]
Tuplanolla has quit [Quit: Leaving.]
bartholin has quit [Quit: Leaving]
olle has joined #ocaml
<discocaml> <limp.biskit> i actually quite like bits of javascript but every attempt to add a more concrete type system to that language makes it worse, yet working without one is like pulling teeth on a large codebase
<discocaml> <limp.biskit> the prototype system sucks, classes are weird and typescript working at all is an engineering miracle
<discocaml> <limp.biskit> i like ruby, but that has it's fair share of issues that make me not adopt it for large codebases
olle has quit [Ping timeout: 268 seconds]
Serpent7776 has quit [Ping timeout: 260 seconds]
m5zs7k has quit [Ping timeout: 268 seconds]
m5zs7k has joined #ocaml
jabuxas has joined #ocaml
<discocaml> <darrenldl> not much point in always restricting yourself to the low(est) denominator of the domain, cause otherwise what's the point of using ocaml/other language : v
<discocaml> <darrenldl>
<discocaml> <darrenldl> but yes i've found myself slow to a crawl in python, while typescript and c# are fine. dynamic typing + asinine name scoping rules makes python a really upsetting choice for me most of the time
<discocaml> <darrenldl> actually swap "otherwise what's the point of using ..." with just "what's the point"
<discocaml> <gabyfle> Damn, I'm not alone to find the name scoping in Python disturbing sometimes
<discocaml> <darrenldl> being only fluent in python does not make you a better python programmer, being pretty fluent in a few good languages makes you a better python programmer, not worse, if anything
<discocaml> <darrenldl> some colleague brought up python's import not being consistent depending on where you use it
<discocaml> <darrenldl> compared to ocaml's open and let open in which is the same wherever you use it
<discocaml> <limp.biskit> i really don’t like python and fail to understand why it endures and ruby doesn’t
<discocaml> <darrenldl> popularity of tools and languages is a lot of trial by circumstance and luck sadly : v
<discocaml> <limp.biskit> pythons tooling is horrific though
<discocaml> <darrenldl> yeah i hate python's domination likewise
<discocaml> <darrenldl> i will never not be amazed by super large code bases written in python, e.g. borgbackup, but i feel that's also the reason it's so slow in making any changes/overhaul/refactor
<discocaml> <limp.biskit> the fact pipx exists should be enough to want people to use npm or opam
<discocaml> <darrenldl> i still have zero clue which one i should use
<discocaml> <limp.biskit> i guess it’s probably lucky adoption. go has benefited from the same things, although that runtime and tooling is actually compelling
<discocaml> <darrenldl> oh yeah, python's "functional programming" facilities are also barely useful most of the time because of how few things facilitate that style
<discocaml> <limp.biskit> google is big (!)
<discocaml> <darrenldl> go also answers many modern day needs, e.g. green threads, low-level ish code
<discocaml> <limp.biskit> yeah, go’s runtime is excellent and beat most to the punch
<discocaml> <darrenldl> go also answers many modern day needs, e.g. green threads+multicore, low-level ish code
<discocaml> <limp.biskit> they’ll never have effects though 😉