Ocaml Becomes Rust w/ Garbage Collection?

Sdílet
Vložit
  • čas přidán 27. 06. 2023
  • Recorded live on twitch, GET IN
    / theprimeagen
    TJ: / teej_dv
    twitch: / teej_dv
    MY MAIN YT CHANNEL: Has well edited engineering videos
    / theprimeagen
    Discord
    / discord
    Have something for me to read or react to?: / theprimeagenreact
  • Věda a technologie

Komentáře • 212

  • @atiedebee1020
    @atiedebee1020 Před rokem +364

    Im so proud how far programming languages have come, finally local variables

    • @ThePrimeTimeagen
      @ThePrimeTimeagen  Před rokem +88

      its amazing

    • @zsh7862
      @zsh7862 Před rokem +9

      lua? or am i missing smth, i dont know too much about it

    • @Poem-Tree
      @Poem-Tree Před rokem +24

      @@zsh7862its sarcasm

    • @SimonBuchanNz
      @SimonBuchanNz Před rokem +22

      ​@@zsh7862for reference, local variables have been a thing since the creation of structured programming in the mid 50s.

    • @complexity5545
      @complexity5545 Před rokem +1

      @@SimonBuchanNz This rebuttal made me chuckle.

  • @edz8659
    @edz8659 Před rokem +410

    I love ocaml (I have never used it)

    • @vaisakhkm783
      @vaisakhkm783 Před rokem +14

      😂 ikr

    • @SimGunther
      @SimGunther Před rokem +44

      That sums up the language landscape:
      Languages you love and languages you use extensively are (for now) mutually exclusive.

    •  Před rokem +1

      I came here to say the same and you were first!

    • @RenderingUser
      @RenderingUser Před rokem +6

      Same (I have never heard of it)

    • @VivekYadav-ds8oz
      @VivekYadav-ds8oz Před rokem +3

      @@SimGunther except ofcourse Rust.

  • @RemcoJvGrevenbroek
    @RemcoJvGrevenbroek Před rokem +62

    fun fact!....... The first rust compiler was written i oCaml

  • @josevargas686
    @josevargas686 Před rokem +37

    ThePrime: you cannot have the same great communication while working remotely as you do in an office.
    Also ThePrime: most greatest communication with TJ while reading overly complex technical articles.

    • @SimonBuchanNz
      @SimonBuchanNz Před rokem +2

      I'd say it as "the one person working remotely can't have the same great communication as the rest of the team working in the office", which I also think is too strong (I think it's more "it's harder" than "can't"), but is compatible with streaming

  • @SimonBuchanNz
    @SimonBuchanNz Před rokem +8

    Co- and Contra- variance is mostly confusing because it's not actually subtyping, but relations between subtyping relations between types. Which is a word salad that is much easier to describe with an example:
    For some generic Foo, there may be a subtype relationship between Foo and Foo, but it may be:
    * returning a T, in which case Foo is a Foo, which is covariance, or
    * it may take a T, in which case Foo is a Foo, which is contravariance, or
    * it may do both, in which case neither is a subtype, which is invariance.
    * it may even do neither, which means either may be a subtype of the other, which is bivariance! (In practice this means either they are actually the same type or it's unsound)
    The variance relation isn't a relation on the Dog or Animal, or even any of the Foo types: it's a relation on Foo instances to the T parameter: contra- if the subtypes go in the opposite direction, co- if they go in the same.
    The relation to function types is clearer when you look at them as being a fancy syntax for a generic: (A) -> R is basically just Fn.

  • @diadetediotedio6918
    @diadetediotedio6918 Před rokem +7

    16:00
    C# can alloc on the stack, either by using structs or for arrays by using stackalloc type_str_unmanaged[length]

  • @robertlenders8755
    @robertlenders8755 Před rokem +29

    F# is the daughter of ocaml and has had possibly stack allocated values with structs and guaranteed stack allocated values with byreflike for a few years now.
    Local looks interesting though as it seems like it can be applied to existing types rather than declaring a new one.

    • @complexity5545
      @complexity5545 Před rokem +5

      I'm not a windows guy, but when I do its C# and F# (and some C++). F# is a really good language.

    • @metaltyphoon
      @metaltyphoon Před rokem +11

      @@complexity5545c# and f# hasn’t been a “windows only” thing for more than 7 years

    • @LSM07
      @LSM07 Před rokem +6

      F# will always be underappreciated, unfortunately. But yes, the CLR allows for both unsafe and stack allocated stuff and has for some time. I wouldn't be surprised if they added lifetime-like annotations at some point to F#, too (which will, inevitably, be added post-hoc to C#).

    • @meowrbius
      @meowrbius Před 11 měsíci +1

      @@complexity5545 How did you learn F#. Why there are no resources for it?

    • @Eugensson
      @Eugensson Před 2 měsíci

      ​@@meowrbiusthere is a lot of info by Don Syme, also an awesome series of articles "F# for fun and profit".

  • @casperes0912
    @casperes0912 Před rokem +49

    I've written a decent bit of OCaml at university. We used OCaml to make a compiler for example. I also wrote a weak memory checker with OCaml (for C11's Release-Acquire semantics) as well as CRDTs. It has its ups and downs. If you don't type annotate it, you can get horrid compiler errors

    • @meli-overwatch9298
      @meli-overwatch9298 Před rokem +1

      are you from tum?

    • @vikingthedude
      @vikingthedude Před rokem

      This guy wrote CRDTs. I just learned about them last month. Damn

    • @MaxHaydenChiz
      @MaxHaydenChiz Před rokem +2

      Have you used Haskell for similarly complex problems? I'd be curious of your opinion on how they compare.
      Personally, the main reason I like OCaml over Haskell is that the type inference is always decidable. So for CLI apps and other ordinary systems programming stuff, you need less manually written types (and can have the tooling just output your types into a file for you). And then for complex stuff, I tend to have fewer problems if I need to do complicated type system stuff (at least up to the point that having higher order polymorphism and the rest actually reduces code complexity; some stuff is just painful to do by hand without the help, from the Haskell compiler.).
      I've been meaning to experiment with using Coq and dependent types for those hard type-level problems. I'm told the ergonomics have gotten way better recently, and I really enjoyed the cleanliness of Idris over all the not-quite-dependent advanced types that Haskell supports.

    • @casperes0912
      @casperes0912 Před rokem

      @@meli-overwatch9298 what’s tum?

    • @casperes0912
      @casperes0912 Před rokem

      @@vikingthedude it was a project I took part in at university. Ultimate goal is for the implementations to be formally verified

  • @xbmarx
    @xbmarx Před rokem +14

    Jane Street is also working on unboxed types in OCaml. Exciting language.

  • @rapzid3536
    @rapzid3536 Před rokem +13

    Would love a series exploring F#

    • @WillEhrendreich
      @WillEhrendreich Před rokem +1

      I approve this message.

    • @DMSBrian24
      @DMSBrian24 Před rokem

      F# is a microsoft thing, in the functional world i'd say learn Elixir if you're fine with dynamic typing and if you want static, go with Haskell or Ocaml

    • @absolutejam
      @absolutejam Před rokem +9

      ​@@DMSBrian24 what a narrow minded view 🤷‍♂️
      F# is an amazing language, has a rich ecosystem and performant runtime. And computation expressions are one of the greatest language features ever.
      But Haskell, Scala, Clojure, Elixir are all great. We shouldn't be limiting our world view based on surface level points. Try them all and evaluate them on their merits.

    • @lepingouindefeu
      @lepingouindefeu Před 19 dny +1

      ​@@DMSBrian24 L take.

  • @EricSampson
    @EricSampson Před rokem +13

    C# and F# let you do explicit stack allocations, re your comment about not knowing any GC langs that do

  • @metaltyphoon
    @metaltyphoon Před rokem +47

    If prime’s pride didn’t blind him, he would see how F# is real world pragmatic OCaml

    • @xbmarx
      @xbmarx Před rokem +2

      F# doesn't have modules/functors like OCaml though. It's basically just alternative syntax for C#

    • @metaltyphoon
      @metaltyphoon Před rokem +7

      @@xbmarx Nice try but no. F# is pragmatic functional language. Things that F# has where OCaml doesn’t:
      1) Computational expression
      2) Perf abstraction ( stackalloc in this video)
      3) Anonymous Records
      4) Library ecosystem OCaml dreams of
      5) Slices and Ranges

    • @abuk95
      @abuk95 Před rokem +5

      @@metaltyphoon but it is from microsoft ecosystem, so that is a dealbreaker

    • @metaltyphoon
      @metaltyphoon Před rokem +6

      @@abuk95 oh so you want to be a SJ warrior, how about not using any GNU tools since Stallman sexual allegation? Guess what? You probably didn’t think twice and still use it. MS is not the same company from from 2 decades ago so stop pretending it is.

    • @nicolaspace1182
      @nicolaspace1182 Před 11 měsíci +2

      @@metaltyphoonMicrosoft is still as evil as ever, but that doesn’t mean you shouldn’t use their tools. If the man who invented the hammer was a murdering psychopath, would you then never purchase a hammer?

  • @MosiurRahman-dl5ts
    @MosiurRahman-dl5ts Před rokem +5

    The chair has gained sentience.

  • @sumansaha295
    @sumansaha295 Před rokem +7

    programming languages part a/b/c on coursera was my first exposure to functional programming and ml. Excellent courses btw. At the end of the course the professor said one thing I remember, "Language design until now has all been about what not to do, and I would like to see the future programming languages about what we could do" This course was over 10 years ago, Something I think about when I see the rust borrow checker.

    • @gloverelaxis
      @gloverelaxis Před 11 měsíci

      do you remember the professor's name or university? because I took a free online unit with the same structure dated 2019 from Professor Dan Grossman at the University of Wisconsin and it was the best educational experience of my life. he's a phenomenal teacher who happens to have contributed to the design of Rust

    • @sumansaha295
      @sumansaha295 Před 11 měsíci +1

      @@gloverelaxis Yup it's him, I agree one of the best courses I have ever taken, but I didn't know he contributed to rust?

    • @gloverelaxis
      @gloverelaxis Před 11 měsíci

      @@sumansaha295 ah awesome! yeah it was via the language named some synonym of Cyclone or Tempest or something; can't remember the specific linguistic feature it had that Rust incorporated. i'm so thankful for his work on that course; it totally opened my eyes to thinking about programming in *so* many new ways

  • @itacirgabral1687
    @itacirgabral1687 Před rokem +3

    the beginning of a beautiful friendship

  • @WizardofWestmarch
    @WizardofWestmarch Před rokem +2

    I can see a use for local head prepend to a global list if those front values are only useful to that point and below in the call stack and will be thrown away after. Limits your pointer chasing as mentioned before.

  • @KevinInPhoenix
    @KevinInPhoenix Před rokem +2

    I use a GCed language that automatically puts local variables on the stack and "escapes" variables to the heap that are referenced outside of the local scope (arguments to functions). That language is Go.

  • @confusedbystander2898
    @confusedbystander2898 Před rokem +48

    Very interesting. Gives of 'highly admired - barly desired' vibes for me.
    Not for Tom though ...

  • @marble_wraith
    @marble_wraith Před rokem +6

    I'm influenced... OCaml is gonna replace Rust. Dang it!

  • @ForsakenDAemon
    @ForsakenDAemon Před 11 měsíci

    Types are usually covariant - I need an Animal so I can take a Dog - but function types are often contravariant in their arguments - I need a [function that takes a Dog] so I can take a [function that takes an Animal]. Basically if supertype is a supertype of subtype, array is a supertype of array (array is covariant) but function is like a subtype of function (function is contravariant). Scala taught me something, at least 🤣

  • @carlpittenger
    @carlpittenger Před rokem +13

    other than for example java primitives, the only garbage-collected language i'm aware of that lets you do stuff with the stack is c#: structs are inlined or on the stack, classes are on the heap. admittedly though, i'm not too familiar with modern c#.

    • @blade2663
      @blade2663 Před rokem +1

      Golang also

    • @Imaltont
      @Imaltont Před rokem +1

      Common Lisp can also, though exactly how it is done depends on the CL implementation.
      Edit: DYNAMIC-EXTENT in the hyperspec is what allows it, implementations that focus on performance such as SBCL does utilize it.

    • @mkwpaul
      @mkwpaul Před rokem +2

      Classes in C# are always allocated on the heap, no matter what.
      Where structs are allocated depends on how they are used.
      If you have a struct field on a class, then that struct is allocated with the class instance, on the heap, it is embedded in its parent.
      if you have a local variable with the exact struct type so:
      int x = 0;
      However C# automatically and silently boxes (i.e. creates a heap-allocated copy) whenever needed. Like for example when the type of the variable is object or an interface.
      so if I write the following:
      int x = 420;
      object boxedX = x;
      IFormattable formattableX = x;
      then the 420 is initially only allocated on the stack, but when boxedX and formattableX are assigned, the value of x is copied onto the heap.
      If I have the following functions:
      public void PrintFormattable(IFormattable formattable) {
      formattable.ToString("Format", CultureInfo.CurrentCulture);
      }
      public void PrintFormattable(T formattable) where T : IFormattable {
      formattable.ToString("Format", CultureInfo.CurrentCulture);
      }
      then any non-boxed interger I pass into the first method will be automatically boxed, however it wont be boxed if I pass it into the second method.
      More recent C# versions have added a bunch of language and runtime features that let you do more low level things without unsafe. For example you can now declare a struct as a "ref struct" which will enable compile-time checks to ensure that instances of that struct are only ever allocated on the stack and never "escape" to the heap.

    • @blade2663
      @blade2663 Před rokem

      @@mkwpaul That's exactly how Golang "escape analysis" works
      But with addition to explicit pointers

  • @njnjhjh8918
    @njnjhjh8918 Před rokem +1

    Hell yes, I love both Rust and OCaml

  • @MaxHaydenChiz
    @MaxHaydenChiz Před rokem +9

    2 questions for you:
    1. Once you learn the language, are you going to install Jane Street's branch of the compiler to try to play with this stuff while it's in beta? Or are you just excited that it's coming in a future version?
    2. Did the youtube stream you made of the first day of OCaml get posted to one of your accounts? It became unavailable immediately after the stream ended, but I'd like to see the few parts I missed.

    • @ThePrimeTimeagen
      @ThePrimeTimeagen  Před rokem +1

      its on @TheVimeagen

    • @imadetheuniverse4fun
      @imadetheuniverse4fun Před 11 měsíci

      @@ThePrimeTimeagen i'm guessing it's better for engagement but man it's hard to follow / find these threads across all your channels 😂

  • @SimGunther
    @SimGunther Před rokem +17

    Better to oversell a technology than a product, amirite?

  • @ericbwertz
    @ericbwertz Před rokem +2

    Nice thumbnail -- Prime's OCaml-face.

  • @HyperFocusMarshmallow
    @HyperFocusMarshmallow Před rokem +3

    I recall a few years back when apple lived in Objective-C land and did reference counting using retain and release (and maybe auto release or something). And I remember finding that paradigm so much more simple and elegant than just pretending like things will be just fine, like in languages with a garbage collection only model.
    But even there you had some data structure whose name I don’t recall, some NS…Pool maybe. I really don’t remember. And you’d construct it and let it do garbage collection. It was a garbage collector.
    I haven’t thought too hard about it but if you really really need garbage collection isn’t there just some crate for it. Maybe that doesn’t end up sufficiently optimized or something.
    But I just don’t think that’s the kind of thing that needs to be baked into the language. I mean, it’s fine if it it’s, but if you don’t have it you can opt in right.

    • @SimonBuchanNz
      @SimonBuchanNz Před rokem

      I found, while trying to interop with obj-c from Rust, that the docs for autorelease to be absolutely hilariously garbage. There's basically no actual explanation of what it actually does, just vague guides for using it from obj-c, and you're as l occasionally forced to use it with some APIs. Fun times!

    • @HyperFocusMarshmallow
      @HyperFocusMarshmallow Před rokem

      ​@@SimonBuchanNz I honestly don't recall. Did you manage to figure it out?

    • @SimonBuchanNz
      @SimonBuchanNz Před rokem

      @@HyperFocusMarshmallow I think I ended up just letting everything leak, which is fine for the specific case where nothing was in a loop.

  • @zaneearldufour
    @zaneearldufour Před rokem +13

    I love seeing TJ playing along with your kayfabe

    • @ThePrimeTimeagen
      @ThePrimeTimeagen  Před rokem +7

      ...?
      i never read that article and i am excited about ocaml... unsure about this

  • @aftalavera
    @aftalavera Před rokem

    Ocaña is the second most loved language even tough nobody uses it!

  • @TroubleChute
    @TroubleChute Před rokem

    Woah may have been your 100,000th subscriber 👀Let's go

  • @temper8281
    @temper8281 Před rokem +5

    You know what they say. Functional languages have no side effects because no one can understand how to write and run them.

    • @mskiptr
      @mskiptr Před rokem

      guide.elm-lang (dotyouknowwhat) is right there

    • @mskiptr
      @mskiptr Před rokem

      Yay /s I got shadowhammered!

    • @lydianlights
      @lydianlights Před rokem

      @@mskiptr i see both of your comments

    • @mskiptr
      @mskiptr Před rokem

      @@lydianlights The first one wouldn't show up when I was logged out | in incognito mode. Now both are visible regardless
      Eh, YT is weird

  • @alexanderoh1847
    @alexanderoh1847 Před 11 měsíci

    c# has value types which are very similar in nature.

  • @KnThSelf2ThSelfBTrue
    @KnThSelf2ThSelfBTrue Před rokem

    Damn people took the [params list here] { do stuff } syntax from Jai and added exclave ho boy

  • @Titousensei
    @Titousensei Před rokem +1

    If the compiler can do raise an error for variables declared local that escape, why can't it automatically detect the ones that don't escape and make the decision to allocate them on the stack?

    • @digitalspecter
      @digitalspecter Před 11 měsíci

      16:26 it does

    • @Titousensei
      @Titousensei Před 11 měsíci

      @@digitalspecter My point was: if it's possible to automate that, why not do it transparently by default and avoid the declaration altogether?

    • @digitalspecter
      @digitalspecter Před 11 měsíci +1

      @@Titousensei Because you may want to ensure it is local and compiler to complain if you did something stupid that prevents that.

  • @carstenrasmussen1159
    @carstenrasmussen1159 Před rokem

    It sounds like what D is doing also with scope and DIP1000

  • @amazakee
    @amazakee Před rokem +1

    any good video or article that would help me gain a deep enough understanding of GC for understanding this video?😅

    • @SimonBuchanNz
      @SimonBuchanNz Před rokem +1

      Google "heap and stack" for the gist of allocation in general. For the purpose of this video, GC is just heap you don't have to call free on. Googling "mark-sweep" will give you a general idea of the basic principle.

  • @whiskeytuesday
    @whiskeytuesday Před 6 měsíci

    This is a local station, for local people

  • @sho3bum
    @sho3bum Před rokem +4

    I do ocaml professionally but I'm a junior dev so I suck at most things

    • @ThePrimeTimeagen
      @ThePrimeTimeagen  Před rokem +1

      but you do it professionally! that is amazing

    • @Ottopuncher
      @Ottopuncher Před rokem +1

      That's a skill finding an ocaml position. I wish !

  • @holthuizenoemoet591
    @holthuizenoemoet591 Před 7 měsíci

    what is this OCaml popularity all of a sudden? Its like an sort of Erlang renaissance

  • @Kapendev
    @Kapendev Před rokem

    No DLang?

  • @liquidsnake6879
    @liquidsnake6879 Před rokem +4

    what is this sudden ocaml hipsterdom, every channel is suddently putting out vids about ocaml lol

    • @SimonBuchanNz
      @SimonBuchanNz Před rokem +1

      Jane Street exerting their sinister fintech power 🤫

  • @timvw01
    @timvw01 Před rokem

    It will do its best, so will i.

  • @yasscat5484
    @yasscat5484 Před 11 měsíci

    adding keywords without a mechanism to keep backwards compatibility is probably a bad choice

  • @teej_dv
    @teej_dv Před rokem +2

    nice

  • @Wanderer2035
    @Wanderer2035 Před rokem

    Hey btw my sisters name is Julia do you think I should learn that code?

  • @TheSkepticSkwerl
    @TheSkepticSkwerl Před rokem +2

    For the love of all. Escape has 1 c in it!

  • @mettemfurfur7691
    @mettemfurfur7691 Před rokem +3

    huh?

  • @DisFunctor
    @DisFunctor Před rokem +4

    OCaml seems really cool, but from my admittedly limited experience (and please do correct me if I'm wrong), it's missing a key thing that makes or breaks whether a language goes mainstream or not: good tooling. I hope Jane Street invests some more into it (and the good news is they have the financial muscle to do so), because subpar tooling has completely destroyed many a language's chance at escaping the "niche language" status.
    You might say Python tooling is not that great, and you might be right. But Python is also extremely easy to learn and currently being taught at every coding school and University as the introductory language, so you'd be comparing apples with oranges. Languages like Haskell or OCaml have a way steeper initial learning curve.

    • @ThePrimeTimeagen
      @ThePrimeTimeagen  Před rokem +9

      i am 10000000000000000x on your side
      if it doesn't have spectacular tooling, your language sucks (no matter how good it ackshually is). This is why i think rust has gotten so popular is more than the language, but due to cargo

    • @EricSampson
      @EricSampson Před rokem +7

      F# is OCaml with wonderful tooling, just sayin’… 😇

    • @DisFunctor
      @DisFunctor Před rokem

      About variance (learned it through Scala, but I think F[A] would just be syntax for F in Rust and TypeScript, difference just being the type of brackets used):
      say Dog is a subtype of Animal
      type Container[A] is invariant on A, therefore you have no information about the relationship between Container[Animal] and Container[Dog]. They will be considered different types. This is useful if you need something's type to be precise (e.g. you want operations on Container[Animal] to never be combined with operations on Container[Dog]).
      type Container[-A] is contravariant on A, therefore Container[Animal] should be considered a subtype of Container[Dog]
      type Container[+A] is covariant on A , therefore Container[Dog] is to be considered a subtype of Container[Animal]
      As a cheat sheet for remembering one of its most popular use cases: say you want to declare a function with type F[-I, +O], you can see it has two type parameters. From reading the type signature you'll know the function F "consumes" or takes I's as inputs and is meant to output or "produce" O's.
      I believe it's, conceptually the same thing in OCaml. Hope that's somewhat helpful.

    • @ruanpingshan
      @ruanpingshan Před rokem +1

      @@EricSampson I remember being blown away 10 years ago when I tried F# and discovered that Visual Studio let me set breakpoints for individual expressions, not just for a whole line. Was still horrendous to debug though. Turned me off functional languages completely.

    • @meowrbius
      @meowrbius Před rokem

      @@EricSampson I know C# is getting better and better. How is the F# currently going? I wanna start scratching functional paradigm a bit and thought of giving F# a try. How is F# compared to other functional languages?

  • @HaloBolt35
    @HaloBolt35 Před 10 měsíci

    TJ and Primeagen remind me of McConnell and Asmongold

  • @thesaintseiya
    @thesaintseiya Před rokem

    You missed a paragraph...

  • @amj864
    @amj864 Před rokem

    Julia does the stack allocated thing pretty aggressively.

    • @MaxHaydenChiz
      @MaxHaydenChiz Před rokem

      I really want to like Julia. But I think they missed the mark with how their type system works and how traits are implicit instead of the building block. And at least right now, the library support isn't there. In my tests, it always takes about 2x the code that R would take for a similar analysis, At the same time, it isn't at a point where I can use it to replace the C++ portion of an R package and have it nicely integrate with CRAN. Nor does it have enough of the utility stuff that makes Python preferred for some data science use cases.
      I hope they get things sorted out eventually though. It's got a lot of good ideas.

    • @amj864
      @amj864 Před rokem

      @@MaxHaydenChiz It's a tool/preference thing, Honestly, I can't do shit in anything other than Julia and it covers most of my use cases. Just thinking about C++ will give me nightmares.

    • @isodoubIet
      @isodoubIet Před rokem

      @@amj864 Julia really blew it by having arrays start on 1.

    • @amj864
      @amj864 Před rokem

      @@isodoubIet Christ, another one, what is the difference between 0-based and 1-based?! If you think using one or another will make or break your mental model for programming, I have bad news for you!

    • @isodoubIet
      @isodoubIet Před rokem

      @@amj864 "Christ, another one, what is the difference between 0-based and 1-based?"
      0 is the right choice. 1 is not. Julia made the choice to cater to users less accustomed to programming where the difference matters, and as such it kneecapped its own development.

  • @mvargasmoran
    @mvargasmoran Před rokem

    is this the actual TeeJ or is this a fake TJ?

  • @Gabriel-wq4ln
    @Gabriel-wq4ln Před rokem

    100K subs anytime soon

  • @ra-dro
    @ra-dro Před rokem

    By tj!

  • @thekwoka4707
    @thekwoka4707 Před 10 měsíci

    Single = doing different things is rough...

  • @anon-fz2bo
    @anon-fz2bo Před rokem

    ODeez

  • @NamanGoel34
    @NamanGoel34 Před 11 měsíci

    Swift added lifetimes already…

    • @NamanGoel34
      @NamanGoel34 Před 11 měsíci

      Swift: Rust without all the manual memory management, except when you really need the most performance possible.

  • @m0ff607
    @m0ff607 Před rokem +2

    Eschewing?

  • @rennelou9717
    @rennelou9717 Před rokem +1

    guys, why don't you try haskell?

    • @ThePrimeTimeagen
      @ThePrimeTimeagen  Před rokem +2

      i want to write something with side effects

    • @rennelou9717
      @rennelou9717 Před rokem +1

      @@ThePrimeTimeagen guys, why don't you use monads?

    • @el_carbonara
      @el_carbonara Před rokem +1

      @@ThePrimeTimeagen prime, haskell is perfect for that

  • @sortof3337
    @sortof3337 Před rokem

    As somone who used HOT stack for 2 months. I'll say this --> to my dyslexic and ADHD brain --> rust is much much easier. Like rust is easy af compared to ocaml for me.

  • @sck3570
    @sck3570 Před rokem +3

    I dont get it, why all of a sudden we are learning an old(very old) language? what gives?

    • @carlpittenger
      @carlpittenger Před rokem +6

      i believe recent speed-ups, functional programming, interesting type system, etc.

    • @sck3570
      @sck3570 Před rokem +3

      Haskell you say, Yay!

    • @isodoubIet
      @isodoubIet Před rokem +2

      Jane Street single-handedly keeps OCaml alive basically

    • @isodoubIet
      @isodoubIet Před rokem +1

      @@MateuszGrzyb-od9uo There are other functional-ish languages that would be comparably good for that. Ocaml was used because being used at JS keeps it alive.

    • @digitalspecter
      @digitalspecter Před 6 dny

      Well, it's more recent than Javascript..

  • @heitorvrb
    @heitorvrb Před 11 měsíci

    was this guy sitting on a bouncing ball or something?

  • @neessaa8713
    @neessaa8713 Před rokem +1

    Wait. Wouldn't Lifetimes as part of data type give the language a *spacetime allocator*? 🤔
    Turning the runtime Garbage Collector into an AOT Garbage Compactor, aka a Blackhole? 🥸
    And in this case, wouldn't the "side effects" be the Hawking radiations. causing the Heisenbugs? 🤯

  • @foxcirc
    @foxcirc Před rokem +2

    async rust, 300 dependencies and 4 hours later I just throw it all out and use mio

  • @complexity5545
    @complexity5545 Před rokem +1

    My god OCaml. The next thing your going to try is TCL (which is a an even worst version of OOP functional programming). Ocaml its been a while for me. The french programming language. You guys are making your way up to why perl was created. LOL . I remember trying to refactor OCAML and having to use TypeRex and it made refactoring even worse. I then realized that I reached peak dumb-f4ck with this language. OCaml is really meant for tinkerer programmers which I define as programmers that like to keep changing code just to past the time and make sub-programmers lives more hectic. A good reason to choose OCaml over Haskell is for graphics and GUIs because OCaml is snappier and more realtime-like. Haskell has the problem of [hanging up] or pausing when the GC kicks in on graphics (back in the day).
    This was a good overview though. It made me remember stuff.

    • @totally_not_a_bot
      @totally_not_a_bot Před rokem +1

      Mathematical abstractions and practical utility don't generally play nice. It's why I just gave up on haskell.

  • @RogerValor
    @RogerValor Před rokem +7

    I feel like I am the only one who does not get the point of OCaml, it looks like code that tries to get rid of some syntactic annoyances just to introduce so many new ones, that the result just looks like someone really does not want you to read their code.

    • @complexity5545
      @complexity5545 Před rokem

      Boy did you say it.

    • @mskiptr
      @mskiptr Před rokem +1

      As one wise commenter wrote last week _it's just Haskell, but ugly_
      Edit: this is a joke obv

    • @xybersurfer
      @xybersurfer Před rokem +1

      i think that part of the problem here is that all this ugly locality stuff that Jane Street added to their version of OCaml, is giving you a bad impression. it's not normally there

    • @lydianlights
      @lydianlights Před rokem

      @@xybersurfer absolutely not

    • @RogerValor
      @RogerValor Před rokem

      actually started to learn ocaml just to understand what the hell is going on. who knows maybe i will like it later.

  • @linuxrant
    @linuxrant Před rokem +2

    I really don't understand yet half of what you are all talking about. I would like just to have a language as easy as python with the performance of c++... to write games and some cool programs :) and that's it. I don't want to language hop like neckbeards hop through linux distros...

    • @lucasa8710
      @lucasa8710 Před rokem +1

      A had a similar idea, then I decided to implement such language and I realize the problem is way more complicated then it seems

    • @complexity5545
      @complexity5545 Před rokem

      C++ is the only way. Do 3D games in Unreal.

    • @sumansaha295
      @sumansaha295 Před rokem

      that sounds like Julia

    • @elcugo
      @elcugo Před rokem +3

      It sounds like you should use C# or Java.

  • @stysner4580
    @stysner4580 Před rokem +1

    E s c ape. Notice the order of the s and c? Not a syntax error!

    • @lydianlights
      @lydianlights Před rokem

      so you're the one leaving 99 nits on every pull request

    • @stysner4580
      @stysner4580 Před rokem +2

      @@lydianlights You really think I would leave an uneven number of nits? It's like you don't know me at all!

    • @lydianlights
      @lydianlights Před rokem +1

      @@stysner4580 lol

  • @bloqDev
    @bloqDev Před rokem +3

    Rust bad, crab good

  • @KnThSelf2ThSelfBTrue
    @KnThSelf2ThSelfBTrue Před rokem

    Damn, bash influencing the oxidation of OCAML with local. My decision to be the cringe-maxed bash ninja just keeps paying off

  • @AlesNajmann
    @AlesNajmann Před rokem +2

    OCaml has a very polished syntax compared to Rust. Just sayin' :P

  • @tobyzieglerrr
    @tobyzieglerrr Před rokem

    Ok, roast me, i like Java and i like Rust. I do not like OCÄML

  • @worgenzwithm14z
    @worgenzwithm14z Před rokem +1

    Dude just learn the st monad /s

  • @iamwhoiam798
    @iamwhoiam798 Před 11 měsíci

    I can’t believe that people don’t speak about the practical difficulties of Rust such as using global or class level variables inside functions.
    mutability problems are overwhelming. Sometime can’t decide whether function should be mutable or member variable should be interior mutable.
    Value enclosed mutexes are ridiculous.

    • @dynfoxx
      @dynfoxx Před 10 měsíci

      Why are value enclosed mutexes are ridiculous?

  • @AlgorithmAlloy
    @AlgorithmAlloy Před rokem +1

    I love TJ ❤️ (In a purely sexual way if that wasn’t clear) (Joke if that wasn’t clear)

  • @isodoubIet
    @isodoubIet Před rokem +2

    Devs who program mainly managed languages keep falling into this trap where they think they can't get anywhere without the gc. Really value semantics + unique ownership gets you 99% of the way, shared ownership gets 0.9%, and garbage collection can be a legitimate help you with 0.1%. Managed languages optimize for the 0.1% hardest case and make your life sucky for the remaining 99.9%.
    The same devs go to Rust and run into trouble because the borrow checker is overly restrictive and forces them into awkward patterns just to shut it up. Turns out C++ had mostly the right model all along.

    • @ThePrimeTimeagen
      @ThePrimeTimeagen  Před rokem +2

      i disagree with this
      i think there are a variety of problems that c++ is annoying af to solve with

    • @isodoubIet
      @isodoubIet Před rokem

      @@ThePrimeTimeagen C++ has many problems, but the memory strategy is basically right: it's value semantics most of the time, unique ownership for a small part of it (which could be even smaller with something like polymorphic_value), and shared_ptr (ref counting) when concurrency makes lifetimes difficult to reason about. The biggest missed opportunity are destructive moves. One of these newfangled languages could go a long way just by starting fresh from this basic model.
      The borrow checker is a win for concurrency but makes everything much more annoying with little payoff everywhere else, IMO

    • @elcugo
      @elcugo Před rokem

      Biggest problem with C++ is that it needs to support code written 40 years ago. Modern C++ is kinda nice. At some point the commitee has to do a clean break.

    • @isodoubIet
      @isodoubIet Před rokem

      @@elcugo Yup. In general, the cpp committee needs a strategy for fixing mistakes. There's probably some reasonable middle ground between "everything is backwards compatible forever and we never fix mistakes" and "let's hack lol".

  • @aftalavera
    @aftalavera Před rokem

    By the way Rust is the equivalent to following science! Covid and Climate change!

  • @muhammedkadirtan3469
    @muhammedkadirtan3469 Před rokem +1

    Duuude, stop bouncing its distracting