companion_cube changed the topic of #ocaml to: Discussion about the OCaml programming language | http://www.ocaml.org | OCaml 5.0 released(!!1!): https://ocaml.org/releases/5.0.0.html | Try OCaml in your browser: https://try.ocamlpro.com | Public channel logs at https://libera.irclog.whitequark.org/ocaml/
Ekho has quit [Quit: CORE ERROR, SYSTEM HALTED.]
yziquel has quit [Quit: Client closed]
ec_ has joined #ocaml
ec_ has quit [Remote host closed the connection]
ec_ has joined #ocaml
ec has quit [Ping timeout: 246 seconds]
Ekho has joined #ocaml
Ekho has quit [Quit: CORE ERROR, SYSTEM HALTED.]
Ekho has joined #ocaml
ec_ is now known as ec
Ekho has quit [Quit: CORE ERROR, SYSTEM HALTED.]
Ekho has joined #ocaml
myrkraverk_ is now known as myrkraverk
noddy has joined #ocaml
ridcully_ has quit [Ping timeout: 250 seconds]
ridcully_ has joined #ocaml
tizoc has quit [Quit: Coyote finally caught me]
tizoc has joined #ocaml
chrisz has quit [Ping timeout: 246 seconds]
chrisz has joined #ocaml
<discocaml> <crackcomm> I'm calling `time.sleep(10)` using pyml from `Async_unix.Thread_pool` and it blocks entire async event loop, what could be the reason? I'm clearly lacking some critical information
<discocaml> <hockletock> does the python GIL stop everything?
<discocaml> <crackcomm> GIL is locked but why would that block OCaml Async event loop?
<discocaml> <crackcomm> I'm running the pyml code in a different thread
<discocaml> <crackcomm> pyml doesn't seem to call `caml_enter_blocking_section` as an alias for `caml_release_runtime_system`, maybe it should?
waleee has quit [Ping timeout: 245 seconds]
<discocaml> <crackcomm> looks like that was it
bartholin has joined #ocaml
<discocaml> <loves_curry> how different is OCaml from SML?
<companion_cube> as different as 2023 and 1990 :)
azimut has joined #ocaml
<discocaml> <loves_curry> lol what
rom1504 has quit [Ping timeout: 255 seconds]
<companion_cube> SML is a standardized language from 1997, with multiple implementations (and an even smaller community)
<companion_cube> OCaml is a single-implementation language that has been evolving for the 26 years since
<companion_cube> it has a lot more features
<companion_cube> you can definitely see the common core (looking past the superficial syntactic differences)
<discocaml> <loves_curry> thanks!
<discocaml> <loves_curry> asking cuz im taking a course using SML
<discocaml> <loves_curry> but i'd rather use OCaml
rom1504 has joined #ocaml
<companion_cube> for a course you probably don't reach the places where the differences are, I suppose
gahr has quit [Remote host closed the connection]
gahr has joined #ocaml
Serpent7776 has joined #ocaml
kurfen has joined #ocaml
bartholin has quit [Quit: Leaving]
justache has quit [Server closed connection]
justache has joined #ocaml
yziquel has joined #ocaml
<yziquel> companion_cube yes. mathematically, hypergraphs are not dead things.
rgrinberg has joined #ocaml
rgrinberg has quit [Ping timeout: 248 seconds]
myrkraverk has quit [Read error: Connection reset by peer]
myrkraverk has joined #ocaml
John_Ivan has quit [Ping timeout: 246 seconds]
yziquel has quit [Quit: Client closed]
src has quit [Server closed connection]
src has joined #ocaml
yziquel has joined #ocaml
kaptch has joined #ocaml
kaptch has quit [Client Quit]
ec has quit [Remote host closed the connection]
ec has joined #ocaml
azimut_ has joined #ocaml
azimut has quit [Ping timeout: 246 seconds]
yziquel has quit [Ping timeout: 245 seconds]
Putonlalla has quit [Ping timeout: 260 seconds]
dnh has joined #ocaml
dnh has quit [Read error: Connection reset by peer]
dnh has joined #ocaml
daftaupe has quit [Server closed connection]
daftaupe has joined #ocaml
Putonlalla has joined #ocaml
<discocaml> <.maverk> hello
<discocaml> <.maverk> new to ocaml
yziquel has joined #ocaml
myrkraverk has quit [Quit: Leaving]
yziquel has quit [Quit: Client closed]
yziquel has joined #ocaml
dnh has quit [Read error: Connection reset by peer]
dnh has joined #ocaml
<companion_cube> o/
yziquel has quit [Quit: Client closed]
<discocaml> <Kali> hello!
rgrinberg has joined #ocaml
dnh has quit [Read error: Connection reset by peer]
dnh has joined #ocaml
rgrinberg has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
myrkraverk has joined #ocaml
dnh has quit [Remote host closed the connection]
<discocaml> <.maverk> can someone help me fix the problem pls
<discocaml> <.maverk> i am getting fatal erro during the installation
Serpent7776 has quit [Ping timeout: 246 seconds]
John_Ivan has joined #ocaml
John_Ivan has quit [Read error: Connection reset by peer]
bartholin has joined #ocaml
John_Ivan has joined #ocaml
John_Ivan has quit [Read error: Connection reset by peer]
John_Ivan has joined #ocaml
waleee has joined #ocaml
TrillionEuroNote has quit [Ping timeout: 255 seconds]
TrillionEuroNote has joined #ocaml
amk has quit [Ping timeout: 245 seconds]
amk has joined #ocaml
<discocaml> <jumpnbrownweasel> Jonahb responded to your post in the #windows-support channel
rgrinberg has joined #ocaml
jusensei2 has quit [Ping timeout: 255 seconds]
jusensei2 has joined #ocaml
rgrinberg has quit [Client Quit]
jusensei2 has quit [Ping timeout: 245 seconds]
jusensei2 has joined #ocaml
rgrinberg has joined #ocaml
waleee has quit [Ping timeout: 248 seconds]
waleee has joined #ocaml
dnh has joined #ocaml
Tuplanolla has joined #ocaml
dnh has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
dnh has joined #ocaml
myrkraverk has quit [Quit: Leaving]
Anarchos has joined #ocaml
yziquel has joined #ocaml
<discocaml> <.maverk> why is ``not maverk`` ?
<discocaml> <.maverk> why is it ``not maverk`` ?
<discocaml> <Kali> `==` is for physical equality (by reference), not structural equality (by value)
<discocaml> <Kali> use `=` for structural equality
<discocaml> <.maverk> yayy it works
<discocaml> <Kali> `;;` is unnecessary in a compiled file
<discocaml> <Kali> it is only for terminating expressions in a toplevel
<discocaml> <.maverk> so ``==`` when comparing memory addresses ?
<discocaml> <Kali> yes
<discocaml> <.maverk> i understand
<discocaml> <.maverk> if i don't include ``;;`` it will show an error
<discocaml> <Kali> that is because you have a toplevel `if`
<discocaml> <Kali> ```ocaml
<discocaml> <Kali> let name = "maverk"
<discocaml> <Kali>
<discocaml> <Kali> let () =
<discocaml> <Kali> if name = "maverk"
<discocaml> <Kali> then Printf.printf "true : maverk"
<discocaml> <Kali> else Printf.printf "false : not maverk"
<discocaml> <Kali> ```
<discocaml> <.maverk> very interesting
<discocaml> <.maverk> i like ocaml 😃
<discocaml> <Kali> ocaml ignores whitespace, so if you have an expression at the toplevel, then it is really part of the last expression
<discocaml> <Kali> that can be fixed by putting it into an appropriate let binding
<discocaml> <Kali> such as the one above
<discocaml> <.maverk> i do spaces for convention
<technomancy> is it just as simple as "every top-level thing needs to be a let" or is there more to it than that?
<discocaml> <.maverk> to avoid confusion
<discocaml> <Kali> the spaces don't matter, it's the fact that you would be applying a string to a unit without the let-binding or ;;
<technomancy> I don't feel like I've quite been able to put my finger on the rules for what's allowed; when you need semicolons, etc
<discocaml> <Kali> technomancy: or a type/module declaration
<technomancy> Kali: right; ok. cool, thanks.
<technomancy> the point being, some kind of declaration, I guess
<discocaml> <Kali> everything else should be a let-binding
<discocaml> <Kali> `;` is to chain side effects
<discocaml> <Kali> `;;` terminates an expression in the toplevel
<technomancy> for a side-effect that's inside a function, is it better to use ; or to do a let () = whatever ?
<discocaml> <Kali> `;` is more conventional
<discocaml> <Kali> `;` has a more permissive warning than `let () = ` if you try to give it a non-unit value
Anarchos has quit [Quit: Vision[]: i've been blurred!]
<discocaml> <Kali> let () = correctly fails with a type error
<technomancy> aha, makes sense
<companion_cube> just use the flag -strict-sequence
<companion_cube> always
<discocaml> <.maverk> wait a minute what is this line suppose to tell me ?
<discocaml> <.maverk>
<companion_cube> (should be default really)
<discocaml> <.maverk> ``let () = ``
<technomancy> so it depends on how picky you're being about separating side-effects from values
<discocaml> <Kali> it means that Printf.printf returns a unit
<discocaml> <Kali> you are simply matching on a unit value
<technomancy> companion_cube: so with that flag enabled, it's just two different notations for writing the same thing?
<discocaml> <Kali> and since there is only one value of type unit, you can literally match it
<technomancy> you could think of ; as syntactic sugar for let () = ... in ?
<discocaml> <Kali> sure
<technomancy> that's helpful
<technomancy> normal people: "sure, I know what semicolons are for; makes perfect sense" / me: *overthinking it and getting confused*
<companion_cube> th this flag, in `a; b`, `a:unit` is mandatory
<companion_cube> I just find `;` more readable
<discocaml> <Kali> easier to type
<discocaml> <Kali> yeah
<discocaml> <Kali> `;;` is strictly unnecessary in compiled files assuming all toplevel things are declarations of some sort (value, type, or module)
<technomancy> the fact that ; only works inside a function kind of obscures the fact that otherwise they are equivalent
<technomancy> at least, that's what confused me about it
<discocaml> <Kali> does it not work outside of a function?
<discocaml> <Kali> (rhetorical question)
<technomancy> I thought you said that earlier
<discocaml> <.maverk> and :: means it doesn't return a unit ?
<technomancy> sorry, not outside a function, but rather at the top level
<discocaml> <Kali> `;` does work at the toplevel, it's just not recommended to have expressions at the toplevel at all
<technomancy> ah, I didn't realize that was just a recommendation, not a rule
<discocaml> <octachron> `phrase;;` doesn't put any constraint on `phrase`.
<discocaml> <octachron> which is useful in the REPL when you enter `1;;`, and error-prone outside of the REPL.
<discocaml> <Kali> it is perfectly allowed to have them at top-level, it just means you need to write your code like it is in a repl, which looks gross (in my opinion) and can lead to errors if you forget ;;
<discocaml> <Kali> indeed
<discocaml> <Kali> note that parentheses are unnecessary for calling function
<discocaml> <Kali> *functions
<discocaml> <.maverk> very interesting
<discocaml> <.maverk> how so ?
<discocaml> <Kali> `Printf.printf "true"`
<discocaml> <.maverk> aww
<discocaml> <.maverk> let me try
<discocaml> <.maverk> oky this makes the language enjoyable
<discocaml> <.maverk> 😄
<discocaml> <Kali> technomancy: observe the following
<discocaml> <Kali> ```ocaml
<discocaml> <Kali> print_endline "hello world";; print_endline "asdf";; print_int 5;;
<discocaml> <Kali> ``` vs ```ocaml
<discocaml> <Kali> let () =
<discocaml> <Kali> print_endline "hello world"; print_endline "asdf"; print_int 5
<discocaml> <Kali> ```
<discocaml> <Kali> the first is prone to error, were i to add anything in front of it and forget ;;
<discocaml> <.maverk> awww
<discocaml> <Kali> the second looks nicer and does not suffer from this problem
<discocaml> <.maverk> i have just discoverd something
<discocaml> <.maverk> yaaaay
<discocaml> <.maverk> the wild card
<discocaml> <.maverk> can also be used as an indentifier
<companion_cube> that's a type error waiting to happen tho
<companion_cube> I mean, a partial application that won't do anything
<companion_cube> I use `let() = …` for toplevel bindings (i.e. `main`), and nowhere else
<discocaml> <._null._> technomancy: what's allowed at top-level (which is exactly the same as "module-level" is your usual definitions, type definitions, modules, module types and, expressions if separated from let-definitions (at least, maybe from other kinds of things too) by ;;
<discocaml> <.maverk> i cannot import websocket
<discocaml> <.maverk> i installed it
<discocaml> <Kali> that's not how you import
<discocaml> <._null._> That's not how you import stuff
<discocaml> <.maverk> opam install websocket 2.15
<discocaml> <.maverk> how ?
<discocaml> <._null._> You link it at compile time (usually not manually)
<technomancy> _null_ right, so there seems to be a difference depending on who you ask, haha
<technomancy> "what does the language allow" vs "what do I personally think is permissable"
<discocaml> <Kali> use `#require "websocket"` if you're running the file with `ocaml` or `utop`
<discocaml> <._null._> I agree it's bad style to have top-level expressions, I still prefer to tell it's allowed
<discocaml> <Kali> it is generally advisable to use a build system such as dune to link for you, however
<discocaml> <Kali> oops, add ;; after "websocket"
<discocaml> <.maverk> i did
<discocaml> <.maverk> and said unknown directive
<discocaml> <Kali> what are you running the file with
<discocaml> <Kali> like what program
<discocaml> <.maverk> i use ocaml
<discocaml> <Kali> `opam install topfind` and try again
<discocaml> <Kali> actually, no, `opam install utop`
<discocaml> <Kali> then run the file with utop
<discocaml> <Kali> yes
<discocaml> <Kali> let's move to #beginners
<discocaml> <.maverk> ok
<discocaml> <jumpnbrownweasel> also please post text if you can
rgrinberg has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
kurfen has quit [Ping timeout: 245 seconds]
kurfen has joined #ocaml
Tuplanolla has quit [Quit: Leaving.]
rgrinberg has joined #ocaml
bartholin has quit [Quit: Leaving]
yziquel has quit [Quit: Client closed]
yziquel has joined #ocaml
myrkraverk has joined #ocaml
azimut_ has quit [Ping timeout: 246 seconds]
yziquel has quit [Quit: Client closed]
<discocaml> <eclectich> Same
dnh has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
yziquel has joined #ocaml
myrkraverk has quit [Remote host closed the connection]
myrkraverk has joined #ocaml
Soni has quit [Server closed connection]
soni_ is now known as soni
SoniEx2 has joined #ocaml
yziquel has quit [Quit: Client closed]
yziquel has joined #ocaml
dnh has joined #ocaml
ocabot has quit [Server closed connection]
ocabot has joined #ocaml
dnh has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
rgrinberg has quit [Quit: My Mac has gone to sleep. ZZZzzz…]