<discocaml>
<empathy.monster> Under the section Criticism and Prevention is this statement: In some expression-oriented languages, expressions that merely cause side effects return void types.
<discocaml>
<empathy.monster>
<discocaml>
<empathy.monster> I'm trying to understand, is this just merely a statement of fact, a criticism, or prevention? Or perhaps neither?
<discocaml>
<edhebi> considering the number of notes on this page, I'm really not sure anyone knows
<discocaml>
<empathy.monster> Yeah, wikipedia can be a mess sometimes
<discocaml>
<empathy.monster> Okay, well here's what I'm trying to understand. If a language allows only an if (here's the question, statement or expression?) that's not required to be followed by an else block, and that if only prints to the console and returns void, is that an if statement or expression? Because that's not my understanding of an expression, but I was told it is an expression. And in the Ocaml Learn section, and even Haskell material, care is usua
<discocaml>
<empathy.monster> The language is imperative, but it's expression-oriented
<discocaml>
<biscotte9682> The `if` construct in ocaml is always an expression, `if b then e` without `else` is syntax sugar for `if b then e else ()`, however, if you add `;` at the end it becomes a statement
<discocaml>
<empathy.monster> Hi, thank you. I do know that. I'm referring to an imperative language
<discocaml>
<empathy.monster> Your thumbnail lol
<discocaml>
<empathy.monster> I just watched that the other day actually
<discocaml>
<empathy.monster> Let's take the above example: if b then e else () as an expression. Let's take the else clause. That evaluates to a value of unit, or type of unit? If it's type, I'm not understanding how 'evaluating' to a type would be considered an expression, bc my understanding is an expression evaluates to a value.
<discocaml>
<empathy.monster> Or is unit both a type and a value at the same time?
<discocaml>
<octachron> `()` is the one and only value of type `unit`.
<discocaml>
<empathy.monster> Okayyyyy
<discocaml>
<octachron> Thus people tends to name the value `()` unit too from time to time.
Haudegen has quit [Quit: Bin weg.]
<discocaml>
<octachron> because the separation between a category that contains one element and this one element becomes rather hazy.
<discocaml>
<empathy.monster> I see, that clarifies is for me though, ty
<discocaml>
<empathy.monster> At least for that ocaml expression. I'm still confused as to my original question
<discocaml>
<octachron> Note that `void` is really ambiguous as a type name, because the vernacular definition may point to an empty type, whereas the C use corresponds rather to `unit` (aka a type with one inhabitant which thus contains zero information).
<discocaml>
<empathy.monster> That makes sense
<discocaml>
<edhebi> void is also highly irregular and special-cased all over the place in C and C++
<discocaml>
<empathy.monster> I'll have to dig into the language spec it seems, or do some introspection on it
<discocaml>
<edhebi> to the point that in a lot of language, `()` means both the type and the value
<discocaml>
<empathy.monster> The language my question was about is called Hare
<discocaml>
<octachron> The separation between statements and expressions is a matter of convention. In an expression-oriented language, the convention will often be that every value-level constructs are expressions. Thus `if true then ()` will be an expression.
<discocaml>
<empathy.monster> So if void in Hare is more like unit, then it'd be an expression, is my understanding then. Although again, void is really ambiguous
<discocaml>
<edhebi> hard to say much without known their language
<discocaml>
<empathy.monster> Ah ha, okay
<discocaml>
<empathy.monster> I think there's some type introspection stuff in the stdlib I'll play around with
<discocaml>
<edhebi> a quick look at their doc seems to imply that they go the C route where void isn't considered a type in most places
<discocaml>
<edhebi> > **The `void` type**
<discocaml>
<edhebi> >
<discocaml>
<edhebi> > 6.6.12.15 The voidtype represents an object with no storage. Only one value with this type exists (the `void` value); this value is also the default value.
<discocaml>
<edhebi> >
<discocaml>
<edhebi> > 6.6.12.16 The size and alignment of `void` shall be zero.
<discocaml>
<edhebi> looks like a plain unit type
<discocaml>
<empathy.monster> I did read that in the spec, but I'm still learning. You pointing that out is very helpful, bc unit in ocaml is very easy for me to grasp, so that comparison is perfect
<discocaml>
<empathy.monster> I really appreciate it, everyone
johnridesabike has joined #ocaml
Frostillicus has joined #ocaml
Frostillicus has quit [Ping timeout: 260 seconds]
Haudegen has joined #ocaml
<discocaml>
<JM> thanks
Frostillicus has joined #ocaml
Frostillicus has quit [Ping timeout: 248 seconds]
Frostillicus has joined #ocaml
<discocaml>
<hungrystackofpancakes> hello!
<discocaml>
<hungrystackofpancakes> i am here to learn ocaml
Frostillicus has quit [Ping timeout: 244 seconds]
YuGiOhJCJ has quit [Quit: YuGiOhJCJ]
Frostillicus has joined #ocaml
Frostillicus has quit [Ping timeout: 276 seconds]
humasect has joined #ocaml
Haudegen has quit [Quit: Bin weg.]
Serpent7776 has quit [Ping timeout: 260 seconds]
<discocaml>
<contificate> Your Discord tag says "C++" so I feel it's my ethical duty to tell you that there's a genuine possibility you will dislike C++ after learning OCaml. 😼
<discocaml>
<hungrystackofpancakes> after almost 4 years using c++
<discocaml>
<hungrystackofpancakes> i tried like 20 languages
<discocaml>
<hungrystackofpancakes> nothing replaced c++
<discocaml>
<hungrystackofpancakes> lol
<discocaml>
<contificate> do you write any symbolic computing software
<discocaml>
<contificate> e.g. translators (or "compilers")
<discocaml>
<hungrystackofpancakes> i use lisp
<discocaml>
<contificate> for the same things as you use C++?
<discocaml>
<contificate> Lisps are mostly DOA for me as I prefer static typing, so OCaml is a better replacement
<discocaml>
<barconstruction> I saw a lisp guy post on Reddit recently about something called Coalton, an add on for common lisp that gives static typing features
<discocaml>
<lost.ray> What you use C++ for?
<discocaml>
<hungrystackofpancakes> everything
<discocaml>
<lost.ray> For web frontend also?
<discocaml>
<hungrystackofpancakes> only backend
<discocaml>
<hungrystackofpancakes> frontend is ju9st html file
<discocaml>
<contificate> do you ever think "damn, it'd be neat if I could economically specify and discern intuitively defined data"
<discocaml>
<hungrystackofpancakes> frontend is just html file
<discocaml>
<contificate> inductively* sorry on phone
<discocaml>
<barconstruction> I think you could probably get away with seven lines of CSS too
luc4 has joined #ocaml
<discocaml>
<lost.ray> Maybe it's time to use WASM C++ and write some cool CSR app. Then you can do the same in Typescript with Vue/React/Svelte and compare DX. I think the choice will be obvious
<discocaml>
<contificate> ergonomically* this phone is terrible
<discocaml>
<barconstruction> No, economically works too. Economy, you know, parsimony with text
<discocaml>
<contificate> economic in sense of time it takes C++ programmers to specify ASTs
<discocaml>
<barconstruction> Yeah.
<discocaml>
<contificate> a few hours of work to write out a few OCaml variant types
<discocaml>
<contificate> real programming
<discocaml>
<contificate> if you don't get carpal tunnel before you even start writing IR transforms, are you even programming C or C++
<discocaml>
<polyml> with C++ you don't have to get carpal tunnel because compiling can rest your hands
<humasect>
shift+ shift+ shift+
<humasect>
in emacs i use snoopy-mode , so the number row (1234567890) already shifted
<humasect>
(and also, anyway, i use the symbols much more often than the default of numbers.)
<humasect>
who types literal constants unless they are filling in forms in the office ?
<discocaml>
<lost.ray> Is it some kind of high load work? Or maybe very low latency, something like HFT?
<discocaml>
<hungrystackofpancakes> it is the only lang that i actually know how to write well
<discocaml>
<contificate> unrelated but I use capslock and I've never managed to hold shift to replace it
<discocaml>
<contificate> yeah I like snake_case in C++
<discocaml>
<barconstruction> I don't think any language is necessarily more suitable for web backend. It's not really convincing to me that javascript should be more usable for backend because it's the only language usable for frontend
<humasect>
ocaml is snake case as well , but i co-erce it into camelStyle (ironical?)
<discocaml>
<contificate> I don't think JS is suitable for any business logic beyond spewing garbage onto the DOM
<humasect>
its like english. gets job done
<humasect>
lingua franca literally meant French as the world's speaking of global importances
<discocaml>
<lost.ray> Yeah, it's time to write SPA into C++
<discocaml>
<lost.ray> Everyone must suffer
<humasect>
i'm looking back at Objective-C this week, for Metal and to revive an old project (from memory) and i am sad that it is now called OCaml and not Objective-CAML =(
<discocaml>
<lost.ray> Yeah, it's time to write SPA in C++
<humasect>
SPA
<discocaml>
<barconstruction> Ironic that the phrase "lingua Franca" is Latin. If French was so important then why isn't the phrase "lingua Franca" in French?
<humasect>
because its already lingua-franca-ing if one speaking french .
<luc4>
Hello! I'm trying to contribute to an open source project, but I'm getting this error: https://pastebin.com/rVe9s8rB. This happens when I triy to link to ocurl downloaded with opam. My understanding is that, for some reason, cdk.cmxa was built against a version of ocurl, while it is now trying to link to another. But I don't think I have two versions of ocurl in this system. Any other explaination for this error?
Haudegen has joined #ocaml
_jbrown_ has joined #ocaml
itszor has quit [Ping timeout: 276 seconds]
Anarchos has joined #ocaml
euphores has quit [Quit: Leaving.]
itszor has joined #ocaml
luc4 has quit [Quit: Konversation terminated!]
_jbrown_ has quit [Ping timeout: 252 seconds]
euphores has joined #ocaml
cr1901_ has joined #ocaml
cr1901 has quit [Ping timeout: 252 seconds]
cr1901_ has quit [Ping timeout: 245 seconds]
Tuplanolla has joined #ocaml
cr1901 has joined #ocaml
<discocaml>
<jalsol> OCaml overtook C++ to become my favorite, but C++ is still a strong second to me lmao
<discocaml>
<jalsol> as in it obviously could've been better, but there's nothing better than it (other than OCaml)
humasect has quit [Quit: Leaving...]
Everything has joined #ocaml
<discocaml>
<contificate> depends what you're programming, as always - I went from loving to despising it in the space of a few weeks
<discocaml>
<polyml> C++ is ok for consuming existing apis with dot/arrow syntax and autocompletion
<discocaml>
<polyml> a lot of modern programming seems to be memorizing and consuming existing libraries instead of solving novel problems
<discocaml>
<yawaramin> that's what the SICP people said to justify switching from Scheme to Python
<Anarchos>
polyml indeed ! But the real next big step will be to write only specs in Coq/Lean/Agda... and let the spec be verified, and code autogenerated.
Anarchos has quit [Quit: Vision[]: i've been blurred!]
<discocaml>
<jalsol> I've just landed a HFT intern, where C++ is probably the dominant language (yes, I really wish I could get into Jane Street)
<discocaml>
<jalsol> there are things I don't like about C++ for sure, but the control over performance is a selling point for me
<discocaml>
<jalsol> there is also metaprogramming, but it's a double-edged sword
Everything has quit [Quit: leaving]
<discocaml>
<jalsol> I was not aware of the Python version; I know the JavaScript version exists (and I know one of the authors irl)
<discocaml>
<jalsol> I was not aware of the Python version; I know the JavaScript version exists (and I know one of the authors irl, he literally taught JS as a modern Scheme with a custom JS compiler)
<discocaml>
<contificate> lol, C++ programmers go to lengths to avoid copying a string - unaware of what really dominates the performance of their programs
Lilly2010 has joined #ocaml
Lilly2010 has quit [Client Quit]
<companion_cube>
Or you know, they profiled and it was costly
<discocaml>
<contificate> nah I'm talking about the pedantry of the general community
dhil has quit [Ping timeout: 272 seconds]
<discocaml>
<contificate> they teach C++ idioms using tables of info at cppcon