alexherbo2 has quit [Remote host closed the connection]
alexherbo2 has joined #ocaml
alexherbo2 has quit [Remote host closed the connection]
softmoth has joined #ocaml
YuGiOhJCJ has joined #ocaml
raskol has quit [Ping timeout: 252 seconds]
torretto has quit [Ping timeout: 260 seconds]
torretto has joined #ocaml
myrkraverk has joined #ocaml
myrkraverk has quit [Read error: Connection reset by peer]
myrkraverk_ has quit [Ping timeout: 252 seconds]
myrkraverk has joined #ocaml
myrkraverk_ has joined #ocaml
myrkraverk has quit [Ping timeout: 252 seconds]
euphores has quit [Quit: Leaving.]
euphores has joined #ocaml
mbuf has joined #ocaml
bartholin has joined #ocaml
Serpent7776 has joined #ocaml
softmoth has quit [Read error: Connection reset by peer]
softmoth has joined #ocaml
softmoth_ has joined #ocaml
softmoth has quit [Read error: Connection reset by peer]
bhoot has joined #ocaml
bhoot has quit [Client Quit]
bartholin has quit [Quit: Leaving]
mrtz has joined #ocaml
mrtz has quit [Remote host closed the connection]
softmoth__ has joined #ocaml
softmoth_ has quit [Read error: Connection reset by peer]
toastal has left #ocaml [Error from remote client]
softmoth__ has quit [Read error: Connection reset by peer]
softmoth has joined #ocaml
softmoth has quit [Read error: Connection reset by peer]
softmoth has joined #ocaml
softmoth_ has joined #ocaml
softmoth has quit [Read error: Connection reset by peer]
softmoth_ has quit [Read error: Connection reset by peer]
softmoth has joined #ocaml
softmoth has quit [Ping timeout: 246 seconds]
hsw has quit [Remote host closed the connection]
hsw has joined #ocaml
malte has quit [Remote host closed the connection]
alexherbo2 has joined #ocaml
YuGiOhJCJ has quit [Quit: YuGiOhJCJ]
<discocaml>
<reynir1396> Can you call `caml_record_backtraces(1)` before `caml_startup()`? It sounds a bit like you can from the documentation, but it's not obvious to me
<discocaml>
<otini_> Looking at the implementation, it transitively calls `caml_modify_generational_global_root` so Iโm dubious of the comment that says it can be called before GC init
<discocaml>
<otini_> in fact it reads `Caml_state`
toastal has joined #ocaml
<discocaml>
<otini_> I asked around on the #compiler channel on Slack
alexherbo2 has quit [Remote host closed the connection]
alexherbo2 has joined #ocaml
Haudegen has joined #ocaml
alexherbo2 has quit [Remote host closed the connection]
<discocaml>
<softwaresirppi> guys
<discocaml>
<softwaresirppi> why do we have duplicate functions?
<discocaml>
<softwaresirppi> like `string_of_int` and `Int.to_string`
<discocaml>
<._null._> These two are for historical reasons (the module Int is much more recent than `string_of_int`)
<discocaml>
<softwaresirppi> so i should prefer `Type.to_type`?
<discocaml>
<._null._> I guess. I always use printf or format for these kinds of things
<discocaml>
<softwaresirppi> for int->float kinda stuff?
<discocaml>
<softwaresirppi> what you do?
<discocaml>
<._null._> For `to_string` specifically
tremon has joined #ocaml
<discocaml>
<softwaresirppi> (im a noob in ocaml by the way)
<discocaml>
<._null._> I generally don't use floats, but you can use function `float`
<discocaml>
<softwaresirppi> damn
<discocaml>
<softwaresirppi> a type is also a function
<discocaml>
<softwaresirppi> smells like python
<discocaml>
<softwaresirppi> what else you use to do fractions?
<discocaml>
<._null._> It's not, there are two namespaces and we don't refrain from having values with the same name in both
<discocaml>
<._null._> I generally don't do fractions; I'm not representative of programmers in general
<discocaml>
<softwaresirppi> Ohh so the type-world is a different namespace and the value-function-world is a different one
<discocaml>
<softwaresirppi> oh interesting
<discocaml>
<softwaresirppi> tell me more about you
<discocaml>
<softwaresirppi> Ugh an external library just to do arbitrary precision ints?
<discocaml>
<softwaresirppi> I prefer not to use external libs
<discocaml>
<softwaresirppi> But yeah the lib is cool
<discocaml>
<softwaresirppi> Anyways I'd like to know more about the "Ocaml mindset"
<discocaml>
<softwaresirppi> It' feels like a mix of Haskell and C++
<discocaml>
<softwaresirppi> It' feels like a mix of Haskell and C
<discocaml>
<softwaresirppi> It feels like a mix of Haskell and C
softmoth_ has joined #ocaml
softmoth has quit [Read error: Connection reset by peer]
spew has joined #ocaml
Geekingfrog has left #ocaml [Leaving]
<discocaml>
<contificate> OCaml mindset is valuing your time (avoiding C as much as possible) and valuing your time (avoiding coding yourself into a type-tetris'd hole in Haskell)
alexherbo2 has joined #ocaml
Serpent7776 has quit [Ping timeout: 245 seconds]
Serpent7776 has joined #ocaml
<rustyne>
softwaresirppi: "an external library just to do arbitrary precision ints?" what else would you rather do?
<rustyne>
Iโd rather not link gmp in every binary, for instance
kakadu has joined #ocaml
<discocaml>
<softwaresirppi> cool
<discocaml>
<softwaresirppi> yeah the "gnu" in the name kinda scares me
<discocaml>
<sim642> "num" used to be an arbitrary precision integer library within the standard library (more or less), but it's essentially deprecated by zarith
<discocaml>
<softwaresirppi> why two keywords for anonymous functions? `fun` and `function`?
<discocaml>
<softwaresirppi> i thought ocaml is a new language
<discocaml>
<softwaresirppi> seems like it has a bit of backwards compatible baggage
<discocaml>
<._null._> `function` is a shortcut for `fun x -> match x with`
<discocaml>
<._null._> According to Wikipedia, first version of OCaml was in 1996, and it was a successor to existing languages at that time. So it's not really young
<discocaml>
<softwaresirppi> DAMN
<discocaml>
<softwaresirppi> REALLY!?
<discocaml>
<softwaresirppi> that looks promising
<discocaml>
<softwaresirppi> i wonder why it isnt mainstream yet
<discocaml>
<softwaresirppi> solid language features
<discocaml>
<softwaresirppi> the only thing i question is the use of exceptions (as opposed to an option type)
<discocaml>
<softwaresirppi> the only thing i question is the use of exceptions (as opposed to a Maybe type)
<discocaml>
<qrpnxz> really really
<discocaml>
<softwaresirppi> lol russel, what up!
bartholin has joined #ocaml
<discocaml>
<qrpnxz> what about em
<discocaml>
<softwaresirppi> dont you think Option<T> types are better than exceptions?
<discocaml>
<softwaresirppi> because it could be handled more gracefully and it forces you to handle them?
<discocaml>
<softwaresirppi> for example, if i catch an exception i have no idea if its coming from one level deep or a 100 function calls deep
<discocaml>
<qrpnxz> Sometimes. Sometimes not. Both are useful.
<discocaml>
<softwaresirppi> elaborate!
<discocaml>
<softwaresirppi> also ocaml has functional and object oriented paradigm. your thoughts ?
<discocaml>
<softwaresirppi> `
<discocaml>
<softwaresirppi> its kinda cool that `let add x y = x + y` and `let add = fun x -> fun y -> x + y` have the same type signature lol
<discocaml>
<softwaresirppi> `
<discocaml>
<softwaresirppi> its kinda cool that `let add x y = x + y` and
<discocaml>
<softwaresirppi> `let add = fun x -> fun y -> x + y` have the same type signature lol
<discocaml>
<softwaresirppi> its kinda cool that `let add x y = x + y` and `let add = fun x -> fun y -> x + y` have the same type signature lol
<discocaml>
<qrpnxz> Threading `option` can be annoying and expensive. Exception can cancel big nested computations immediately and completely without decorating a bunch of code that doesn't care about the error except to propagate it.
<discocaml>
<qrpnxz>
<discocaml>
<qrpnxz> You surely want exceptions because of things like Out_of_memory. You wouldn't want everything to look like `OK of 'a | Out_of_memory`, would you? Users have errors like that too that should just be exceptions.
<discocaml>
<qrpnxz>
<discocaml>
<qrpnxz> Also, it's the only way to break loops, break out iter, generally early return. It acts as a general control flow mechanism.
<discocaml>
<softwaresirppi> thats a good point. We can use Exceptions when we cant afford an option value propagation.
<discocaml>
<qrpnxz> I haven't used the OO bits yet, but I like that they are there for when they are a good fit.
<discocaml>
<softwaresirppi> i see
<discocaml>
<qrpnxz> I mean, i've used them like tried them, but in my projects I haven't had much use for them.
<discocaml>
<softwaresirppi> it kinda feels wrong having mutable state
<discocaml>
<softwaresirppi> but fine maybe its useful when making data structures or somethin
<discocaml>
<qrpnxz> Mutability is quite a bit more controlled in OCaml compared to other languages.
<discocaml>
<qrpnxz> Record fields have to be explicitly `mutable` to change
<discocaml>
<qrpnxz> `let x = "x cannot mutate"`
<discocaml>
<Kali> that's because the first is shorthand for the second
<discocaml>
<._null._> You can also notice that `add` has the same type as `(+)` also (that would be currying)
<discocaml>
<softwaresirppi> cool featureee
<discocaml>
<softwaresirppi> lambdasss
<discocaml>
<softwaresirppi> also you could build `let` from lambdas
<discocaml>
<softwaresirppi> `let x = 69 in x + 1` could be written as `(fun x -> x + 1) 69`
<discocaml>
<._null._> No, that's not always the case
<discocaml>
<softwaresirppi> quite cool. a variable is a substitution at point. a function is a substitution when calling.
<discocaml>
<softwaresirppi> !! why not
<discocaml>
<._null._> Only `let` allows free type variables to be generalized as a universal
<discocaml>
<qrpnxz> `let` is more powerful ๐ ๐
<discocaml>
<softwaresirppi> example? you forgot imaa noobie
<discocaml>
<qrpnxz> It's called let polymorphism
<discocaml>
<._null._> i.e., `(fun f -> (f 0, f 0.)) (fun x -> x)` won't work
<discocaml>
<Kali> `let x = fun y -> y in string_of_int (x 3) ^ x "4"` is fine
<discocaml>
<Kali> `(fun x -> string_of_int (x 3) ^ x "4") (fun y -> y)` is invalid
<discocaml>
<softwaresirppi> REALLY!? ๐ข
<discocaml>
<qrpnxz> really really
<discocaml>
<softwaresirppi> so the compiler fixes on a specific type argument
<discocaml>
<softwaresirppi> saddd
<discocaml>
<qrpnxz> For that to work, type inference could not work.
<discocaml>
<softwaresirppi> okay i get that thanks
<discocaml>
<softwaresirppi> sadd
<discocaml>
<._null._> (If free type variable generalization happened at `fun`, they would all work I think)
<discocaml>
<softwaresirppi> doesnt this make ocaml not referencial transparant?
<discocaml>
<softwaresirppi> it makes lambdas less powerful?
cross has quit [Remote host closed the connection]
<discocaml>
<Kali> ocaml was already not referentially transparent with mutability
<discocaml>
<Kali> and objects
<discocaml>
<softwaresirppi> `(fun f g -> (f 0, g 0.)) (fun x -> x) (fun x -> x)` still this is possible ๐
<discocaml>
<softwaresirppi> ๐ญ
<discocaml>
<Kali> yes, but those are separate arguments that individually get typed to int -> int and float -> float
<discocaml>
<softwaresirppi> alright makes sense
<dh`>
exceptions are bad, but option isn't the answer most of the time
mbuf has quit [Quit: Leaving]
<discocaml>
<softwaresirppi> when will options not work except when we are running out of memory as russel pointed out?
<discocaml>
<softwaresirppi> and yeah exceptions dont smell nice
<discocaml>
<qrpnxz> Exceptions are also good for assertion failure and other kinds of programming errors.
<discocaml>
<softwaresirppi> i would rather panic and crash in that situation
<discocaml>
<softwaresirppi> Go style
<discocaml>
<qrpnxz> that's what exceptions do when you don't catch them
<discocaml>
<softwaresirppi> "when you dont catch them"
<discocaml>
<qrpnxz> and if you are catching them, great! Managing to handle something you ordinarially wouldn't is great
<discocaml>
<qrpnxz> and if you are catching them, great! Managing to handle something you ordinarily wouldn't is great
<discocaml>
<softwaresirppi> ughh okay i guess... im split on that
<discocaml>
<softwaresirppi> what are you guys using ocaml for?
<discocaml>
<softwaresirppi> would like to hear about your stories
myrkraverk__ has joined #ocaml
<discocaml>
<qrpnxz> I'm writing a website with it right now.
<discocaml>
<qrpnxz> Wrote some Lua bindings. Works well
myrkraverk_ has quit [Read error: Connection reset by peer]
<discocaml>
<softwaresirppi> calling lua from ocaml!
<discocaml>
<softwaresirppi> cool
<discocaml>
<softwaresirppi> is it on github?
Tuplanolla has joined #ocaml
<discocaml>
<qrpnxz> no. But i'll publish it if I get time because the there's no good up-to-date lua lib for ocaml that i know
<discocaml>
<qrpnxz> no. But i'll publish it if I get time because there's no good up-to-date lua lib for ocaml that i know
<discocaml>
<qrpnxz> And it turned out pretty nice.
<discocaml>
<qrpnxz> the lua lib, that is, i have no intention to publish the code for the website
<discocaml>
<Kali> i use it as a scripting/general purpose language mostly. it's nice because it is fast and doesn't need type annotations but also has a static type system which avoids the nightmares of forgetting an argument/nil propagation of, say, lua; and it also permits mutability/side effects so i don't have to fight against that like i might in haskell when i'm just scripting; and it's got an easy-to-write-and-read syntax in general
<discocaml>
<Kali> *fast and compiles fast
<discocaml>
<ovecjoe> I didn't think of it in this way... Lambdass ๐
<discocaml>
<softwaresirppi> hello ghost
<discocaml>
<softwaresirppi> cool notify me when done!
Anarchos has joined #ocaml
infinity0 has quit [Ping timeout: 272 seconds]
<discocaml>
<qrpnxz> hope you saw my following message
<discocaml>
<softwaresirppi> same reason i wanna use it for
<adrien>
hi, I'm trying to install stdcompat (actually plotly but it's the same issue) in a switch with ocaml 5.2.0 but I opam throws me "stdcompat >= 19 โ ocaml < 5.2" and I don't understand why as nothing shows such constraints in https://github.com/thierry-martinez/stdcompat/blob/main/stdcompat.opam
<discocaml>
<softwaresirppi> lol i misread it
<discocaml>
<qrpnxz> and I misread your question first ๐
<discocaml>
<softwaresirppi> lol im a noob too bro. doesnt ocaml have a `requirements.txt` file or somethin
<discocaml>
<softwaresirppi> misread and misread cancel out each other lol
<discocaml>
<softwaresirppi> and i know you are using a mobile phone to text
<discocaml>
<ovecjoe> I'm learning OCaml...still the basic stuff though.
<discocaml>
<ovecjoe> I wish... ๐คฃ
<discocaml>
<softwaresirppi> arentt youu
<discocaml>
<softwaresirppi> me too
<Anarchos>
<softwaresirppi> utop is a ocaml enhanced toplevel (with better completion features)
<discocaml>
<softwaresirppi> language looks promising
<discocaml>
<softwaresirppi> i should go all in
<adrien>
._null._: I didn't understand how but the reason is that the opam file in opam-repository is different from the one in stdcompat's repository, thanks
<discocaml>
<ovecjoe> What do you plan to use it for>>
<discocaml>
<ovecjoe> No.
<discocaml>
<softwaresirppi> yeahh so polished
<discocaml>
<softwaresirppi> i wanna do pure computer science, data science and ML stuff
<discocaml>
<softwaresirppi> mainly
<discocaml>
<softwaresirppi> and also a bit of general stuff
<discocaml>
<softwaresirppi> i want clean programs and full functional support
<discocaml>
<softwaresirppi> i guessed based on your capitalization
<discocaml>
<softwaresirppi> @ovecjoe what got you to Ocaml?
<Anarchos>
<softwaresirppi> Ocaml got an award. https://www.sigplan.org/Awards/Software/ Notice Compcert too, which is a C compiler in OCaml, whose Ocaml part is extract from a formal specification written in Coq. Coq itself is written in Ocaml.
<discocaml>
<ovecjoe> Similar here, so replace data science and ML with cybersecurity
<discocaml>
<softwaresirppi> also this!!! i want to write parsers!!
<discocaml>
<softwaresirppi> Hooraay!! im sick of modern programming like javascript and stuff
<Anarchos>
<softwaresirppi> look for the menhir tool for parser generating.
<discocaml>
<softwaresirppi> wow thats such a honor to ocaml
<discocaml>
<ovecjoe> Same here... I want to build stuff that is more focused security and stuff.
<discocaml>
<softwaresirppi> i have no idea about networking. how do you learn that?
<discocaml>
<softwaresirppi> i cant just recursive descent? ๐
<discocaml>
<ovecjoe> I just know the basis of it... It is very wide.
<discocaml>
<softwaresirppi> alright
<discocaml>
<softwaresirppi> im in my hoe phase right now... im trying out many langauges and things to see which fits me
<discocaml>
<softwaresirppi> lol
<discocaml>
<ovecjoe> Cool...
<discocaml>
<softwaresirppi> okay ill go resume my ocaml playlist
<discocaml>
<softwaresirppi> @ovecjoe feel free to share anything cool thoughts you found in ocaml
<discocaml>
<softwaresirppi> @ovecjoe feel free to share any cool thoughts you found in ocaml
<discocaml>
<qrpnxz> Can't imagine ocamlyacc gives a worse error than no error. All menhir does is tell you "There was an error!"
<discocaml>
<softwaresirppi> you use haiku?!
<discocaml>
<softwaresirppi> lol
<discocaml>
<qrpnxz> Tried to hack it to give better errors, but then i had to dive into nasty internals and gave up
<Anarchos>
qrpnxz i use "menhir --explain"
<discocaml>
<._null._> The compiler uses menhir and has useful errors
<Anarchos>
<softwaresirppi> yes i use haiku on daily basis and on bare metal for 15y
<discocaml>
<qrpnxz> `--explain.โโ This switch causes conflict explanations to be written to the file basename.conflicts. See also ยง6.`
<discocaml>
<qrpnxz> > When a shift/reduce or reduce/reduce conflict is detected, it is classified as either benign, if it can be resolved by consulting user-supplied precedence declarations, or severe, if it cannot. Benign conflicts are not reported. Severe conflicts are reported and, if the --explain switch is on, explained.
<discocaml>
<softwaresirppi> who are you Anarchos!?
<discocaml>
<softwaresirppi> legendary'
<discocaml>
<softwaresirppi> youve been on haiku since i was 5 years old
<Anarchos>
<softwaresirppi> we have all our own age. I am 45
<discocaml>
<qrpnxz> yes, it's a big taunt that hypothetically, with enough work, good errors could be given. I don't have the time to figure it out. I regret the time i did pour into that
<discocaml>
<softwaresirppi> so youre saying we are all walking and talking mutable states lol
<discocaml>
<softwaresirppi> anyways Anarchos what do you do on haiku os?
<discocaml>
<softwaresirppi> and can i see your configs or something?
<discocaml>
<softwaresirppi> what will you do if some software isnt available on haiku?
<dh`>
options become oogly when you have long chains of operations that can fail, because the chain becomes a nest and falls off the right side of the screen
<dh`>
rust has some constructs for preventing that but they're all fairly oogly as well
<Anarchos>
softwaresirppi i port it : i ported LaTeX, OCaml , for examples
<Anarchos>
and lablgtk3 to be able to compile coq too
<discocaml>
<softwaresirppi> also your text editor of choice?
<Anarchos>
vim
<discocaml>
<softwaresirppi> fair enough
<discocaml>
<softwaresirppi> wow i wanna grow up to be like you
<discocaml>
<softwaresirppi> what if you cant find build dependencies or libraries?
<dh`>
qrpnxz: automatically generating decent parse errors is still a research problem I'm afraid
<discocaml>
<softwaresirppi> cmon anarchos, you gotta share your vimrc and your config filess
<dh`>
but not an intractable one
<discocaml>
<ovecjoe> Very true!
<Anarchos>
softwaresirppi why ?
<discocaml>
<softwaresirppi> so that i get inspiredddd
<Anarchos>
softwaresirppi : try, test, learn. You will better your skills than copy mine.
<discocaml>
<softwaresirppi> i dont even use vim... im just curious
toastal has quit [Ping timeout: 248 seconds]
<discocaml>
<softwaresirppi> you are a cool person
<discocaml>
<softwaresirppi> i think youre just recommending me this vim defaults
<Anarchos>
no i am no tpope, and not pope.
<discocaml>
<softwaresirppi> yeah looks good
<discocaml>
<softwaresirppi> but i use kakoune which is sensible by default
<discocaml>
<softwaresirppi> awezome
gareppa has joined #ocaml
toastal has joined #ocaml
Anarchos has quit [Quit: Vision[]: i've been blurred!]
<discocaml>
<softwaresirppi> guys guys if i have a function `f x y` and i apply it like `f 2` here function gets curried with x being 2. but WHAT IF i wanna curry the second argument?
<discocaml>
<softwaresirppi> giving y a value and keeping x a mystery?
<discocaml>
<._null._> Do it the normal way
<discocaml>
<._null._> `fun x -> f x 2`
<discocaml>
<softwaresirppi> not any fancy swap syntax?
<discocaml>
<softwaresirppi> alrighttt *sob*
<discocaml>
<softwaresirppi> also i really think ocaml should have used a different syntax for comments
<discocaml>
<._null._> Fun.swap exists, but I find it obscures more than anything else
<discocaml>
<softwaresirppi> (* this is kinda bad *)
<discocaml>
<softwaresirppi> cause then i cant do `(*) 1 1`
<discocaml>
<softwaresirppi> it thinks that multiplication operator is a comment
<discocaml>
<._null._> Add spaces
<discocaml>
<softwaresirppi> Oh!
<discocaml>
<softwaresirppi> thats a hack
<discocaml>
<._null._> It's also the "official" name of `( * )`
<discocaml>
<softwaresirppi> could you please link up docs? i couldnt find that function
<discocaml>
<softwaresirppi> ummmmmmmmm
<discocaml>
<gooby_clown> If you want fancy you could do `Fun.flip f y` ig
<discocaml>
<gooby_clown> But it's not idiomatic
<discocaml>
<._null._> My bad, it's called flip and not swap
<discocaml>
<softwaresirppi> yeah we havin fun here... i promise i wont use it in serious contexts
<discocaml>
<contificate> You can also use labelled arguments and then effectively do currying at any position you want
<discocaml>
<gooby_clown> If golfing is your definition of cool x)
<discocaml>
<contificate> or "partial application" to be precise
<discocaml>
<softwaresirppi> is that a thing in ocaml!!!
<discocaml>
<softwaresirppi> another reason to love ocaml
<discocaml>
<contificate> Yes, `let f ~x ~y = x + y`
<discocaml>
<contificate> now you can just `f ~x:3`
<discocaml>
<contificate> `f ~y:4`
<discocaml>
<gooby_clown> Yes but honestly overusing named arguments is obnoxious, because you aren't supposed to use them in unnamed way so it adds syntax overhead
<discocaml>
<softwaresirppi> ! i love itttt
<discocaml>
<contificate> I used to dislike them, but now I think they're just necessary in large codebases.
<discocaml>
<softwaresirppi> my first language had them so i got used to it
<discocaml>
<gooby_clown> I agree, but not for Jane-esque `map ~f xs`
<discocaml>
<contificate> You get to this place where you're propagating arguments through and, to avoid nonsense like: `f ~x:almost_called_x`, people feel compelled to make their local binding called `x` so it's just `f ~x` - so we can't be obfuscated by people who disagree with our names
<discocaml>
<softwaresirppi> lol yeah im not going that deep
<discocaml>
<softwaresirppi> were not making DSLs over here
<discocaml>
<qrpnxz> I tried messing around with it, but idk how these relate to the grammar I wrote. It's hard to translate the state given into a useful error without knowing a bunch about internals. It got to where it was just easier (it seems to me) to write the parser myself than figure out how this works. The point of generating is that I don't have to write it, but if I have to get this intimate, I'm losing the benefit.
<discocaml>
<contificate> I would recommend handwriting a parser, to be honest
<discocaml>
<softwaresirppi> recursive descent?
<discocaml>
<contificate> menhir is really great for an LR parser generator, but there's no doubt that you need to really be content with tracking the internals of the generated parser to know what you're doing
<discocaml>
<contificate> yes, recursive descent - but then Pratt parsing for anything more involved
<discocaml>
<softwaresirppi> lol guys i can `let ( + ) x y = x * y` override operators !!
<discocaml>
<gooby_clown> :ocaml:
<discocaml>
<softwaresirppi> imagine putting it in someones codebase and let him debug the hell outta it
<discocaml>
<contificate> if it's any consolation, @qrpnxz , the original Caml Light grammar was considered very tedious in the beginning
<discocaml>
<contificate> I suspect it's still quite tedious to change OCaml's grammar even today
<discocaml>
<qrpnxz> MLs have tricky syntax fr
<discocaml>
<contificate> Pratt parsing just takes a lot of the complexity away
<discocaml>
<contificate> because application-via-juxtaposition is like the perfect case for left denotations
<discocaml>
<contificate> whereas in LR parsing, you are having to factor things to avoid writing a grammar that looks like: `expr: expr expr`
<discocaml>
<gooby_clown> ML syntax is a gimmick tbh, nothing wrong with some braces and parentheses
<discocaml>
<contificate> I remember learning the module system and honestly believing it was like rote learning, it's quite keyword heavy
<discocaml>
<contificate> I think it's a good thing that OCaml doesn't have an SML/Haskell/Agda/etc. notion of specifying arbitrary fixity and precedence levels etc. so it has that going for it
softmoth_ has quit [Read error: Connection reset by peer]
<discocaml>
<softwaresirppi> goated feature right there
<discocaml>
<._null._> Couldn't exist if applications weren't by juxtaposition
<discocaml>
<._null._> Wait yes it could
<discocaml>
<contificate> I must say I find the overuse of `|>` to be a mess
<discocaml>
<softwaresirppi> lets live in mess then lol
<discocaml>
<contificate> sorry, we run the code through grepping software that finds overuse of `|>` and `@@` and won't accept it until it's below a threshold
<discocaml>
<softwaresirppi> thats evillll
<discocaml>
<contificate> gotta ask yourself "why is @@ so ugly" and then you'll realise
<discocaml>
<softwaresirppi> its not ugly though
<discocaml>
<softwaresirppi> do you think its ugly?
<discocaml>
<contificate> Yes, I would ban its infix usage in my codebases
<discocaml>
<softwaresirppi> PERFORM f @@ x
<discocaml>
<softwaresirppi> lol
<discocaml>
<softwaresirppi> im getting banned
<discocaml>
<._null._> @@ as a terminator can be fine, as an infix operator it's extremely heavy
<discocaml>
<softwaresirppi> heavy?
<discocaml>
<qrpnxz> >ban infix
<discocaml>
<qrpnxz> ok then: `(@@) f ((@@) g x)` ๐ถ
<discocaml>
<softwaresirppi> it looks like frog eyes
<discocaml>
<contificate> In Haskell, you use `$` which is less noisy. I just can't believe people write like `f @@ g y`
<discocaml>
<qrpnxz> well, @@ is standard, which means immediately understood by OCamlrs
<discocaml>
<qrpnxz> standard beats slightly prettier
<discocaml>
<contificate> only time you should use `@@` is in the context of defining a let-operator for usage with CPS
<discocaml>
<qrpnxz> besides, idk if $ is even allowed because fixity etc is tied to characters in ocaml
<discocaml>
<contificate> yeah, the infix tokens are in levels, determined by first character
<discocaml>
<softwaresirppi> @contificate i have a gift for you. let me show you how to add 1 and 2. `(@@) (@@) (@@) (@@) (@@) (@@) (@@) (@@) (@@) (@@) ( + ) 1 2`
<discocaml>
<qrpnxz> yea, $ wouldn't work, it associates slightly weaker to the left
<discocaml>
<softwaresirppi> `(@@) f` evalutes to f
<discocaml>
<octachron> @contificate , modifying the OCaml syntax is rather simple, once you have no conflicts, you know that your changes don't conflict with any existing code. I am far more worried about lexer change ... or far far worse, the discussion about the new syntax.
<discocaml>
<contificate> it's not about it working, I'm just noting that I don't have the same complaint about syntax noise in Haskell, by comparison - instead, I'm like: "this is bad because it's Haskell"
<discocaml>
<gooby_clown> It's nice when you have `[short expr] @@ [long expr]`
<discocaml>
<gooby_clown> Otherwise I just put parens personally
<discocaml>
<softwaresirppi> lisp user spotted
<discocaml>
<contificate> new syntax additions seem problematic in LR grammars
<discocaml>
<contificate> I say "seem" but I know for a fact they are
<discocaml>
<contificate> you can't just easily juggle `%prec` stuff without having a brain with neural connections formed by weeks of looking at some huge grammar's structure
<discocaml>
<softwaresirppi> okay guys im gonna sleep
<discocaml>
<contificate> so fragile
<discocaml>
<softwaresirppi> good night
<discocaml>
<gooby_clown> I find parenphobia one can see from e.g. Haskellers more bizarre than Lisper love for them tbh xd
<discocaml>
<softwaresirppi> lol
<discocaml>
<gooby_clown> Oh no, an unambiguous, visual indicator of grouping, how can this be, the horror
<discocaml>
<contificate> may good taste about OCaml style be revealed to you in a dream, Sirppi, night
<discocaml>
<qrpnxz> i don't like grouping what is essentially going to be "the rest of the program". Same reason I don't do `let f x = begin ... end`
<discocaml>
<qrpnxz> (unless i have to)
malte has joined #ocaml
softmoth_ has quit [Ping timeout: 252 seconds]
malte has quit [Remote host closed the connection]
gareppa has quit [Quit: WeeChat 4.1.1]
malte has joined #ocaml
bartholin has quit [Quit: Leaving]
alexherbo2 has quit [Remote host closed the connection]
malte has quit [Remote host closed the connection]
malte has joined #ocaml
kakadu has quit [Remote host closed the connection]
malte has quit [Remote host closed the connection]
Serpent7776 has quit [Ping timeout: 252 seconds]
<discocaml>
<lewiscampbell> don't all the lisp dialects have some kind of pipe macro now so they can write less parens? ๐
raskol has joined #ocaml
<discocaml>
<qrpnxz> oh yea, I guess you could write a syntax-rules that goes that. Should be pretty easy to just apply arguments up to some delimiter symbol.
<discocaml>
<qrpnxz> oh yea, I guess you could write a syntax-rules that does that. Should be pretty easy to just apply arguments up to some delimiter symbol.
malte has joined #ocaml
malte has quit [Remote host closed the connection]
malte has joined #ocaml
malte has quit [Remote host closed the connection]