companion_cube changed the topic of #ocaml to: Discussion about the OCaml programming language | http://www.ocaml.org | OCaml 5.3.0 released: https://ocaml.org/releases/5.3.0 | Try OCaml in your browser: https://try.ocamlpro.com | Public channel logs at https://libera.irclog.whitequark.org/ocaml/
<companion_cube> I find this bizarre, I've never seen that argument. What's the issue with angstrom?
agentcasey has joined #ocaml
<discocaml> <yawaramin> the biggest issue is error reporting, like if you want to report the line and column number and a good error message on parse errors you have to jump through a lot of hoops. but, depending on what kind of compiler you're making, you might be able to get away with slightly worse error messages
<dh`> there are two basic problems with parser combinators; one is that they don't check for ambiguities, the other is that you almost always end up with a lot of fragile and unmaintainable backtracking logic
<dh`> the latter is the more serious problem
<dh`> the former just puts them in a bad position relative to parser generators or handwritten recursive descent
<companion_cube> Oh should have read the context more. For parsing text, I'm ambivalent on whether they're a good idea in general
<companion_cube> But they're pretty ok to parse protocols and binary formats
<dh`> ah that is true
<dh`> different requirements and considerations there
<companion_cube> (and imho, aside from literal programming languages, one should strive to do as little text parsing as possible)
<dh`> I don't agree with that either, parsing is cheap and being afraid of writing parsers leads to things like user-facing xml or yaml
<dh`> and horribly misbegotten stuff like the executable yaml that github uses for github actions
<companion_cube> I think it depends, sometimes xml might be better than a bespoke markup thing for example
<companion_cube> But yeah, ok, parsers can be good but they shouldn't be the first thing to reach for
<companion_cube> (for github actions they should have used lua or js from the start)
<discocaml> <yawaramin> it's all bash scripts in the end
agentcasey has quit [Ping timeout: 260 seconds]
<companion_cube> It really shouldn't be tough
<companion_cube> Though*
<companion_cube> I mean it could at least be typescript that calls commands
<companion_cube> Better than yaml at conditional execution and such
<discocaml> <yawaramin> if TypeScript, why not OCaml? 🤔
<discocaml> <yawaramin> https://www.ocurrent.org/
Frostillicus has joined #ocaml
<companion_cube> because nobody cares about OCaml in the wider world?
<companion_cube> besides TS has pretty cool templates strings for things like invoking processes
Tuplanolla has quit [Ping timeout: 248 seconds]
<discocaml> <yawaramin> i mean, CI pipelines use YAML now. even if people don't care about OCaml, it would be a huge step up just on that basis
agentcasey has joined #ocaml
Frostillicus has quit [Read error: Connection reset by peer]
amadaluzia has joined #ocaml
<discocaml> <astreamingcomesacrossthesky> Just use https://github.com/yaml/yamlscript
<companion_cube> TS would be a huge step up too, and has a better chance of happening
Frostillicus has joined #ocaml
Haudegen has quit [Quit: Bin weg.]
<discocaml> <astreamingcomesacrossthesky> I'm definitely joking, I think this certainly qualifies as an esolang in drag as a usable tool
terrorjack has quit [Quit: The Lounge - https://thelounge.chat]
terrorjack has joined #ocaml
semarie has quit [Quit: quit]
myrkraverk has joined #ocaml
semarie has joined #ocaml
myrkraverk_ has quit [Ping timeout: 276 seconds]
amadaluzia has quit [Quit: ZNC 1.10.0 - https://znc.in]
amadaluzia has joined #ocaml
tomku has quit [Ping timeout: 252 seconds]
tomku has joined #ocaml
amadaluzia has quit [Quit: ZNC 1.10.0 - https://znc.in]
myrkraverk_ has joined #ocaml
myrkraverk has quit [Ping timeout: 260 seconds]
wbooze has joined #ocaml
myrkraverk has joined #ocaml
myrkraverk_ has quit [Ping timeout: 265 seconds]
humasect has joined #ocaml
<discocaml> <sim642> You could write your entire CI in typescript and put all of it into a custom GitHub Action. Probably won't work out too well in the end though
<discocaml> <sim642> It boils down to the similar debate about build systems. If they are full blown scripts, then you get all the flexibility but static analysis is difficult. If you have a custom file format, then you're more restricted but can easily analyse them
<discocaml> <sim642> In the full generality of scripting, even figuring out all of the dependencies could easily require running the whole thing because the dependencies may be based on some dynamic factors
myrkraverk_ has joined #ocaml
<discocaml> <sim642> That comes from using monads. OCurrent supports monadic bind but really discourages its use for this reason: https://github.com/ocurrent/ocurrent/blob/master/doc/example_pipelines.md
myrkraverk has quit [Ping timeout: 252 seconds]
humasect has quit [Quit: Leaving...]
Frostillicus has quit [Ping timeout: 245 seconds]
myrkraverk has joined #ocaml
euphores has joined #ocaml
myrkraverk_ has quit [Ping timeout: 252 seconds]
myrkraverk_ has joined #ocaml
myrkraverk has quit [Ping timeout: 260 seconds]
agentcasey has quit [Ping timeout: 248 seconds]
habnabit_ has quit [Ping timeout: 268 seconds]
habnabit_ has joined #ocaml
bartholin has joined #ocaml
YuGiOhJCJ has joined #ocaml
Frostillicus has joined #ocaml
Frostillicus has quit [Ping timeout: 245 seconds]
<dh`> yes and no
<dh`> if you have a restricted config format, you can do more analysis
<dh`> but
<dh`> people inevitably end up adding more stuff to it until it's not restricted any more, but then because it wasn't designed it ends up horrible
Serpent7776 has joined #ocaml
Tuplanolla has joined #ocaml
Serpent7776 has quit [Ping timeout: 276 seconds]
Frostillicus has joined #ocaml
Frostillicus has quit [Ping timeout: 248 seconds]
Haudegen has joined #ocaml
humasect has joined #ocaml
toastal has joined #ocaml
agentcasey has joined #ocaml
humasect has quit [Quit: Leaving...]
<discocaml> <contificate> both of your arguments against combinators can be aimed at recursive descent
agentcasey has quit [Ping timeout: 276 seconds]
Frostillicus has joined #ocaml
Frostillicus has quit [Ping timeout: 245 seconds]
Anarchos has joined #ocaml
Frostillicus has joined #ocaml
Serpent7776 has joined #ocaml
bibi_ has quit [Quit: Konversation terminated!]
agentcasey has joined #ocaml
Frostillicus has quit [Read error: Connection reset by peer]
Frostillicus has joined #ocaml
birle has quit [Quit: birle]
birle has joined #ocaml
Anarchos has quit [Quit: Vision[]: i've been blurred!]
Frostillicus has quit [Read error: Connection reset by peer]
birle has quit [Quit: birle]
birle has joined #ocaml
Frostillicus has joined #ocaml
birle has quit [Quit: birle]
birle has joined #ocaml
YuGiOhJCJ has quit [Quit: YuGiOhJCJ]
Frostillicus has quit [Read error: Connection reset by peer]
Serpent7776 has quit [Ping timeout: 248 seconds]
Frostillicus has joined #ocaml
amadaluzia has joined #ocaml
humasect has joined #ocaml
humasect_ has joined #ocaml
humasect has quit [Ping timeout: 252 seconds]
humasect_ is now known as humasect
agentcasey has quit [Ping timeout: 245 seconds]
amadaluzia has quit [Quit: ZNC 1.10.0 - https://znc.in]
amadaluzia has joined #ocaml
amadaluzia has quit [Client Quit]
amadaluzia has joined #ocaml
Serpent7776 has joined #ocaml
<dh`> in a hand-written recursive descent parser, you'll usually do explicit lookahead at one point to figure out which case you're in, rather than backtracking
<dh`> granted there isn't necessarily a lot of difference, especially for people who don't know what they're doing (in either style)
<discocaml> <yawaramin> you can do explicit lookahead to figure out what case you're in with Angstrom too https://github.com/inhabitedtype/angstrom/blob/76c5ef5b0d0430eb71aa8dccad1fe23f50b96277/examples/rFC7159.ml#L161
<dh`> but IME, having a clear decision point is a lot more maintainable
<dh`> also, you and I should not engage on this topic
<discocaml> <yawaramin> doesn't the IRC bridge carry our usernames over correctly from Discord? i feel like people often think they are talking to 'discocaml'
<dh`> wasn't it you I got into a huge fight with over parsing? if not, I apologize
<discocaml> <yawaramin> nope
<dh`> it is easy to mix people up
<dh`> in that case
<dh`> yes, you can, but parser combinators libraries usually aren't intended to handle deep lookahead
<discocaml> <yawaramin> we fought about squashing commits 😉
<dh`> heh
<dh`> that's relatively unimportant!
<dh`> i have written any number of C parsers by hand (you'd think I'd learn and write a definitive one, but that hasn't happened yet)
<dh`> and the C grammar has some things that require nontrivial backtracking if you do it that way
<discocaml> <yawaramin> would be interesting to see a hand-written recursive descent parser in OCaml for JSON to compare with the Angstrom one above
<dh`> wouldn't be hard to make it more readable, I thought that was haskell when I first looked at it
* dh` hides
<dh`> anyway that's the sort of thing I might do for amusement on sunday afternoon, except that I vaguely recall json is overtly simple but has a whole bunch of demons in the corners
<dh`> and/or the spec is incomprehensible (but there I might be thinking of yaml or one of the others)
<dh`> anyway on the subject of confusing people, it's not that anyone thinks they're talking to "discocaml" after the first five minutes, but there is definitely an effect where it impedes the brain's pattern-matching
<dh`> furthermore you can't /whois across the bridge and there are various things that don't come across that make it harder to differentiate
<companion_cube> Yawaramin it carries if you read correctly
<dh`> and other things that discord has like avatars don't show
<companion_cube> If you want something similar look at the cbor parsers, they're handwritten (both in `cbor` and in containers)
<companion_cube> But it's easier to parse than json
Frostillicus has quit [Ping timeout: 248 seconds]
Frostillicus has joined #ocaml
<discocaml> <yawaramin> > I thought that was haskell when I first looked at it
<discocaml> <yawaramin> dh: it's written in an old style, imho using let-operators gives us much cleaner-looking parsers, eg I thought that was haskell when I first looked at it
euphores has quit [Ping timeout: 252 seconds]
<humasect> #define \n let
Frostillicus has quit [Read error: Connection reset by peer]
Frostillicus has joined #ocaml
myrkraverk has joined #ocaml
<dh`> that's definitely better
myrkraverk_ has quit [Ping timeout: 265 seconds]
casastortaAway has quit [Ping timeout: 252 seconds]
casastortaAway has joined #ocaml
Serpent7776 has quit [Ping timeout: 265 seconds]
humasect has quit [Quit: Leaving...]
toastal has left #ocaml [#ocaml]
agentcasey has joined #ocaml
bartholin has quit [Remote host closed the connection]
humasect has joined #ocaml
<dh`> TIL: the lexer recognizes quoted strings inside comments, so you can nerf otherwise problematic text like "int (*x)(void)" by quoting it
myrkraverk_ has joined #ocaml
myrkraverk has quit [Ping timeout: 248 seconds]
myrkraverk has joined #ocaml
myrkraverk_ has quit [Ping timeout: 252 seconds]
birle has quit [Quit: birle]
amadaluzia has quit [Quit: ZNC 1.10.0 - https://znc.in]
agentcasey has quit [Ping timeout: 272 seconds]
Frostillicus has quit [Ping timeout: 248 seconds]
Frostillicus has joined #ocaml
humasect has quit [Quit: Leaving...]
Mister_Magister has quit [Quit: bye]
Mister_Magister has joined #ocaml
Frostillicus has quit [Read error: Connection reset by peer]