<d_bot_>
<sabas3dgh> Thanks. It shows some difference. Is there any other more advanced stuff that I can do/tweak to make it even more powerful.
<d_bot_>
<sabas3dgh> ❔
<d_bot_>
<sabas3dgh> Guys?! How should I create my project structure with *dune* to give me *•marlin* file.???
<d_bot_>
<sabas3dgh> another Q?
<d_bot_>
<sabas3dgh> Is the nature of ocaml compile the same as C/C++ or it is more like JIT?
<aitap>
https://stackoverflow.com/q/65609284 says I should either patch the types or use an older compiler. Never mind, I installed a pre-built older Unison until I can upgrade everything.
Haudegen has joined #ocaml
aitap has quit [Quit: Leaving]
<d_bot_>
<sarna> hey, does OOP's "program to interface, not implementation" have any equivalent in OCaml? do you use functors where you'd normally use interfaces? or do you just code to implementation and it's not a problem in practice?
<d_bot_>
<sarna> (excuse my ignorance, I'm really weak at modeling stuff in statically typed languages)
Serpent7776 has joined #ocaml
<d_bot_>
<orbitz> @sarna I would say in Ocaml that you often program against the explicit thing. But often you do it with minimizing the amount of knowledge you need to know so you can flip it out if you want. Functors are often used in explicit situations where you want to abstract over the implementation
<d_bot_>
<sarna> so like, "it's doable, but program against the implementation by default"?
<d_bot_>
<orbitz> IME, yes
<d_bot_>
<sarna> my main concern here is swapping implementation for some other when I don't control the calling code - how would you do that?
<d_bot_>
<orbitz> I think I'd have to see an explicit example. IME, the way a lot of OOP langauges does it where any call can go anywhere often does not match to how most code works. Most code is against a specific implementation.
<d_bot_>
<orbitz> But like you run into issues with this in Ocaml. Every 6 months or so there is a question in the mailing list "how do I make a file object out of a string" well,,, you can't
<d_bot_>
<sarna> hm, silly example but what if some function took a stdlib List and I needed it to take BespokeList because I need better performance?
<d_bot_>
<orbitz> List is not a function
<d_bot_>
<sarna> it's a type of the argument that this function takes
<d_bot_>
<sarna> and this function is in SomeLibrary
<d_bot_>
<orbitz> @sarna YOu're going to use a new function in that case, so you'll be rewriting your code
<d_bot_>
<sarna> well, other people's code :(
<d_bot_>
<orbitz> Yep
<d_bot_>
<sarna> I see, thanks for explaining
<d_bot_>
<orbitz> np
<d_bot_>
<orbitz> And I know that sounds crappy, but the "Program the interface" solution has issues too, so it's a give and take
mro has joined #ocaml
<d_bot_>
<sarna> yeah, but it's very nice when you consume libraries that were written in this manner
<d_bot_>
<orbitz> For example, in Java you can hav ea List value that is backed by an array or linked list and some code uses the `.get` method and for some reason the code sometimes really slow: it's because that interface doesn't really make sense for a linked list and it's really hard to see that this code is going to hav ea huge performance hit in those scenarios. So, give and take.
<d_bot_>
<sarna> aye, true
<d_bot_>
<orbitz> @sarna IME, this is not so much of an issue in Ocaml. Ocaml is, in general, quite fast so if you hit a performance bottleneck, it'll be a small piece of code that you want to control
<d_bot_>
<orbitz> but depends on your domain, of course
<d_bot_>
<orbitz> @sarna Also, IME, it's very rare to see code functorized over a data-type definition, and usually you functorize over a higher level concept, and maybe you change the data structure that higher level concept is implemented in.
<d_bot_>
<sarna> this performance example was just an example, another that comes to mind would be swapping a database driver
<d_bot_>
<sarna> but I think that would be functorized..
<d_bot_>
<orbitz> Possibly. In my code bases I create my own storage type that has the interface I want for storage, and then I put behidn it whatever I want, and everything in the app uses that explicit type, which means I can change it whenever I want, but only one storage class exists in the whole application at a time.
<d_bot_>
<sarna> yeah, that's what I meant
<d_bot_>
<sarna> so I guess it's a non-issue :)
<d_bot_>
<orbitz> Depends on how you look at software. I think if you're accustomed to being able to flip out implementations in a low-effort away, it might be an issue 🙂
<d_bot_>
<sarna> well IMO being able to swap stuff like this is very helpful, but it's not something that you do everyday
<d_bot_>
<orbitz> But again, it's a trade off. For example I work with Django quite a bit and it's incredibly flexible, but I struggle to determine what code is being called in production because of that flexibility. My ocaml projects are much less flexible but you know exactly what is running in production so goign from a production symptom to the bug in the code is, IME, more straight forward
<d_bot_>
<sarna> yeah haha, it's not fun when you know the interface but not sure what exactly gets called :D
<d_bot_>
<orbitz> @sarna Also, one way you can look at functors vs OOP-style dispatch tables is a functor lets you build an application out of components, so it's top-down in that sense. Whereas OOP lets you change implementation at the leaves, so it's bottom-op. So for something like the storage you wan to use, a functor might make sense.
<d_bot_>
<orbitz> You can also use first-class modules, which are basically objects
<d_bot_>
<orbitz> Or the actual objects that Ocaml has (although they tend to not be used)
<d_bot_>
<sarna> thanks for providing this perspective, I'm still like a little baby with OCaml modules and functors :))
<d_bot_>
<sabas3dgh> Could I write back end microservices that respond with JSON in OCaml?
<d_bot_>
<orbitz> sure
<d_bot_>
<sabas3dgh> Hi; I am even a step behind you. Whatare your reading materials? Please share👍
<d_bot_>
<sabas3dgh> What would be the tooling. Any libraries or frameworks for this task? Or Is it from scratch kinda deal❔
<d_bot_>
<orbitz> There are lots of frameworks. Dream is a popular one right now if you're making a webservice
<d_bot_>
<sabas3dgh> @mmatalka what else?
<d_bot_>
<orbitz> Eliom
<d_bot_>
<orbitz> you can make an HTTP server with Cohttp easily
<d_bot_>
<orbitz> or httpaf
<d_bot_>
<orbitz> Mirage probably has some things you can use here? But that's probably heavy for normal usage
<d_bot_>
<sabas3dgh> I was looking for ocaml and all of them are from 2012~2016.Are they worth anything in terms of actually teaching updated stuff in 2022?
<d_bot_>
<orbitz> what do you mean? Dream is quite new
<d_bot_>
<orbitz> ELiom is still updated. as is Cohttp
<d_bot_>
<orbitz> oh. I don't know about any books
<d_bot_>
<sabas3dgh> 📗
<d_bot_>
<orbitz> I just read the language spec ha
<d_bot_>
<orbitz> that is a weakness for Ocaml.
<d_bot_>
<sabas3dgh> Well. I guess I have to start from somewhere.
<d_bot_>
<orbitz> there is a thread in the discourse about some ocaml book free on pdf?
<d_bot_>
<sabas3dgh> If I want to write my code in **myproject** directory. I should make **src** and then put my could inside?
<d_bot_>
<sabas3dgh> If so where would •merlin file be located?
<d_bot_>
<darrenldl> thats often the preference
<d_bot_>
<darrenldl> .merlin file should be generated by dune(?) in _build directory
<d_bot_>
<sabas3dgh> Is there a command to make the accepted/universal directory structure from the get go?
<d_bot_>
<undu> you could put the code that forms a library in `/lib`, the code that build into a binary in `/bin`. Having a single directory for all the source code is not that useful, I've found
<d_bot_>
<darrenldl> #beginners would be better suited for posting code snippets
<d_bot_>
<sabas3dgh> So I just my project in lib dir?
<d_bot_>
<darrenldl> depends on whether you are making a library or binary
<d_bot_>
<sabas3dgh> Binary I guess. It is a web service
<d_bot_>
<darrenldl> then usually src or bin
<d_bot_>
<Alex01379> ok sorry
bartholin has joined #ocaml
<d_bot_>
<sabas3dgh> 👍
mro has quit [Remote host closed the connection]
bartholin has quit [Ping timeout: 256 seconds]
bartholin has joined #ocaml
bartholin has quit [Ping timeout: 272 seconds]
bartholin has joined #ocaml
<d_bot_>
<mseri> @aitap 2.48.3 requires ocaml 4.02. If you want to use a more recent ocaml version use 2.51.4 or 2.51.5. They are released in opam, you can install them with `opam install unison`
olle has joined #ocaml
spip has quit [Ping timeout: 256 seconds]
bobo has joined #ocaml
bartholin has quit [Ping timeout: 256 seconds]
bartholin has joined #ocaml
<d_bot_>
<morpheus> I’m trying to set up Merlin with ycm in vim. Is there anyway to make merlin’s error checking automatic? I try to set up g:ycm_language_server using the merlinserver binary, but I’m definitely doing something wrong …
<d_bot_>
<VPhantom> I don't know YCM, but with ALE I have interactivity with Merlin: warnings highlight the right areas of the editor, there's flags in the left gutter, etc.
mro has joined #ocaml
<d_bot_>
<morpheus> Did you have to do configuration with ALE?
<d_bot_>
<morpheus> YCM seems to integrate merlin's auto complete pretty well, however the error needs to be checked manually, also :MerlinConstruct bugs out :ablobdizzy:
gwizon has joined #ocaml
mro has quit [Ping timeout: 272 seconds]
hegz has joined #ocaml
dalek_caan has joined #ocaml
zebrag has joined #ocaml
<d_bot_>
<VPhantom> Yes I have a couple lines of OCaml-specific configuration for ALE. Let's see…
<d_bot_>
<VPhantom> I have an explicit specification of `ocamlformat` in the `ocaml` key of `g:ale_fixers` because I like to format on buffer save (and on demand). I also have `let g:ale_ocaml_ocamlformat_options = '--enable-outside-detected-project'` which I guess I needed somewhere. I have nothing about Merlin per se; I guess it was detected automatically.
<d_bot_>
<VPhantom> Note that if you `let g:ale_linters_explicit = 1` then you'll have to have an entry in `g:ale_linters` for OCaml.
<d_bot_>
<VPhantom> For tab completion I use `ervandew/supertab` which works 80-90% of the time.
<d_bot_>
<VPhantom> (I would dread having something pop-up without my explicitly asking for it, personally, so YCM is not an option for me.)
azimut has quit [Remote host closed the connection]
azimut has joined #ocaml
mro has joined #ocaml
bartholin has quit [Ping timeout: 240 seconds]
<d_bot_>
<morpheus> thx. I will check it out. I am gonna trying to switch from ycm to either ALE or coc, not just ocaml it was having so many problem with tsserver also
oriba has joined #ocaml
<d_bot_>
<VPhantom> There's several neat options in ALE. A couple nice things like `g:ale_sign_error` and `g:ale_sign_warning`, `g:ale_fix_on_save`. I also have custom `highlight` for `ALEErrorSign`, `ALEWarningSign`, `SpellBad` and `SpellCap` which were fun to figure out. 😉
bartholin has joined #ocaml
perrierjouet has joined #ocaml
mro has quit [Remote host closed the connection]
mro has joined #ocaml
mbuf has quit [Quit: Leaving]
mro has quit [Client Quit]
mro has joined #ocaml
dextaa_ has joined #ocaml
mro has quit [Remote host closed the connection]
mro has joined #ocaml
mro has quit [Remote host closed the connection]
mro has joined #ocaml
waleee has joined #ocaml
azimut has quit [Ping timeout: 240 seconds]
adanwan has quit [Ping timeout: 240 seconds]
wyrd has quit [Ping timeout: 240 seconds]
Anarchos has joined #ocaml
azimut has joined #ocaml
adanwan has joined #ocaml
wyrd has joined #ocaml
bartholin has quit [Ping timeout: 256 seconds]
bartholin has joined #ocaml
mro has quit [Remote host closed the connection]
rgrinberg has joined #ocaml
gwizon has quit [Ping timeout: 272 seconds]
Anarchos has quit [Ping timeout: 240 seconds]
Anarchos has joined #ocaml
hegz has quit [Ping timeout: 240 seconds]
hegz has joined #ocaml
hegz has quit [Read error: Connection reset by peer]
hegz has joined #ocaml
hegz has quit [Read error: Connection reset by peer]
hegz has joined #ocaml
adanwan has quit [Remote host closed the connection]
adanwan has joined #ocaml
epony has quit [Ping timeout: 240 seconds]
perrierjouet has quit [Quit: WeeChat 3.4]
rgrinberg has quit [Ping timeout: 260 seconds]
azimut has quit [Remote host closed the connection]
epony has joined #ocaml
azimut has joined #ocaml
dwt_ has quit [Ping timeout: 240 seconds]
dwt_ has joined #ocaml
jlrnick has joined #ocaml
bartholin has quit [Ping timeout: 240 seconds]
bartholin has joined #ocaml
random-jellyfish has joined #ocaml
Anarchos has quit [Quit: Vision[]: i've been blurred!]
random-jellyfish has quit [Ping timeout: 256 seconds]
perrierjouet has joined #ocaml
b0o has quit [Ping timeout: 250 seconds]
b0o has joined #ocaml
mro has joined #ocaml
rgrinberg has joined #ocaml
gravicappa has quit [Ping timeout: 256 seconds]
rgrinberg has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
dalek_caan has quit [Quit: dalek_caan]
szkl has joined #ocaml
dextaa_ has quit [Remote host closed the connection]
dextaa_ has joined #ocaml
olle has quit [Ping timeout: 256 seconds]
Anarchos has joined #ocaml
bartholin has quit [Ping timeout: 272 seconds]
mro has quit [Ping timeout: 256 seconds]
Anarchos has left #ocaml [#ocaml]
perrierjouet has quit [Quit: WeeChat 3.4]
perrierjouet has joined #ocaml
bartholin has joined #ocaml
jlrnick has quit [Ping timeout: 260 seconds]
random-jellyfish has joined #ocaml
rgrinberg has joined #ocaml
Tuplanolla has quit [Quit: Leaving.]
bartholin has quit [Quit: Leaving]
rgrinberg has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]