companion_cube changed the topic of #ocaml to: Discussion about the OCaml programming language | http://www.ocaml.org | OCaml 4.12 released: https://ocaml.org/releases/4.12.0.html | Try OCaml in your browser: https://try.ocamlpro.com | Public channel logs at https://libera.irclog.whitequark.org/ocaml/
Stumpfenstiel has quit [Ping timeout: 268 seconds]
cedric has quit [Quit: Konversation terminated!]
favonia has quit [Ping timeout: 252 seconds]
favonia has joined #ocaml
Haudegen has quit [Ping timeout: 268 seconds]
shawnw has quit [Ping timeout: 255 seconds]
favonia has quit [Ping timeout: 252 seconds]
favonia has joined #ocaml
favonia has quit [Ping timeout: 255 seconds]
favonia has joined #ocaml
favonia has quit [Ping timeout: 252 seconds]
favonia has joined #ocaml
favonia has quit [Ping timeout: 255 seconds]
favonia has joined #ocaml
rgrinberg has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
rgrinberg has joined #ocaml
dvu has joined #ocaml
favonia has quit [Ping timeout: 252 seconds]
favonia has joined #ocaml
favonia has quit [Ping timeout: 252 seconds]
favonia has joined #ocaml
gravicappa has joined #ocaml
rgrinberg has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
rgrinberg has joined #ocaml
favonia has quit [Ping timeout: 255 seconds]
favonia has joined #ocaml
zebrag has quit [Quit: Konversation terminated!]
rgrinberg has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
rgrinberg has joined #ocaml
favonia has quit [Ping timeout: 255 seconds]
favonia has joined #ocaml
leah2 has quit [*.net *.split]
bacam has quit [*.net *.split]
st has quit [*.net *.split]
p4bl0 has quit [*.net *.split]
tizoc has quit [*.net *.split]
oisota has quit [*.net *.split]
sleepydog has quit [*.net *.split]
noddy has quit [*.net *.split]
micro has quit [*.net *.split]
aquijoule__ has quit [*.net *.split]
rks` has quit [*.net *.split]
greenbagels has quit [*.net *.split]
engil has quit [*.net *.split]
_tjr_ has quit [*.net *.split]
ralu has quit [*.net *.split]
Cypi has quit [*.net *.split]
energizer has quit [*.net *.split]
damien2 has quit [*.net *.split]
nfc has quit [*.net *.split]
gahr has quit [*.net *.split]
Enjolras_ has quit [*.net *.split]
Armael has quit [*.net *.split]
rwmjones|hols has quit [*.net *.split]
rak has quit [*.net *.split]
aquijoule__ has joined #ocaml
ralu has joined #ocaml
leah2 has joined #ocaml
_tjr_ has joined #ocaml
tizoc has joined #ocaml
micro has joined #ocaml
st has joined #ocaml
p4bl0 has joined #ocaml
engil has joined #ocaml
rks` has joined #ocaml
nfc has joined #ocaml
energizer has joined #ocaml
bacam has joined #ocaml
Enjolras_ has joined #ocaml
Cypi has joined #ocaml
damien2 has joined #ocaml
oisota has joined #ocaml
greenbagels has joined #ocaml
rwmjones|hols has joined #ocaml
Armael has joined #ocaml
gahr has joined #ocaml
sleepydog has joined #ocaml
rak has joined #ocaml
noddy has joined #ocaml
mro has joined #ocaml
mro has quit [Remote host closed the connection]
jtck_ has quit [Remote host closed the connection]
jtck has joined #ocaml
rgrinberg has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
Haudegen has joined #ocaml
bartholin has joined #ocaml
Guest8905 has quit [Remote host closed the connection]
Guest8905 has joined #ocaml
<d_bot> <Cyclomatic Complexity> stupid q: there are extensible variants in OCaml. But is there a good way to define extensible functions on them? So that when you add a case to the variant, you can also add one match case to the function?
cedric has joined #ocaml
favonia has quit [Ping timeout: 265 seconds]
Serpent7776 has joined #ocaml
<d_bot> <antron> do you mean having the compiler force you to add cases?
mro has joined #ocaml
mro has quit [Ping timeout: 255 seconds]
bartholin has quit [Ping timeout: 255 seconds]
bartholin has joined #ocaml
jinsun has left #ocaml [https://quassel-irc.org - Chat comfortably. Anywhere.]
<d_bot> <octachron> @Cyclomatic Complexity : you can have set of functions that signals which extension constructors they can handle and a handler that matches each input with the right partial function.
<d_bot> <Cyclomatic Complexity> No, I meant, in practice, how do you extend functions
<d_bot> <Cyclomatic Complexity> I am not sure what you havein mind, do you have an example?
bartholin has quit [Ping timeout: 240 seconds]
bartholin has joined #ocaml
<d_bot> <Cyclomatic Complexity> I see
<d_bot> <octachron> There are many variants of this structure but they mostly come down to each function `extensible -> ... ` having limited responsability and delegating to someone with a better point of view the handling of unknown variants.
favonia has joined #ocaml
<d_bot> <Alistair> Whats the performance of something like that like?
<d_bot> <octachron> That's a linear search over all registered functions. If performance matters, you can probably organize the search to be more efficient.
<d_bot> <Cyclomatic Complexity> Not great I expect, you have to iterate through each of the functions in the list, and I don't think there is any partial evaluation, so it can't be optimized by latter passes
<d_bot> <octachron> Note that with extension constructor, the compiler itself has not much information. And typically even pattern matching devolves into nested equality tests.
<d_bot> <Cyclomatic Complexity> Oh, there are no whole-program optimizations for extensible variants?
<d_bot> <Cyclomatic Complexity> hmmm
<d_bot> <Cyclomatic Complexity> Is it because you can add cases dynamically with FCMs?
<d_bot> <octachron> See https://gist.github.com/Octachron/28691ede67b84a8d70341763fc1d6c62 for the difference between normal and extension constructors.
<d_bot> <Cyclomatic Complexity> thanks!
<d_bot> <octachron> Worse than that you can hide the identity of an extension constructor with a signature (`module M: sig type ext += B end = struct type ext += B = A end`)
foocraft has joined #ocaml
foocraft has quit [Client Quit]
bartholin has quit [Ping timeout: 272 seconds]
bartholin has joined #ocaml
zebrag has joined #ocaml
Stumpfenstiel has joined #ocaml
jtck has quit [Quit: Leaving]
jtck has joined #ocaml
jtck has quit [Remote host closed the connection]
jtck has joined #ocaml
gareppa has joined #ocaml
jtck has quit [Remote host closed the connection]
jtck has joined #ocaml
gareppa has quit [Remote host closed the connection]
mro has joined #ocaml
bartholin has quit [Read error: Connection reset by peer]
mro has quit [Ping timeout: 272 seconds]
Absalom has joined #ocaml
bartholin has joined #ocaml
favonia has quit [Ping timeout: 252 seconds]
waleee has quit [Ping timeout: 252 seconds]
mro has joined #ocaml
mro has quit [Remote host closed the connection]
waleee has joined #ocaml
waleee has quit [Ping timeout: 252 seconds]
bartholin has quit [Ping timeout: 252 seconds]
bartholin has joined #ocaml
thelounge98 has joined #ocaml
bartholin has quit [Ping timeout: 258 seconds]
bartholin has joined #ocaml
rgrinberg has joined #ocaml
<d_bot> <aolko> hi there, i'd like to ask some questions about using ocaml as a base for a language
<d_bot> <aolko> apparently people claim that it'
bartholin has quit [Ping timeout: 240 seconds]
rgrinberg has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
rgrinberg has joined #ocaml
rgrinberg has quit [Client Quit]
<d_bot> <octachron> Like always `simple` depends on your background. And as `the best language` it is hardly something that can be quantified objectively.
bartholin has joined #ocaml
<d_bot> <aolko> i'm a procedural php guy (and somewhat functional es5 guy, normal functional not twisted ml functional)
<d_bot> <octachron> The datapoints on hand is that `Rust` was bootstrapped from `OCaml`. `Haxe`, `Hack`, the reference `webasm` implementation are written in OCaml. And `Rescript` too (but that is a fork of OCaml).
<d_bot> <aolko> that was also the starter point
<d_bot> <octachron> Hm, if you are not familiar with writing a compiler, this means that you would be learning on three fronts at the same time: functional languages, proper type systems (with sums), about compilers.
<d_bot> <aolko> well, interpreter, rather
<d_bot> <aolko> since you don't know the **why** part just yet
<d_bot> <octachron> Anyway, what were you questions?
<d_bot> <aolko> right, how does one write an interpreter of a different dialect of existing language?
<d_bot> <g_w1> fwiw, i'm writing a lang in ocaml rn
<d_bot> <aolko> great, i count on your help 😛
rgrinberg has joined #ocaml
<d_bot> <g_w1> write a tokenizer then parser then bytecode generator then bytecode executor
<d_bot> <Cyclomatic Complexity> (And ligolang.org is written in OCaml)
<d_bot> <Cyclomatic Complexity> Unrelated: is there a ppx / anything to name patterns in OCaml?
<d_bot> <aolko> with a skip-tokenizer-entirely root, like PEG-based langs do
<d_bot> <g_w1> yes
<d_bot> <aolko> oh and probably i will supply my own format of grammars
<d_bot> <aolko> so, in other words i probably need a parser generator
<d_bot> <aolko> and so far i found Menhir
favonia has joined #ocaml
<d_bot> <aolko> and `hack` currently uses a mix of rust and ocaml, so it's not as simple to pick it apart
berberman_ has joined #ocaml
berberman has quit [Ping timeout: 246 seconds]
bartholin has quit [Ping timeout: 252 seconds]
<d_bot> <aolko> (and of course it's `.y` https://github.com/facebook/hhvm/blob/master/hphp/parser/hphp.y )
<d_bot> <octachron> `Menhir` is the go-to parser generator for OCaml.
<d_bot> <aolko> right, so it also means that grammar has to be written from scratch 😐
<d_bot> <colin> it probably won't be that bad since the precedence declarations required to remove conflicts will be the same and are given in the file above
<d_bot> <colin> will be laborious and tedious
<d_bot> <colin> but "from scratch", depends how you look at it - I'd say formed grammar productions and precedence declarations is really a mechanical translation
<d_bot> <aolko> yeah, it'd be great if your grammar is entirely original
<d_bot> <aolko> but if you have to closely clone another language (in this case php) that's oof
<d_bot> <colin> the semantic actions are in PHP
<d_bot> <colin> so long as they're not stateful in some hacky way, could probably transliterate into what menhir or ocamlyacc expects quite easily
<d_bot> <aolko> the point is that i essentially have no prefabs for the grammar, so i have to write it myself
<d_bot> <aolko> in peg, from scratch
<d_bot> <aolko> for menhir
bartholin has joined #ocaml
<d_bot> <colin> maybe I'm misunderstanding
<d_bot> <colin> aren't you just wanting to port the above, linked, grammar to menhir?
<d_bot> <aolko> no, i won't be doing that
<d_bot> <aolko> i linked that as a "oh great it's an entirely different grammar i won't be porting" proof
<d_bot> <colin> what are you wanting to parse
<d_bot> <colin> I've read your messages several times and don't follow at all
<d_bot> <colin> perhaps the beer is too strong
<d_bot> <aolko> that question comes after "what are the differences from php?"
<d_bot> <colin> are you wanting to parse PHP?
<d_bot> <aolko> i want to interpret my dialect
<d_bot> <colin> Zend's parser for PHP uses yacc/bison so its grammar is for an LR-based parser generator
<d_bot> <colin> so you can modify that
<d_bot> <colin> you'll need to transliterate it into menhir
<d_bot> <aolko> no way i'm going into that pit of spaghetti
<d_bot> <colin> beats doing it from scratch
<d_bot> <colin> especially if you're familiar with yacc-based tooling already
<d_bot> <aolko> nope
<d_bot> <colin> better than PEG as well
<d_bot> <aolko> nah
<d_bot> <colin> (waits on mob)
<d_bot> <aolko> if you ask me, this is better:
<d_bot> <aolko> as in the notation
<d_bot> <colin> you have met the necessary suffering of the least important and least-interesting parts of language projects, parsing
<d_bot> <aolko> with parser generators that's kinda avoidable
<d_bot> <colin> depends on the generator
<d_bot> <colin> if you do any substantial work with LR generators
<d_bot> <aolko> in our case menhir
<d_bot> <colin> yeah
<d_bot> <colin> to resolve conflicts in these grammars
<d_bot> <colin> you often have to appeal to the table itself
<d_bot> <colin> (we'll dispense of the fact that menhir, by default, doesn't actually compile to an LR algorithm querying a table)
<d_bot> <NULL> I've never had any problems when reading menhir's `--explain` output
<d_bot> <colin> I find it too annoying
<d_bot> <colin> I usually know the problem in my head
<d_bot> <colin> and know how to achieve the results I want if I could simply resolve conflicts in the table directly (which I do sometimes, hardcoding table + algo)
<d_bot> <colin> the issue is
<d_bot> <colin> I find yacc precedence declarations to be really annoying
<d_bot> <aolko> the other future pain i forsee is actually getting the interpreter to work with apache, but that's for another time
<d_bot> <colin> are you just gonna route through fastcgi?
<d_bot> <colin> that's the quick and simple way to feed into a webserver
<d_bot> <aolko> well, there's php-fpm and mod_php
<d_bot> <aolko> so i think there should be smth similar
<d_bot> <colin> fastcgi
<d_bot> <aolko> and then the extension question will arise, since i haven't yet conceived the `php.ini` alternative
<d_bot> <colin> have you considered compiling to PHP and simply doing it as a kind of preprocessor rather than interpreter or do you have semantics that aren't amenable to that scenario
<d_bot> <aolko> no
<d_bot> <aolko> becauze zend f'd up real badly
<d_bot> <colin> I just think at least then you'd get JIT
<d_bot> <aolko> no man, it's non-salvageable
<d_bot> <colin> what, PHP?
<d_bot> <aolko> zend engine
<d_bot> <colin> how brutal is your overhaul going to be
<d_bot> <colin> might as well just create a different language 😏
<d_bot> <aolko> well, that'll be pphp
<d_bot> <colin> smlweb or Ur/Web coming up 😏
<d_bot> <aolko> no, just pphp
<d_bot> <aolko> it'll use the collection principle and no oop
<d_bot> <colin> the fact that Googling that acronym led to a wikipedia page describing an "inherited disorder" is rather fitting
<d_bot> <aolko> so, module is a collection of functions is a collection of variables
<d_bot> <aolko> it can be shortened to `pp` and it's not my fault ~90% of the web runs php
<d_bot> <colin> ah, well, good luck with your ventures in webpain
<d_bot> <aolko> right, doesn't mean i'd be entirely on my own, would still need that grammar/interpreter help
<d_bot> <aolko> as for right now basically defining the base php grammar
<d_bot> <colin> luckily that exists as a yacc grammar already
<d_bot> <aolko> not peg tho
<d_bot> <colin> PEG is bad. Qed.
<d_bot> <aolko> peg is friendlier
<d_bot> <colin> sounds like a total nightmare to do that
<d_bot> <aolko> this is like saying css is bad and XAML styling is great
<d_bot> <colin> on one hand you have a ready-to-go-with-some-transliteration-into-idiomatic-menhir
<d_bot> <colin> on the other, "let's do it in PEG from scratch"
<d_bot> <aolko> iirc there's no 100% accurate translators/converters from yacc to peg
<d_bot> <colin> believable
<d_bot> <aolko> and since that's a thing for people like me that are not gurus in parse generators that seems to be the viable option
<d_bot> <colin> luckily, to become a guru at parser generators you just need to read 10 pages of Aho's "Compilers: Principles, Techniques, and Tools" i.e. the dragon book
<d_bot> <colin> the only redeeming chapters of that book 🙃
<d_bot> <aolko> i'm all for domain-specific knowledge
<d_bot> <aolko> i.e. the neccessary knowledge for the task/set of tasks
<d_bot> <aolko> dragon book doesn't fit in that
<d_bot> <colin> well, tell me when you've got your PHP-with-extensions PEG grammar ready-to-go in 2030
<d_bot> <aolko> please don't pull one of those "hmph well tell me when you'll do your thing entirely on your own because you reject the ways i suggested"
<d_bot> <aolko> it won't get anywhere, nor will it help to solve the problem
<d_bot> <colin> this is an OCaml server and you've rejected the most popular generator used by OCaml projects
<d_bot> <colin> so I can only wish you luck and good health
<d_bot> <aolko> not really, i was going for peg one, yet you kinda stareted insisting on yacc one
<d_bot> <colin> with good reason
<d_bot> <colin> namely that the PHP grammar has been defined several times for yacc-based/inspired tooling
<d_bot> <aolko> then:
<d_bot> <aolko> a. someone who has a better understanding of both parser generators can help out by translating it
<d_bot> <aolko> b. it will be written from scratch with no reference by poking around in the target parser generator from the start
<d_bot> <colin> a. is straightforward as yacc is easy to learn
<d_bot> <colin> bison, yacc, menhir, etc.
<d_bot> <colin> all get a bad review from Reddit-compiler people
<d_bot> <aolko> not really
<d_bot> <colin> but that's because their idea of "too much work" is reading 5 pages of documentation to learn how to use a tool
<d_bot> <aolko> css is easy to learn, yacc is messy to learn
<d_bot> <colin> they'd rather yak shave a recursive descent mess
<d_bot> <colin> have you learned yacc?
<d_bot> <aolko> never, still a mess every time i look into any yacc grammar
<d_bot> <colin> ah, so something that vaguely resembles BNF w/ semantic actions
favonia has quit [Ping timeout: 240 seconds]
<d_bot> <colin> is messy
<d_bot> <colin> I see
<d_bot> <aolko> i like the straight top-down peg-like kind
<d_bot> <aolko> pipe mess
<d_bot> <colin> a devastating review
<d_bot> <colin> is OCaml also "pipe mess"
<d_bot> <aolko> everything is a pipe mess if you have a need to spread them on new lines
gravicappa has quit [Ping timeout: 240 seconds]
favonia has joined #ocaml
<d_bot> <octachron> @aolko leaving aside the parser issue, you are aware that OCaml looks like this : https://github.com/Octachron/codept/blob/master/lib/pp.ml#L39, aren't you?
<d_bot> <colin> OCaml is a means to an end for aolko
<d_bot> <colin> don't blame the grind
<d_bot> <aolko> yes, i am, i have the memo:
<d_bot> <octachron> I don't remember any active PEG generator library. I generally see people use either menhir, parser combinators, or hand-written parsers.
<d_bot> <Alistair> Have you tried Haskell? Has a PEG generator https://tanakh.github.io/Peggy/
<d_bot> <Alistair> also isn't a "pipe mess"
<d_bot> <aolko> haskell is even more twisted
<d_bot> <aolko> esp. with it's jargon
<d_bot> <colin> aolko will link against Zend Engine and recursively transform Zend C ASTs into OCaml objects in C before using menhir
<d_bot> <aolko> no, i won't do that, since i'm not a c guy 😛
waleee has joined #ocaml
<d_bot> <aolko> https://rentry.co/k5ayi
<d_bot> <colin> case mess
<d_bot> <aolko> can deal
<d_bot> <aolko> i've been dealing with it for years 😛
<d_bot> <colin> I guess it's worth noting that matching is far more powerful than switching
<d_bot> <colin> so most people see through syntax
<d_bot> <aolko> `switch(x)` -> `match(x)`
<d_bot> <colin> plus, I find `|` to be quite nice, it's user for delimiting things all the time in syntax
<d_bot> <colin> oh dear
<d_bot> <colin> do you know OCaml?
<d_bot> <aolko> i've got my memo still
<d_bot> <colin> is `switch` so good that PHP are actively discussing implementing a pattern matching proposal
<d_bot> <aolko> Zend can discuss w/e at this point, that will just further ruing the language
<d_bot> <colin> well, ruining PHP is idempotent
<d_bot> <colin> so it's all good
<d_bot> <aolko> well, it __was__ good until they've gutted all non-oop aspects
favonia has quit [Ping timeout: 246 seconds]
<d_bot> <Deadrat> Isn't php is just a prank that got out of control?
<d_bot> <aolko> frameworks are
favonia has joined #ocaml
<d_bot> <aolko> and besides, besides php you have what? Dead perl?
Absalom has quit [Quit: WeeChat 2.3]
mro has joined #ocaml
<d_bot> <Deadrat> Why does it have to run on apache?
<d_bot> <aolko> because LAMP is a "standard"
<d_bot> <aolko> people just love 'em `.htaccess`
<d_bot> <aolko> and yes, not everyone runs nginx
mro has quit [Remote host closed the connection]
<d_bot> <Deadrat> I mean time to evolve
<d_bot> <aolko> i guess it's "over my dead body" situation
<d_bot> <Deadrat> My condolences
<d_bot> <aolko> so unless zend will denounce php or something people won't switch
<d_bot> <aolko> esp cms devs, what are you gonna port wordpress to?
<d_bot> <Deadrat> Haven't touched php and thankful
<d_bot> <Deadrat> Haven't worked at companies where people relied on php and I'm thankful
<d_bot> <Deadrat> But I guess soon js will be the new php
<d_bot> <aolko> thatnks to some wet dream mixed with a tantrum from a guy that loved js too much
<d_bot> <Deadrat> Honestly the biggest mystery to me
<d_bot> <Deadrat> Is why languages designed that look like they were designed after sitting 10 days on meth without sleep are popular
<d_bot> <Deadrat> While others are not
<d_bot> <aolko> oh and don't worry, tc39 ruined js as well
<d_bot> <aolko> since ES6
<d_bot> <aolko> because not everyone appreciates art (ruby/python)
<d_bot> <colin> don't think you'll like OCaml
<d_bot> <colin> just a guess from things you've said
<d_bot> <Deadrat> Python and Ruby are more like modern art
<d_bot> <aolko> as long as i can bandaid it, i guess it'll work out
<d_bot> <Deadrat> You see a pile of garbage but can't understand whether it's an installation or pile of garbage
<d_bot> <aolko> make no mistake, one pile is made by a japanese guru and other has a snake in it
<d_bot> <Deadrat> I mean I think
<d_bot> <Deadrat> Js is harmful
<d_bot> <Deadrat> I started with it
<d_bot> <Deadrat> And now I'm braindamaged
<d_bot> <aolko> gotta love that flutter aerobics by google:
<d_bot> <aolko> "we bring thee a gift for replacing js...or not"
<d_bot> <Deadrat> And need my hand held every step of the way
<d_bot> <colin> I agree, it's thoroughly disappointing that JS and Python are recommended for beginners
<d_bot> <aolko> speaking of js
<d_bot> <aolko> i also have a few ideas on it
<d_bot> <aolko> https://rentry.co/3rafi
<d_bot> <aolko> besically building on good ol' ES3
<d_bot> <Deadrat> I hope you are writing this code at work
<d_bot> <Deadrat> And just trolling
<d_bot> <aolko> no, i'm not
<d_bot> <Deadrat> I think you should check out elixir
<d_bot> <aolko> i ain't at&t
<d_bot> <aolko> also pipe mess
<d_bot> <Deadrat> What caught your attention in ocaml?
<d_bot> <aolko> just a recommendation
<d_bot> <g_w1> is there an idomatic way to say this code is unreachable? similiar to unreachable!() in rust or `unreachable` in zig? I basically want to use it in a match case to say panic if this is reached, it should never get to here
<d_bot> <Deadrat> failwith "unreachable" ?
<d_bot> <Alistair> Modify the type to ensure it's not expressible?
thelounge98 has quit [Quit: the lounge - https://webirc.envs.net]
Absalom has joined #ocaml
bartholin has quit [Ping timeout: 265 seconds]
<d_bot> <octachron> `(* proof that this is unreachable*) assert false`
rgrinberg has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
favonia has quit [Ping timeout: 240 seconds]
favonia has joined #ocaml
bartholin has joined #ocaml
favonia has quit [Ping timeout: 252 seconds]
favonia has joined #ocaml
Serpent7776 has quit [Quit: leaving]
favonia has quit [Ping timeout: 255 seconds]
favonia has joined #ocaml
bartholin has quit [Quit: Leaving]
<d_bot> <g_w1> thanks
hackinghorn has joined #ocaml
rgrinberg has joined #ocaml
<d_bot> <aolko> why haskell is weird:
<d_bot> <aolko> heavy reliance on https://github.com/hemanth/functional-programming-jargon#:~:text=Haskell%20Turkish-,Table%20of%20Contents,-Arity
<d_bot> <aolko> almost religious even
<drakonis> yes
<companion_cube> @g_w1: assert false
<drakonis> much of that still applies to ocaml
<drakonis> but its not as pervasive
<d_bot> <aolko> i think it's optional here, right?
<d_bot> <aolko> and pipe mess can be bandaged out 🩹
<d_bot> <aolko> ref.: https://rentry.co/k5ayi
<companion_cube> what is that about?
<d_bot> <aolko> what ocaml have vs. what's better (OOBE)
<d_bot> <aolko> has*
<Armael> 🤔
<drakonis> oh
<drakonis> well, haskell has a terrible stdlib and ocaml has a spartan stdlib
rgrinberg has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<d_bot> <NULL> Are you trying to convince people that the switch looks better than the match ?
<d_bot> <aolko> i'm trying to say that pipe mess is bad
<drakonis> lol
<drakonis> uhhh
<drakonis> yw
<d_bot> <NULL> I don't know what you mean by "pipe mess"
<drakonis> you what?
<d_bot> <aolko> unless it's logical or `||`
<d_bot> <aolko> > everything is a pipe mess if you have a need to spread them on new lines
<drakonis> when's ocaml 4.13?
<companion_cube> @aolko your snippet shows how much better OCaml is :D
<d_bot> <NULL> So having a match with more than one case, and each case needs its own line is "pipe mess" ?
<d_bot> <aolko> for ocaml scripter - maybe, for everyone else - nah
<companion_cube> besides `|` indicates disjunction, which is consistent with `match` here
<d_bot> <aolko> `switch(x)` -> `match(x)` change wouldn't really change the syntax
<d_bot> <NULL> 1. It's `match x`; 2. My question was about the pipes
<companion_cube> switch vs match is just taste, indeed (look into Reason!)
<companion_cube> but the series of `case` with fallthrought is absolutely terrible
<d_bot> <aolko> basically, if your line starts with a pipe, that's a mess
<d_bot> <Armael> but.. but why
<companion_cube> sounds like dismissing lisp because "if your line starts with ( it's a mess"
<d_bot> <Armael> "this syntax is unfamiliar therefore it is bad"
<d_bot> <NULL> Let me dismiss all languages: "if your line starts with a space, it's space mess"
<d_bot> <aolko> *is not that readable/accessible
<d_bot> <aolko> don't research https://esolangs.org/wiki/Whitespace
rgrinberg has joined #ocaml
<d_bot> <Armael> you should look into reason then! using a more "familiar" syntax is the whole premise of reason
<d_bot> <NULL> Why would it be objectively unreadable/unaccessible ? Don't you think it's only because it's a bit far from what you're used to ?
favonia has quit [Ping timeout: 255 seconds]
<d_bot> <NULL> At this point, brainf*** is a better example, because it usually doesn't feature spaces
<d_bot> <aolko> on the scale of python/ruby to brainfuck/monkey/alike this is approaching brainfuck
favonia has joined #ocaml
<companion_cube> please stop trolling, it's getting tiresome
<d_bot> <aolko> > no, i'm not, i'm actually sincere [at all times].
<companion_cube> some of us here would consider python or ruby less readable
<companion_cube> and the `|` is pretty readable
<companion_cube> compared to long if/elif in python, or case+break in C (yikes)
<d_bot> <aolko> some of you are exclusively ocaml scripters and are used to it's intricacies
<companion_cube> no one here is a "scripter" :D
<d_bot> <aolko> if you write scripts you are a scripter
<companion_cube> we write programs
<companion_cube> OCaml is generally not considered a "scripting language"
<d_bot> <aolko> my bad then, ocaml programmers
<d_bot> <NULL> To me, `| pat -> expression` is as difficult to read as `case pat: \n expression`
<d_bot> <aolko> sure, but think about people that write in other languages, even non-functional ones
<d_bot> <aolko> that's the norm for them
<companion_cube> well python doesn't have switch
<companion_cube> and ruby, well, is super foreign to people used to C syntax
<companion_cube> (hello @ and @@ everywhere)
<d_bot> <aolko> python has match, but with indents
<companion_cube> it's not even released! jeez
<d_bot> <aolko> ruby has case
<d_bot> <NULL> `case` is much more verbose than `|`, and considering how often we use `match`, this seems reasonable
<d_bot> <aolko> or rather case...when
<companion_cube> which is fine
<d_bot> <aolko> sure it is verbous, but more readable, the king of verbose is vb.net
<companion_cube> well in OCaml, `|` in match reflects `|` in type declaration
<companion_cube> it's elegant
<d_bot> <aolko> i disagree, it is a mess
<d_bot> <aolko> actually, not only in ocaml but in some ML
<companion_cube> https://github.com/c-cube/ocaml-containers/blob/master/src/data/CCWBTree.ml#L178-L186 <-- like this, match reflects declaration
<d_bot> <aolko> on others it's `|>`
rgrinberg has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<companion_cube> |> exists in OCaml too… it's piping
<companion_cube> (you must be mad about `|` in shells)
<d_bot> <aolko> i mostly meant f#
<d_bot> <aolko> (no it'd be an alias of `||` for me)
<d_bot> <NULL> (The case could be made that sum types could use `case` as in `match`, I think)
<d_bot> <aolko> (or rather &&)
<companion_cube> in shell | is not a disjunction at all…
<companion_cube> nor a conjunction
<companion_cube> it's just unrelated
<companion_cube> @NULL I think scala does this actually.
<d_bot> <aolko> regardless, it should affect all functions, as in `function x(){code}`, not how it currently is
<d_bot> <NULL> Well it's `case class`, it's really some sugar around a subclass declaration (and I don't like it)
<companion_cube> all functions?
<companion_cube> @NULL scala3 has proper enums
<d_bot> <aolko> all ocaml function calls
<d_bot> <aolko> and/or declarations
<d_bot> <NULL> Then I don't know about those (I never worked with Scala 3)
<companion_cube> @aolko OCaml function calls are fine, what about them
<d_bot> <aolko> same as switch, heavy reliance on pipes
<Armael> :DD oh well.
<companion_cube> I think you're confused
<companion_cube> function calls are just `f x y z`, no pipes in sight
<d_bot> <aolko> but hey, if you can bandage in some curly brackets in python...
<d_bot> <aolko> and that's why i said and/or declarations
<d_bot> <aolko> then it should be possible to pull something like that for ocaml
<companion_cube> > a language built on top of Python,
<companion_cube> yes, please read about Reason
<companion_cube> we've mentionned it 50 times already
<d_bot> <aolko> eh...kinda DSLy
<d_bot> <aolko> reason, too, relies on pipes
<d_bot> <aolko> that's literally their first landing snippet
<companion_cube> what did pipes ever do to you
<d_bot> <aolko> that should be where they belong - in the logical OR clauses
<d_bot> <aolko> and yes, "arrow functions" is a nasty es6 wart, which reason also has
<d_bot> <aolko> so it's not much better
favonia has quit [Ping timeout: 255 seconds]
favonia has joined #ocaml
cedric has quit [Quit: Konversation terminated!]
<companion_cube> @aolko sum types are a disjunction
<companion_cube> we all long for JS and its amazing `(() => {…})()` syntax for expressions!
<d_bot> <aolko> `function x(){return true;}` is much more readable
<companion_cube> if you say so
favonia has quit [Ping timeout: 252 seconds]
favonia has joined #ocaml
<d_bot> <aolko> so, when it comes to writing such bandages ocaml suddenly devolves into ML/Lisp
<d_bot> <aolko> am i right?
<d_bot> <NULL> What "bandages" ?
<d_bot> <aolko> like linked/described above
<companion_cube> well OCaml is a ML
<d_bot> <Alistair> ^
<companion_cube> so it "devolves" into ML 100% of the time!
<d_bot> <Alistair> Also syntax is never perfect, we all have personal preferences
<d_bot> <aolko> i meant classic Lisp-y ML with bracket overload
<d_bot> <theangryepicbanana> you should look at ReasonML
<d_bot> <Alistair> It shouldn’t be such a deal breaker
<d_bot> <aolko> it's not much better
<d_bot> <theangryepicbanana> it's literally js syntax
<d_bot> <theangryepicbanana> like, intentionally
<d_bot> <aolko> ES6+ syntax, the worst one
<d_bot> <theangryepicbanana> what else are you expecting lol
<d_bot> <aolko> r9y
<d_bot> <theangryepicbanana> do you really want every definition to be `var thing = function thing() {...}`
<companion_cube> it sounds as weird as someone saying "C++98, the most readable one"
<d_bot> <theangryepicbanana> ^
<d_bot> <aolko> sure, function can be shortened to `fun` or `func`
<d_bot> <theangryepicbanana> if you *really* want an ocaml-like language that looks like ancient JS, you should have a look at Haxe
<companion_cube> :DDDD
favonia has quit [Ping timeout: 240 seconds]
<d_bot> <theangryepicbanana> it even used switch/case for pattern matching
<d_bot> <Alistair> Languages are often designed to solve certain problems (e.g. ML was a meta language for theorem proving), they should be used based on merits of this for specific problems
<d_bot> <Alistair> Like sure OCamls syntax is a bit clunky, but it’s great at what it does
<d_bot> <theangryepicbanana> and if you don't like it, there's plenty of similar languages with different syntax (reasonml, f#, scala, etc)
favonia has joined #ocaml
<d_bot> <aolko> haxe is a weird territory for me, yes it has a butt-ton of targets, but it's oop turns me off
<d_bot> <theangryepicbanana> fun fact: ocaml has oop too
<d_bot> <Alistair> ^
<d_bot> <Alistair> Objective Caml
<d_bot> <aolko> then it's not truly functional
<d_bot> <theangryepicbanana> who said it had to be
<d_bot> <Alistair> If you want pure then go Haskell
<d_bot> <NULL> So you're neither a functional nor an OOP programmer ?
<d_bot> <theangryepicbanana> I'll actually unironically use classes in ocaml every so often
<d_bot> <theangryepicbanana> lol
<companion_cube> me too
<d_bot> <aolko> i'm a procedural guy
<d_bot> <Alistair> Use C?
<d_bot> <theangryepicbanana> then you're better off with pascal lmao
<d_bot> <aolko> php
<d_bot> <theangryepicbanana> tf
<d_bot> <aolko> as of using c, there are cavearts
<d_bot> <theangryepicbanana> you criticize ocaml and then say php is better?
<d_bot> <aolko> took it as "do you use c?"
<d_bot> <theangryepicbanana> php and c are in completely different domains
<d_bot> <aolko> nope, since zend ruins it with each major release
<d_bot> <aolko> same with js and tc39, don't worry
<d_bot> <theangryepicbanana> I really don't care ngl
<d_bot> <Alistair> Make your own language and ecosystem?
<d_bot> <theangryepicbanana> also a side note, you'll never actually escape fp and oop because they technically exist in every language in some way
<d_bot> <aolko> so that means writing a parser generator since i have my own idea of grammars
<companion_cube> @aolko I say that in all seriousness: if you don't like FP, OCaml is not going to be pleasant for you
<companion_cube> look into Zig or Ada or something like that
<d_bot> <aolko> i like fp when it only has *some* of the unnecessary jargon haskell has
<d_bot> <aolko> mainly when it's just about functions and closures, nothing more
<d_bot> <Alistair> types?
<companion_cube> that's pretty watered down FP
<d_bot> <Alistair> ^
<d_bot> <Alistair> Basically lambda calc
<d_bot> <aolko> dynamic, optional
<d_bot> <theangryepicbanana> haskell isn't the primary example of FP
<companion_cube> so, like, 2000-ish JS
<d_bot> <aolko> it's primary example of poisonous fp jargon
<d_bot> <theangryepicbanana> not really
<d_bot> <aolko> ES3*
<d_bot> <Alistair> Types is perhaps the best feature of FP
<d_bot> <aolko> yep, pretty much like ES3
<d_bot> <theangryepicbanana> the "jargon" you're referring to is most likely monads, which aren't really FP-specific, but something more common in "purely functional" languages
<d_bot> <Alistair> Not really, if you accept that mathematicians got to naming useful things first and just learn stuff like monads as functional patterns (like OOP patterns) then it becomes simpler to deal with
<d_bot> <aolko> this specifically https://github.com/hemanth/functional-programming-jargon#:~:text=Haskell%20Turkish-,Table%20of%20Contents,-Arity
<companion_cube> this is remarkably unproductive
<d_bot> <Alistair> You don't need to take a category theory course to know how to use a monad
<companion_cube> @aolko why don't you stick to JS
<d_bot> <theangryepicbanana> purely functional language take up a minority of the FP paradigm, so it's wrong to thing that that make FP bad or complex or whatever
<d_bot> <aolko> TC39 ruined it
<companion_cube> or explore things like clojure, which are also dynamically typed
<companion_cube> and have no |
<companion_cube> you can still use old JS
<d_bot> <Alistair> How about Scala?
<companion_cube> it hasn't disappeared
<d_bot> <theangryepicbanana> companion_cube: agreed. this isn't going anywhere
<d_bot> <aolko> (((clojure))) more like
<d_bot> <theangryepicbanana> oh so you're one of those people
<companion_cube> …
<d_bot> <aolko> scala is weighed down with JVM
<companion_cube> wat
<d_bot> <Alistair> V8 vs JVM lol
<d_bot> <Alistair> Can't imagine which one wins
<companion_cube> JVM
<companion_cube> anyway can we just stop this now?
<d_bot> <theangryepicbanana> companion_cube: i.e snowflakes who think that every language is imperfect (except for one really obscure one) and refuse to believe otherwise (or in other words, actually learn about they languages they complain about)
<d_bot> <Alistair> Yeah, this is unproductive
<d_bot> <aolko> > you can still use old JS
<d_bot> <aolko> the ecosystem is gone
<d_bot> <theangryepicbanana> I'm sure there's a reason for that
<d_bot> <theangryepicbanana> can't quite put my finger on it, eh?
<d_bot> <aolko> one big fat reason is npm
<d_bot> <aolko> and it's hell
<d_bot> <theangryepicbanana> wow, it's like people don't want to use ancient technology anymore
<companion_cube> you could look into lua, it's like old JS
<d_bot> <theangryepicbanana> even internet explorer supports ES5
<companion_cube> (except still useful)
<d_bot> <Alistair> Yeah Lua is good
<d_bot> <aolko> the perception of `ancient` is all in people's heads
<d_bot> <Alistair> And not too slow
<d_bot> <thangngoc89> This conversation is very non-productive
<d_bot> <aolko> lua might be good, sure, bure in some places it's rather clunky
<d_bot> <theangryepicbanana> I like to think that 1999 was a while ago
<d_bot> <Alistair> Well I guess you might have to compromise?
<d_bot> <theangryepicbanana> yeah
<d_bot> <Alistair> There is no perfect language
<d_bot> <Alistair> Ever
<d_bot> <aolko> my compromise is what i told on parser generator
<d_bot> <thangngoc89> ES6 is really a great language
<d_bot> <aolko> it's very bloated
<d_bot> <thangngoc89> The DOM api is bloated
<d_bot> <thangngoc89> The language isn’t
<d_bot> <aolko> ES# was just the barebones you need
<d_bot> <aolko> without all the bloat
<d_bot> <theangryepicbanana> I don't see how that solves your problem
<d_bot> <thangngoc89> You can just ignore all the new features
<d_bot> <theangryepicbanana> aren't you better off using assembly if you care about bloat?