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/
germ has quit [Read error: Connection reset by peer]
germ has joined #ocaml
eilvelia has quit [Ping timeout: 245 seconds]
eilvelia has joined #ocaml
<discocaml> <empyreanx> Hey all! I'm new to OCaml. I'm several chapter into Real World OCaml and I'm really enjoying this language.
<discocaml> <empyreanx> Hey all! I'm new to OCaml. I'm several chapters into Real World OCaml and I'm really enjoying this language.
<discocaml> <empyreanx> It's a real breath of fresh air from procedural and OOP languages.
<discocaml> <empyreanx> It's a real breath of fresh air from procedural and OOP languages I've used for so long.
<discocaml> <empyreanx> It's a real breath of fresh air from the procedural and OOP languages I've used for so long.
chrisz has quit [Ping timeout: 252 seconds]
chrisz has joined #ocaml
noddy has quit [Quit: WeeChat 4.5.1]
noddy has joined #ocaml
LainIwakura has quit [Quit: Client closed]
LainIwakura has joined #ocaml
polykernel has quit [Remote host closed the connection]
polykernel has joined #ocaml
LainIwakura has quit [Quit: Client closed]
YuGiOhJCJ has quit [Quit: YuGiOhJCJ]
Serpent7776 has joined #ocaml
domq has joined #ocaml
hannes has joined #ocaml
bartholin has joined #ocaml
Haudegen has joined #ocaml
domq has quit [Quit: domq]
domq has joined #ocaml
alexherbo2 has joined #ocaml
bartholin has quit [Quit: Leaving]
domq has quit [Quit: domq]
domq has joined #ocaml
alexherbo2 has quit [Remote host closed the connection]
alexherbo2 has joined #ocaml
dhil has joined #ocaml
<discocaml> <barconstruction> Suit yourself. I exclusively write procedural and OOP OCaml.
<discocaml> <barconstruction> My main critique of OCaml is that I think anonymous functions should only be permitted to be one line long like in Python. If a function is more than one line, it's worth pulling it out and giving it its own name.
<discocaml> <lukstafi> Only if you sarcrifice your for loop bodies too.
jonludlam has joined #ocaml
alexherbo2 has quit [Remote host closed the connection]
alexherbo2 has joined #ocaml
alexherbo2 has quit [Remote host closed the connection]
<discocaml> <lukstafi> In a DEI language like OCaml, there should be no preferential treatment for loop bodies.
alexherbo2 has joined #ocaml
<discocaml> <barconstruction> For loops are a classic example of language bloat from people demanding features from other languages. It's just a while loop with syntax sugar
alexherbo2 has quit [Remote host closed the connection]
<discocaml> <lukstafi> Are your while loop bodies one liners? (or two liners inclusive of a loop invariant related state update)
alexherbo2 has joined #ocaml
myrkraverk_ has joined #ocaml
myrkraverk has quit [Ping timeout: 248 seconds]
<discocaml> <barconstruction> That's a good point. I'd have to make special exceptions for functions that return a unit. I don't see this as being a big restriction though as the function can just return its output by mutating a `ref` passed to it as input.
myrkraverk has joined #ocaml
myrkraverk_ has quit [Ping timeout: 265 seconds]
domq has quit [Quit: domq]
myrkraverk_ has joined #ocaml
myrkraverk has quit [Ping timeout: 252 seconds]
alexherbo2 has quit [Remote host closed the connection]
alexherbo2 has joined #ocaml
alexherbo2 has quit [Remote host closed the connection]
alexherbo2 has joined #ocaml
alexherbo2 has quit [Remote host closed the connection]
wbooze has quit [Quit: Leaving]
<discocaml> <gabyfle> When allocating a bigarray with `caml_ba_alloc(type_flag | CAML_BA_C_LAYOUT, ndims, NULL, dims)`, is the memory initialized or not ?
domq has joined #ocaml
domq has quit [Client Quit]
wbooze has joined #ocaml
domq has joined #ocaml
domq has quit [Client Quit]
LainIwakura has joined #ocaml
LainIwakura has quit [Client Quit]
LainIwakura has joined #ocaml
LainIwakura has quit [Client Quit]
jonludlam has quit [Remote host closed the connection]
LainIwakura has joined #ocaml
Fardale has quit [Quit: WeeChat 3.8]
Haudegen has quit [Quit: Bin weg.]
<discocaml> <mm3315> I like sweet language
<discocaml> <._null._> while loops are just sugar for recursive argument-less functions
<companion_cube> @barconstruction that would kill `let*` and friends
<companion_cube> and no, while loops are not sugar in practice
<discocaml> <._null._> Are such functions not alwyas inlined ?
<discocaml> <._null._> always*
Fardale has joined #ocaml
myrkraverk has joined #ocaml
<discocaml> <._null._> (Am I right that this is the only difference between the two approaches ?)
myrkraverk_ has quit [Ping timeout: 260 seconds]
<companion_cube> let* may or may not be inlined, there's no rule
mange has quit [Remote host closed the connection]
chiselfuse has quit [Remote host closed the connection]
chiselfuse has joined #ocaml
<discocaml> <ix80h> hiiiiii!
<discocaml> <ix80h> how do i run my program easily like am trying to do dune exec ./main.exe and all but it aint work
<discocaml> <otini_> you’ll need to be more specific about the error
<discocaml> <otini_> you’re going to need to be more specific about the error
<discocaml> <ix80h> i fixed it
<discocaml> <ix80h> i had a questrion to ask
<discocaml> <otini_> yes?
Haudegen has joined #ocaml
LainIwakura has quit [Quit: Client closed]
<discocaml> <ix80h> whih build system do u all use , recommend and is the easiet
<discocaml> <ix80h> dune isnt the easiest imo
<discocaml> <mm3315> interpreter have minimum initial cost
<discocaml> <ix80h> wdym?
LainIwakura has joined #ocaml
<discocaml> <mm3315> the easiest option for building a project is dune (after you write all dune files)
<discocaml> <mm3315> but if you don't want to do that for now yeah you can just use only the compiler like you already did
<discocaml> <mm3315>
<discocaml> <mm3315> however interpreters gives you simpler cycle
<discocaml> <mm3315> sorry you didn't say you didn't use dune but anyway
<discocaml> <ix80h> i will make a wrapper around dune ig
<discocaml> <ix80h> to make my life easy
<discocaml> <._null._> Once dune is set up, it's not difficult to work with
<discocaml> <mm3315> wrapper around dune sounds weird
<discocaml> <mm3315> you may want use ocaml compiler directly.
<discocaml> <mm3315> with some shell scripts
<discocaml> <mm3315> this may help you
euphores has quit [Quit: Leaving.]
euphores has joined #ocaml
wbooze has quit [Read error: Connection reset by peer]
wbooze has joined #ocaml
itszor has joined #ocaml
zor has quit [Ping timeout: 252 seconds]
Haudegen has quit [Quit: Bin weg.]
LainIwakura has quit [Quit: Client closed]
CalimeroTeknik has quit [Changing host]
CalimeroTeknik has joined #ocaml
Serpent7776 has quit [Ping timeout: 265 seconds]
cr1901 has quit [Read error: Connection reset by peer]
cr1901 has joined #ocaml
LainIwakura has joined #ocaml
myrkraverk_ has joined #ocaml
LainIwakura has quit [Ping timeout: 240 seconds]
myrkraverk has quit [Ping timeout: 244 seconds]
LainIwakura has joined #ocaml
Haudegen has joined #ocaml
alexherbo2 has joined #ocaml
LainIwakura has quit [Ping timeout: 240 seconds]
bartholin has joined #ocaml
LainIwakura has joined #ocaml
alexherbo2 has quit [Remote host closed the connection]
alexherbo2 has joined #ocaml
Serpent7776 has joined #ocaml
alexherbo2 has quit [Remote host closed the connection]
alexherbo2 has joined #ocaml
<discocaml> <dubious245> I was not impressed with dune either at first. But now thats it working I dont really need to touch it and its pretty clear how to change it.
<discocaml> <dubious245> I will probably have more dune related questions in the future but for right now my basic loop of write, build, test, run its going fine for.
<discocaml> <dubious245> But yeah lots of dune questions initially and the web resources are terrible.
<discocaml> <dubious245>
<discocaml> <dubious245> Better than make/cmake.
<discocaml> <dubious245> But yeah lots of dune questions initially and the web resources are terrible.
<discocaml> <dubious245>
<discocaml> <dubious245> It is better than make/cmake.
<discocaml> <yawaramin> i think they are open to suggestions on how to improve
<discocaml> <dubious245> I dont know how to improve it unfortunately. :catshrug: I cant go back and remember what my bad assumptions were that lead me to struggle with it.
<discocaml> <yawaramin> but you must have some reasons for thinking it's bad?
<discocaml> <dubious245> Yes the examples that show up when you first google it are bad and dont explain what I want to do.
<discocaml> <yawaramin> i think that can be expressed as a suggestion for how to improve and filed as an issue
<discocaml> <dubious245> Where do you even suggest something like that?
<discocaml> <yawaramin> on their documentation issue tracker which is linked from their docs
<discocaml> <yawaramin> but also, Googling is not always the best strategy for learning something new. might be better to read the docs
<discocaml> <dubious245> Google brought ne to their docs though?
<discocaml> <dubious245> Google brought me to their docs though?
<discocaml> <yawaramin> i mean 'examples that show up when you first Google it' might not be the best place to jump in. might be better to start in the Getting Started section
<discocaml> <dubious245> The getting started section is also not very good. One second let me finish my sandwich I'll go show you what I mean.
<discocaml> <yawaramin> you don't necessarily need to show me, i'm just saying you probably can file an issue with constructive feedback if you have some criticism
<discocaml> <tornato> i honestly don't get what is so bad about dune, sure its a bit annoying having to include a dune file everywhere but meh, its fast and it does the job
<discocaml> <deepspacejohn> This would be where you could file an issue, just FYI https://github.com/ocaml/dune/issues
<discocaml> <dubious245> Generally the issues comes whenever you want to do something more complicated than a simple build and test loop.
<discocaml> <dubious245>
<discocaml> <dubious245> Its not obvious how to include files for the test script. Its not obvious how to redirect files from a test to a different folder. You got to look this up and its not even clear where to start and how to do it.
<discocaml> <dubious245>
<discocaml> <dubious245> Doing its job is not sufficient to be good, a sufficiently complicated shell script could just compile and run stuff.
<discocaml> <yawaramin> that's a great start for an issue
<discocaml> <contificate> needs an online "zoo" of different workflows, probably - the docs have a few examples but nowhere near feature complete
mccd has joined #ocaml
mccd has quit [Client Quit]
mccd has joined #ocaml
wbooze has quit [Read error: Connection reset by peer]
LainIwakura has quit [Ping timeout: 240 seconds]
mccd has quit [Quit: Client closed]
wbooze has joined #ocaml
alexherbo2 has quit [Remote host closed the connection]
LainIwakura has joined #ocaml
<discocaml> <dubious245> :bThoughtful: I have accidentally implemented quantified types when implementing basic type inference for simply typed lambda calculus. I am not sure how...
<discocaml> <dubious245> I do not understand my type inference well enough to know how though...
nlocalhost has quit [Read error: Connection reset by peer]
nlocalhost has joined #ocaml
Tuplanolla has joined #ocaml
dhil has quit [Ping timeout: 252 seconds]
m5zs7k has quit [Ping timeout: 252 seconds]
m5zs7k has joined #ocaml
<discocaml> <astreamingcomesacrossthesky> I have gotten reasonably far by reading the docs for individual stanzas and then clarifying still-hazy points by doing GitHub searches for particular snippets that are still confusing to me
<discocaml> <astreamingcomesacrossthesky> Also, I have actually gotten some decent help on one or two occasions from ChatGPT about dune files. I asked it to write me a stanza to concatenate some output files in a rule and it did it correctly
<discocaml> <froyo> that's not good though. soft docs are as important as hard interface specifications
<discocaml> <froyo> chatgpt is an even worse solution
<discocaml> <froyo> at least code in the wild is tried by someone
<discocaml> <astreamingcomesacrossthesky> It's not good to have a working solution?
<discocaml> <froyo> chatgpt could just be confidently wrong
<discocaml> <froyo> it's not good to rely on and be satisfied with this
<discocaml> <contificate> it's bad that this is considered as a resort in the first place
<discocaml> <froyo> yes
<discocaml> <astreamingcomesacrossthesky> I'm all for good docs and minimizing reliance on LLMs but sometimes they help and that's okay
<discocaml> <astreamingcomesacrossthesky> And like I said I used it for dune one time
<discocaml> <astreamingcomesacrossthesky> I'm a terrible programmer and find dune to be at least a very serviceable build tool
<discocaml> <astreamingcomesacrossthesky> I'm sure its docs could be improved tho
<discocaml> <froyo> no the point isn't that I'm objecting to whatever you had to do
<discocaml> <froyo> what I'm saying is that ideally the experience should not have you go such routes
<discocaml> <astreamingcomesacrossthesky> I know what you mean. I think pretty much down its fundamental nature computer programming is about as far from ideal as one can get in terms of how one goes about their duties
<discocaml> <froyo> I did my fair share of searching code snippets on github to understand how to use ppxlib before it had its manual
<discocaml> <astreamingcomesacrossthesky> I personally like writing documentation and would gladly do it
<discocaml> <astreamingcomesacrossthesky> Apparently few people share my enthusiasm
<discocaml> <._null._> I feel like you have to get stumped by something to truly want to write documentation for it
<discocaml> <contificate> or find it neat
<discocaml> <contificate> `dynamic_include` is very neat in dune and underused
<discocaml> <contificate> yet necessary when you have dynamically determined dependencies and want to generate entire libraries etc.
<discocaml> <astreamingcomesacrossthesky> Yeah, well there is certainly a very strong culture of "this actually extremely complex tool or concept and how to use it should be self-evident to you" in the world of software, whence the gap between docs and tooling, imo
<discocaml> <contificate> build tools are almost universally hated
<discocaml> <contificate> look at the C/C++ world, it's literally esolangs and a myriad of solutions
<discocaml> <yawaramin> a lot of people have tried, very hard, to improve the dune docs...
<discocaml> <froyo> I think it's more that there's an accumulated experience which makes the workflow *seem* intuitive but it's completely impenetrable to an outsider until they go through all that pain themselves
<discocaml> <froyo> not that people just assume all the complexity is self-evident
<discocaml> <contificate> the thing that made `dune` understandable to me was understanding that it's all about `_build`
<discocaml> <astreamingcomesacrossthesky> What is the actual concrete barrier?
<discocaml> <yawaramin> i don't understand the question
<discocaml> <contificate> at the risk of bikeshedding, I have no doubt that beginners sigh at the sight of S-expressions
<discocaml> <yawaramin> barrier to what
<discocaml> <astreamingcomesacrossthesky> To improving the docs
<discocaml> <yawaramin> well, imagine that you write some docs. then people say it's bad. then you try to improve them. then people still say it's bad. so what's the barrier to improving?
<discocaml> <astreamingcomesacrossthesky> Proof that people should just learn some Lisp and then be comfortable with sexprs
<discocaml> <contificate> what you need is to decide 10 examples that are of high priority and exercise the relevant points, then make a landing page of only those
<discocaml> <yawaramin> great feedback. ideally should be a GH issue
<discocaml> <contificate> vast majority of people struggling with dune have barely left the car park
<discocaml> <froyo> I don't think the sexps are that relevant imo. I think it's the discoverability and "implicit" rules and interactions between stanzas which to be fair are documented under each stanza but you just need to go through it and see how it all connects
<discocaml> <contificate> an important fact about dune is that you can orchestrate folders from other folders, by way of `subdir`
<discocaml> <contificate> and that the context being used is always what is inside `_build`, in effect
<discocaml> <yawaramin> all very important things to understand. so the obvious question: why don't people get this after reading the docs?
<discocaml> <astreamingcomesacrossthesky> Well if people are just criticizing without giving reasons then Im not sure their feedback should be considered valuable. There are plenty of things I find difficult to use or even in day to day life that I don't like, yet I can't articulate the reasons why, so typically until I've thought that through I abstain from offering my feedback
bartholin has quit [Quit: Leaving]
LainIwakura has quit [Ping timeout: 240 seconds]
<discocaml> <yawaramin> but clearly there's some good criticism and feedback that should be actioned
<discocaml> <yawaramin> so what's the next step
<discocaml> <contificate> a landing page of recipes
<discocaml> <astreamingcomesacrossthesky> I agree with contificate that a cookbook is a nice idea
<discocaml> <yawaramin> right, the OCaml Cookbook is looking for volunteers for example
<discocaml> <contificate> a DUNE ERC-20 slopcoin to go with it
<discocaml> <froyo> would be great if each stanza in the recipes was clickable and hyperlinked to the relevant docs
<discocaml> <astreamingcomesacrossthesky> Good to know bc I'm unemployed lol
<discocaml> <polytypic> > Would it make sense to make something like Riot but based on Picos?
<discocaml> <polytypic> There is a work-in-progress example of an actor model implementation in Picos: <https://github.com/ocaml-multicore/picos/pull/273/files>.
<discocaml> <polytypic>
<discocaml> <polytypic> > I was wondering more about whether there'd be any benefit to doing so
<discocaml> <polytypic> There could potentially be many kinds of benefits. Sharing the effort of implementing things like IO layers and schedulers and obviously the interoperability, in general.
<discocaml> <yawaramin> that's great. someone should try doing that. hint, hint
<discocaml> <froyo> with some more hierarchy in the dune docs in general, each section having its own prelude which gives a behavioral overview etc. just lots of work from people who understand this build system end to end
Serpent7776 has quit [Ping timeout: 252 seconds]
<discocaml> <froyo> I think we got your hint seven messages ago yawaramin
<discocaml> <yawaramin> great.
<discocaml> <yawaramin> > lots of work from people who understand this build system end to end
<discocaml> <yawaramin> my point is they already put in a huge amount of work. look at the docs. there's a lot
<discocaml> <froyo> anyway I find racket docs a pretty good example
<discocaml> <contificate> pretty slick, indeed
<discocaml> <contificate> not bad for schemers
<discocaml> <froyo> 🤝
<discocaml> <yawaramin> in the Racket docs, for example, where do i find the section that talks about how input files are managed for unit tests?
<discocaml> <contificate> sadly, I only trust information if it's tabuled in HTML with minimal styling
<discocaml> <yawaramin> or say, how snapshots are managed?
<discocaml> <contificate> could do that matklad tooltip snippet thing for any dune examples
<discocaml> <froyo> > great.
<discocaml> <froyo> I don't know if you're intentionally being passive-aggrssive or if the tone is betrayed by the text but no-one is diminishing the amount of work already put in by the devs. it is wholly appreciated.
<discocaml> <contificate> some commentary is necessary, beyond hyperlinking to even more disparate information
<discocaml> <contificate> vimtutor except you have to play a towny MMORPG using dune stanzas
<discocaml> <astreamingcomesacrossthesky> Or a nice little Js_of_ocaml/Reason dune file playground
<discocaml> <astreamingcomesacrossthesky> If that hasn't been done
<discocaml> <astreamingcomesacrossthesky> Idk what that would look like tho
<discocaml> <yawaramin> let's keep this impersonal rather than focusing on people's tones. all i'm saying is that, people have a lot of great ideas, it would be great to see it channeled in the right direction
<discocaml> <contificate> probably a complete pain to do, but yeah a godbolt-like playground for build tooling could be interesting
<discocaml> <contificate> I guess it could just be a git repo though
<discocaml> <astreamingcomesacrossthesky> Yeah I'm sure it's not remotely trivial, but something for me to consider. Been enjoying my Js_of_ocaml explorations lately
<discocaml> <yawaramin> hell, run dune in the browsesr itseld with wasm_of_ocaml
<discocaml> <astreamingcomesacrossthesky> Doesn't wasm still generate basically comical bundle sizes?
<discocaml> <astreamingcomesacrossthesky> Or has that improved
<discocaml> <regularspatula> maybe a future outreachy internship could focus on dune docs
<discocaml> <regularspatula> dune docs do seem to come up as a pretty frequent complaint
<discocaml> <yawaramin> agreed that there's clearly an issue there
<discocaml> <deepspacejohn> I wonder if S-expressions are really hard to learn or they're just an easy target to blame for Dune's other learning curves. IMO they're no harder than JSON, YAML, TOML, or any of the bespoke derivatives of those that everyone seems to use.
<discocaml> <regularspatula> Much simpler than yaml at least
<wbooze> s-expressions from lisp ?
<discocaml> <yawaramin> imho S-exprs are not the issue. it's the people don't understand dune's model.
<discocaml> <deepspacejohn> Agreed.
<discocaml> <contificate> yes, yes, everyone loves to love S-expressions
<discocaml> <contificate> but they are unusual to most beginners
<discocaml> <regularspatula> Like y'all were saying, most people just say a general "dune is bad. the docs are bad." So that's not really actionable. But I get that it is hard to describe what's bad when you're a beginner.
<discocaml> <yawaramin> if you have the model in your head–eg git is a chain of commit objects that bundle the files and their metadata–you can roughly figure your way around
<discocaml> <contificate> when I was new to dune, I actually didn't like it at all, overall - it seemed kind of limited, you can't define your own stanzas (you still can't now without modifying it - `menhir`, `ocamllex`, etc. stanzas are hardcoded into dune)
<discocaml> <contificate> making it a kind of esolang
<discocaml> <contificate> and, in my experience, esolangs are fun until you want to actually do things
<discocaml> <contificate> then you crave a programming language
<discocaml> <contificate> Shake, in Haskell, is a neat example of a programmatic build system
<discocaml> <astreamingcomesacrossthesky> Probably also people coming from languages with either no build system/packing tool or one that is so sloppy that the absolute only way to get stuff done is copy-pasta (thinking of Python and JS)
<discocaml> <regularspatula> I also think that once you're used to dune, it can be hard to remember what was might have been hard about dune originally
LainIwakura has joined #ocaml
<discocaml> <contificate> I remember specifically what's problematic about learning dune from nothing
<discocaml> <contificate> and it's that resources don't really indicate that you should look inside `_build` and use `dune describe` and `dune --verbose`
<discocaml> <contificate> there are simple explanations to basically everything that isn't a ad-hoc choice by the developers
<discocaml> <astreamingcomesacrossthesky> Clojure also has a build tool that is just clojure code, it's pretty good imo and certainly better than using maven
<discocaml> <contificate> I still feel like learning anything requires forming neural connections by way of slamming your head against a wall, so you learn a lot by "try and see"™️
<discocaml> <astreamingcomesacrossthesky> But I think like you said above understanding that _build is at the core of it all is key
myrkraverk__ has joined #ocaml
myrkraverk_ has quit [Ping timeout: 252 seconds]
Tuplanolla has quit [Quit: Leaving.]
LainIwakura has quit [Quit: Client closed]
LainIwakura has joined #ocaml
<discocaml> <dubious245> I strongly dislike s expression for coding but I dont mind it for very small scripts like dune. I am a pretty opinionated person and I wasn't too put off by dunes use of s-expressions.
<discocaml> <contificate> it's not a major problem, but it's annoyed me when I've had to parse the output of dune in a language that is not OCaml
<discocaml> <contificate> which I've done several times
<discocaml> <contificate> maybe there's a JSON mode now, I can't recall
<discocaml> <contificate> anyway, from the surface, it's stylistically different and can mislead people into thinking it's S-expressions as-a-scheme when it's S-expressions-based-Jane-Street-like-S-expressions
<discocaml> <contificate> anyway, from the surface, it's stylistically different and can mislead people into thinking it's S-expressions as-a-scheme when it's S-expressions-because-Jane-Street-like-S-expressions
<discocaml> <contificate> annoyed me, I expected a powerful metaprogramming facility, what I got was `rule`
LainIwakura has quit [Quit: Client closed]
<discocaml> <yawaramin> PPX?
<discocaml> <deepspacejohn> yeah, one disadvantaged of a bespoke sexp language is that you need bespoke tools if you aren't writing it by hand. meanwhile, every language can easily parse and print JSON if you want it to.
<companion_cube> Tbh sexprs are really amongst the easiest things to parse
<discocaml> <deepspacejohn> true, although if I want to quickly write a script to extract some metadata from a dune file I'd rather not have to deal with writing a parser at all first.
<discocaml> <deepspacejohn> in practice that's not something I feel the need to do very often, though.