Gleam for Impatient Devs

Ғылым және технология

In a world where we increasingly worry about memory safety and low-level performance, one language is paying more attention to building stable, reliable concurrent systems. That language is Gleam, a new way to write functional code for the Erlang BEAM VM.
Check out my articles on Polar:
polar.sh/isaacharrisholt
Resources:
Gleam: gleam.run
Gleam Language Tour: tour.gleam.run
Standard library documentation: hexdocs.pm/gleam_stdlib
__________________________________________
Check out my other socials!
🎮 Discord ▶ discordapp.com/invite/bWrctJ7
🐦 Twitter ▶ / isaacharrisholt
🖥️ Portfolio ▶ ihh.dev
📝 Blog ▶ polar.sh/isaacharrisholt
__________________________________________
Timestamps:
00:00 - Introduction to Gleam
00:35 - Installing Gleam
00:48 - Gleam project structure
01:07 - Variables and data types
02:20 - Operators
02:41 - Blocks
02:56 - Imports
03:20 - Lists
03:43 - Pattern matching
04:40 - Functions
05:52 - Recursion
06:15 - Compound data types
07:19 - Modules
07:38 - Use
08:01 - Your Gleam journey
#gleam #softwareengineer

Пікірлер: 375

  • @ImHencke
    @ImHencke2 ай бұрын

    Gleam looks like Rust and Haskell had a child with a sprinkle of typescript

  • @IsaacHarrisHolt

    @IsaacHarrisHolt

    2 ай бұрын

    It's a really good language. The simplicity feels like you're writing Go. There's absolutely 0 magic it's great

  • @christiano3002

    @christiano3002

    2 ай бұрын

    That's the most accurate description I can think of. My brain will not leave me alone with the idea of transpiling Gleam into Rust.

  • @Uninspiriert

    @Uninspiriert

    2 ай бұрын

    See also F#, seems quite similar to Gleam.

  • @meppieomg

    @meppieomg

    2 ай бұрын

    Ocaml forever forgotten

  • @ImHencke

    @ImHencke

    2 ай бұрын

    @@meppieomg Whatever floats your functional boat

  • @chxmpetre8147
    @chxmpetre81472 ай бұрын

    Great explanation! We're currently in the process of overhauling the gleam language tour into something moke akin to a proper "book of Gleam", your take on explaing all theses language features lends itself so well for that !

  • @IsaacHarrisHolt

    @IsaacHarrisHolt

    2 ай бұрын

    I'd love to help! Give me a shout on Discord at any time :)

  • @michallepicki
    @michallepicki2 ай бұрын

    small mistake at 3:23, Gleam list are homogeneous, not heterogeneous

  • @IsaacHarrisHolt

    @IsaacHarrisHolt

    2 ай бұрын

    You're right, thank you! I always get those confused

  • @bpo217
    @bpo2172 ай бұрын

    I also would like more Gleam videos. Similar to what some are saying it's like a blend of Rust (without borrow checker), Haskell (without baggage), and Go (simplicity). The fact that 1.0 made sure to have incredible tooling and access to a huge ecosystem along with the simplicity of the language makes it the real deal. You can get things done really quickly right now. The creator is cool, too. As a long time dev I feel the need to put this out there because the language really is quite good. Give it a whirl on a real project you'll be really happy.

  • @IsaacHarrisHolt

    @IsaacHarrisHolt

    2 ай бұрын

    I'm definitely going to! Anything you recommend?

  • @bpo217

    @bpo217

    2 ай бұрын

    @@IsaacHarrisHolt I'd recommend doing a simple toy project that you want to build and see if it can do it! My personal journey is a custom file that stores records (serialize, deserialize, string parsing, io) but I wanted it to run on the Beam AND in Javascript. That gave me a bunch of insight into code organization, naming, and how to write something that targets one or the other or both (lots of standard library exploration plus some other common packages on hex.pm). A concurrent server like tcp or udp seems like a great choice too!

  • @bpo217

    @bpo217

    2 ай бұрын

    @@IsaacHarrisHolt Do a simple toy project you want to build which has multiple source code files and touches the file system. I did something with these criteria and I learned how to organize a gleam project, how gleam names things, importing a gleam package using the tooling, setting up formatting for Gleam in Nvim, and how pleasant the language is. A simple TCP server would be a good example. After working with it even more it feels a lot like OCaml with even less options on how to do things. It leads to very readable and a pleasant functional (the paradigm) code base. It's honestly functional Go. Go is more mature obviously but v1 Gleam is the functional language I have been waiting for.

  • @IsaacHarrisHolt

    @IsaacHarrisHolt

    2 ай бұрын

    That's very helpful, tysm!

  • @iamcookbook
    @iamcookbook12 күн бұрын

    I love the speed of these videos! I feel like you just dumped a ton of information into my brain and saved me so much time.

  • @IsaacHarrisHolt

    @IsaacHarrisHolt

    12 күн бұрын

    I'm glad you found it helpful!

  • @aus10d
    @aus10d2 ай бұрын

    Gleam seems really neat. I'm excited about it. Thanks for covering it!

  • @IsaacHarrisHolt

    @IsaacHarrisHolt

    2 ай бұрын

    Let me know what you build!

  • @brielov
    @brielov2 ай бұрын

    I would love more gleam videos. Specially networking stuff like sockets and such. Thanks for sharing this!

  • @IsaacHarrisHolt

    @IsaacHarrisHolt

    2 ай бұрын

    I will get on that! I also want to dive more into concurrency - I've never used a BEAM language before, so it's fascinating to me

  • @lewisheath364

    @lewisheath364

    2 ай бұрын

    @@IsaacHarrisHolterlang is awesome, i use it at work. i would highly recommend checking out the OTP principles

  • @IsaacHarrisHolt

    @IsaacHarrisHolt

    2 ай бұрын

    It's definitely something I'm gonna be looking into soon!

  • @tacticalassaultanteater9678
    @tacticalassaultanteater96782 ай бұрын

    Great video, covered all of the main points of interest.

  • @IsaacHarrisHolt

    @IsaacHarrisHolt

    2 ай бұрын

    Thanks! Glad you found it useful

  • @harrynair1811
    @harrynair18112 ай бұрын

    Gleam puts Erlang back into interesting choices to have in production. Of all the languages Erlang is one among the few where concurrency is baked in as a first class citizen and not an after thought, but the syntax is really weird and doesn’t have type safety either. Gleam gets that fun element back in and for all those who worry should I put this production- Erlang runtime has been out in production for decades and is mature. It is akin to ask shall I put apps written in Java, scala , or kotlin in production- it doesn’t really matter as it is the runtime (jre) that executes those instructions

  • @IsaacHarrisHolt

    @IsaacHarrisHolt

    2 ай бұрын

    I like this take a lot, but you can still have bugs in a programming language even if the runtime is mature. There could still be bad allocations, etc that cause memory leaks. That said, Gleam is being used in prod by Fly.io, so I trust it

  • @TheMASTERshadows
    @TheMASTERshadows2 ай бұрын

    Thank you so much !!! The pacing is soooo gooood

  • @IsaacHarrisHolt

    @IsaacHarrisHolt

    2 ай бұрын

    Thanks! I hope you found it helpful!

  • @TheMASTERshadows

    @TheMASTERshadows

    2 ай бұрын

    @@IsaacHarrisHolt Yes, next weekend project will be in Gleam for sure !

  • @IsaacHarrisHolt

    @IsaacHarrisHolt

    2 ай бұрын

    Good luck! I'm interested to see what you come up with :)

  • @kellybmackenzie
    @kellybmackenzie2 ай бұрын

    I adore how Haskell-like this is! I'm absolutely gonna give this language a try! 5:20 I love this, it's basically partial function application, that's awesome!

  • @IsaacHarrisHolt

    @IsaacHarrisHolt

    2 ай бұрын

    Go for it! Let me know what you create

  • @jedediah-fanuel
    @jedediah-fanuel2 ай бұрын

    Love your fast-paced content, just subscribed

  • @IsaacHarrisHolt

    @IsaacHarrisHolt

    2 ай бұрын

    Thank you!

  • @deryilz
    @deryilz2 ай бұрын

    cool! another great video. gleam looks like a very clean rust...

  • @IsaacHarrisHolt

    @IsaacHarrisHolt

    2 ай бұрын

    Thank you! Yes, I really like Gleam. It feels like Go + Rust minus methods. It's a fun language to write

  • @coder_one
    @coder_one2 ай бұрын

    More Gleam content is something I dream of in 2024!

  • @IsaacHarrisHolt

    @IsaacHarrisHolt

    2 ай бұрын

    On it!

  • @MichaelCampbell01
    @MichaelCampbell012 ай бұрын

    Been watching Gleam from the sidelines for a long time. I really like the typed aspect. Waiting for a killer Phoenix-like framework for it.

  • @IsaacHarrisHolt

    @IsaacHarrisHolt

    2 ай бұрын

    Take a look at Lustre! I'm not sure it's going all the way to Phoenix, but it's progressing

  • @zeroows
    @zeroows2 ай бұрын

    Thank you. I love Gleam and its syntax, which looks similar to Rust.

  • @IsaacHarrisHolt

    @IsaacHarrisHolt

    2 ай бұрын

    It's great!

  • @ericlee6029
    @ericlee60292 ай бұрын

    Great video! What did you use to make the video?

  • @IsaacHarrisHolt

    @IsaacHarrisHolt

    2 ай бұрын

    Obsidian!

  • @JonLambert1
    @JonLambert12 ай бұрын

    Well this looks just lovely.

  • @IsaacHarrisHolt

    @IsaacHarrisHolt

    2 ай бұрын

    It is! The people are great too

  • @nandans2506
    @nandans2506Күн бұрын

    Interesting language. Lot to love

  • @IsaacHarrisHolt

    @IsaacHarrisHolt

    Күн бұрын

    Agreed! I do love it

  • @nikensss
    @nikensss19 күн бұрын

    yes, more Gleam, please!

  • @IsaacHarrisHolt

    @IsaacHarrisHolt

    19 күн бұрын

    Working on it!

  • @Hector-bj3ls
    @Hector-bj3lsАй бұрын

    I hope it either sets up a trampoline or outputs loops for it's recursion when compiling to JS.

  • @IsaacHarrisHolt

    @IsaacHarrisHolt

    Ай бұрын

    What do you mean by a trampoline?

  • @AaaTeeEyeBee
    @AaaTeeEyeBee2 ай бұрын

    At 5:05 should the function be multiply_and_divide() in lines 9-13? If not, how did it get shortened to multiply()?

  • @IsaacHarrisHolt

    @IsaacHarrisHolt

    2 ай бұрын

    It probably should, yeah 😅

  • @myway6335
    @myway63352 ай бұрын

    It looks amazing! Like a Rust for humans without tons of syntax garbage. I wish the language to prosper!

  • @IsaacHarrisHolt

    @IsaacHarrisHolt

    2 ай бұрын

    It's great!

  • @lucas0sz
    @lucas0sz2 ай бұрын

    Hope the `use value

  • @Voidstroyer

    @Voidstroyer

    2 ай бұрын

    Elixir has "with x

  • @IsaacHarrisHolt

    @IsaacHarrisHolt

    2 ай бұрын

    Interesting!

  • @kilianvounckx9904

    @kilianvounckx9904

    25 күн бұрын

    Roc has a similar thing called backpassing

  • @IsaacHarrisHolt

    @IsaacHarrisHolt

    25 күн бұрын

    ​@@kilianvounckx9904 good to know! Roc looks really interesting

  • @computerfan1079
    @computerfan10792 ай бұрын

    This looks really nice. I love functional programming. I tried Ocaml, but it has terrible tooling. F# is pretty good, but many things are still borrowed from C#. This takes the lessons from Rust but applies them to a funtional paradigm, and it looks really promising

  • @IsaacHarrisHolt

    @IsaacHarrisHolt

    2 ай бұрын

    Interesting! I thought OCaml tooling had improved. I do remember having some difficulty getting set up initially though

  • @Ikxi
    @Ikxi2 ай бұрын

    Hey, awesome vid! Do you have this video maybe as an article? It's really quick for me, so I'd rather read it than watch it, I think.

  • @IsaacHarrisHolt

    @IsaacHarrisHolt

    2 ай бұрын

    I don't (yet)! But I'd recommend taking a look at the Gleam tour (tour.gleam.run) which covers pretty much all of this

  • @thanosfisherman
    @thanosfisherman2 ай бұрын

    But is it BLAZINGLY fast?

  • @IsaacHarrisHolt

    @IsaacHarrisHolt

    2 ай бұрын

    Not particularly - BEAM languages are better for fault tolerance and concurrency than raw speed

  • @mikaeels2691
    @mikaeels26912 ай бұрын

    Having written a bit of Ocaml, this seems like something I can get into!

  • @IsaacHarrisHolt

    @IsaacHarrisHolt

    2 ай бұрын

    Awesome! I want to try OCaml myself, but I think I'm gonna go all in on Gleam for a while

  • @nyahhbinghi

    @nyahhbinghi

    2 ай бұрын

    @@IsaacHarrisHolt OCaml is good but the concurrency model is unclear...Erlang/BEAM is proven

  • @IsaacHarrisHolt

    @IsaacHarrisHolt

    2 ай бұрын

    Yeah, the BEAM is really cool. I've been paying around with it a fair bit

  • @coder_one
    @coder_one2 ай бұрын

    Since Gleam compiles to JavaScript, I can't wait for bindings to be created that allow you to write applications such as React or Vue in Gleam. So much security, so much yumminess!

  • @IsaacHarrisHolt

    @IsaacHarrisHolt

    2 ай бұрын

    Nothing stopping you from creating them ;)

  • @coder_one

    @coder_one

    2 ай бұрын

    @@IsaacHarrisHolt my knowledge about Gleam and functional programming is not enough (I hope this will change).

  • @IsaacHarrisHolt

    @IsaacHarrisHolt

    2 ай бұрын

    No better way to learn than a project!

  • @evertonc1448
    @evertonc14482 ай бұрын

    Are you guys aware of any template/project of an RestAPI with good clean code principles made in Gleam? I’m curious to see how the separation of responsibilities would work in a functional language like Gleam 😬

  • @IsaacHarrisHolt

    @IsaacHarrisHolt

    2 ай бұрын

    Take a look at the Wisp library written by Louis Pilfold. It's a webserver framework for Gleam

  • @johnyepthomi892
    @johnyepthomi8922 ай бұрын

    *How can you implement a doubly Linked List in Gleam?* I'm just trying it out nad Gleam is just what i needed, statically typed, Rust like compiler assistance and Rust like syntax but without the Rust slow compile time. its a marriage of things we all needed.

  • @IsaacHarrisHolt

    @IsaacHarrisHolt

    2 ай бұрын

    I don't know how you'd go about implementing a doubly linked list - there's probably a way, but it might involve writing Erlang instead. But I'm glad you like Gleam :)

  • @johnyepthomi892

    @johnyepthomi892

    2 ай бұрын

    @@IsaacHarrisHolt I was actually looking at an erlang implementation when you commented. Thanks.

  • @IsaacHarrisHolt

    @IsaacHarrisHolt

    2 ай бұрын

    No worries!

  • @batuhanaydn4592
    @batuhanaydn45922 ай бұрын

    From the first glance of syntax, it seems extremely similar to F#

  • @IsaacHarrisHolt

    @IsaacHarrisHolt

    2 ай бұрын

    It's a functional language like F#, so it's a little similar for sure :)

  • @Blubb3rbub
    @Blubb3rbub2 ай бұрын

    Gleams ints only fall back to float64 like JavaScript when gleam is running in JavaScript. In the erlang backend they are proper unsized ints without max and min value like in Python.

  • @IsaacHarrisHolt

    @IsaacHarrisHolt

    2 ай бұрын

    Correct! I believe that's what I said in the video. Happy to correct myself if I was wrong 😅

  • @Blubb3rbub

    @Blubb3rbub

    2 ай бұрын

    @@IsaacHarrisHolt Yea, you are right. You said "On the Erlang vm these have no minimum or maximum size, but they are represented by the number type in JavaScript" at 1:30, but I misunderstood it as "They have no minimum/maximum size, but they function the same as float64 does in JavaScript everywhere", which shocked me, as that would be a horrible decision. (So I thought the "but" references the type in Erlang and not switching the sentence to the javascript backend).

  • @IsaacHarrisHolt

    @IsaacHarrisHolt

    2 ай бұрын

    Ah, sorry for the confusion!

  • @weiSane
    @weiSane2 ай бұрын

    For a second there I thought you were writing rust. Then I remembered it’s a gleam quick tutorial.

  • @IsaacHarrisHolt

    @IsaacHarrisHolt

    2 ай бұрын

    It's so interesting that a lot of people have this opinion. Personally I think it's more like Go, but I do see where you're coming from.

  • @anafro_ru
    @anafro_ru2 ай бұрын

    HM So if return statement doesn't exist, so I can't do an early return? :(

  • @IsaacHarrisHolt

    @IsaacHarrisHolt

    2 ай бұрын

    Correct! You can use a case statement instead

  • @nyahhbinghi

    @nyahhbinghi

    2 ай бұрын

    no expert, but I don't think you can, you just have to write more functions...frankly function overloading and early return are useful - the user should have a choice

  • @IsaacHarrisHolt

    @IsaacHarrisHolt

    2 ай бұрын

    You have to write more functions, sure, but then you can call them using a case statement. The lack of early returns forces you to keep functions small in some cases, which makes the code a lot more readable

  • @draakisback
    @draakisback2 ай бұрын

    I like gleam but it's definitely got its rough edges, I say this is somebody who writes elixir and erlang pretty often. I suppose that puts me in the minority given that a lot of people are probably approaching this language from languages outside of the beam. Where gleam has its rough edges comes from its interoperability specifically with elixir but also with erlang. Obviously, when you are importing the functions and types from dynamic languages, it becomes more difficult to make sure that everything is type safe. I do hope they make the FFI a little bit more sane as right now most of my wrapper functions either have to use the dynamic type or a generic. You can, by the way, hit situations where you have undefined types if your FFI type doesn't cover all of the incoming types. Because gleam has no way of handling undefined, there's nothing you can really do about it except to try to expand the wrappers. That being said, one of the really cool things about how the gleam struct and type system works is that all of the types are based off of tuples. For example, a result type in gleam is actually just a tuple in erlang or elixir that starts with either an ok or error atom. The implication of this is pretty cool, because you can essentially reference all of your gleam types just by appending an atom with the type name to the beginning of a tuple. You can also call any of the gleam functions from one of the other beam languages just by using the module system. The atom gleam@result is equivalent to gleam/result. The other pretty big rough edge is the actor and supervisor implementation. The supervisor implementation specifically is really limited because it doesn't really implement a lot of functionality. In elixir, when you set up a supervisor, it's a actor that watches your other actors and handles fall over situations and errors. In gleam though, the supervisor isn't a process by default, which means it can block your entry point process. And because the way the actors work, you can't just spin up a task or another process to delegate the underlying supervision loop. What ends up happening is that you kind of have to add many layers of abstraction to make it work properly. I had to implement an entire registry just to get the actor subjects for the child actors of the supervisor so that it could link to them properly. And that's where the actor abstraction is also kind of rough. For an actor to talk to another actor, it needs to know about that actors subject, which is basically it's process ID. This means that there are a lot of instances where both actors need to have a way of getting the other's subject. If one of these actors falls over, you need to regenerate the subject to be able to restore communication, and so every single actor ends up having some kind of message to make this easier. In elixir or erlang, you can take advantage of linking and the registry to find another actor but you can't do this in gleam, at least not yet. All of these rough spots are things that will probably get fixed with time, but they definitely stop me from using this language over elixir or erlang right now. Since they are adding a type system to elixir, it's going to be much difficult for me to want to switch. That being said, I can't complain about the beam getting more attention given that it's such a fantastic piece of software. Right now, one of my favorite ways of using the beam is to mix rust and elixir together. If you wrap rust with elixir, you get this really nice pairing because of the way that rust handles errors. In the beam, if you want to reference native code, you can use native interface functions. The major downside of nifs is that they can cause the entire node to fall over if they end up hitting undefined behavior. This makes it so that your app is not nearly as fault tolerant as it should be. But with rust, you can use the result type or the option type to handle the situations where you would have had to deal with undefined or null behavior. In other words, if you write very pure functions in rust, then you have a guarantee that the nif will never take down your node. Sorry for the wall of text, just extremely passionate about this. Even though I've used elixir in my job for almost 8 years now, I still find it to be really fun to use.

  • @IsaacHarrisHolt

    @IsaacHarrisHolt

    2 ай бұрын

    No, this is great! I hope you don't mind, but I've actually forwarded your thoughts to the Gleam team to take a look at

  • @draakisback

    @draakisback

    2 ай бұрын

    @@IsaacHarrisHolt Thanks mate. I am probably going to contribute to Gleam since I like the project but its always a good thing to get feedback regardless.

  • @IsaacHarrisHolt

    @IsaacHarrisHolt

    2 ай бұрын

    Likewise! I'm trying to figure out how it all works at the moment

  • @ericdouglas_

    @ericdouglas_

    23 сағат бұрын

    This was a super insightful commentary, thanks for sharing it with us

  • @IsaacHarrisHolt

    @IsaacHarrisHolt

    22 сағат бұрын

    Of course!

  • @af2b
    @af2b2 ай бұрын

    Gleam are such amazing!

  • @IsaacHarrisHolt

    @IsaacHarrisHolt

    2 ай бұрын

    Agreed!

  • @ya64
    @ya6421 күн бұрын

    Gleam looks like a very cool language!

  • @IsaacHarrisHolt

    @IsaacHarrisHolt

    20 күн бұрын

    It is! I recommend checking it out

  • @SeanLazer
    @SeanLazer2 ай бұрын

    What kind of stuff have you been building with Gleam? Have you put it in production for anything?

  • @IsaacHarrisHolt

    @IsaacHarrisHolt

    2 ай бұрын

    Personally, no. I've only known about it for about a week, but I'm loving it already! Fly.io use it in production though

  • @harrynair1811

    @harrynair1811

    2 ай бұрын

    if I’m not mistaken the gleam transpiles to erlang and Erlang runtime (beam) has been used by telecom companies for decades

  • @SeanLazer

    @SeanLazer

    2 ай бұрын

    @@harrynair1811 yeah i'm not worried about Erlang but sometimes issues with a language's ergonomics or other challenges don't really become apparent until you start building real stuff with it

  • @IsaacHarrisHolt

    @IsaacHarrisHolt

    2 ай бұрын

    If you're curious, join the Gleam Discord. There are loads of cool projects happening all the time in there

  • @IsaacHarrisHolt

    @IsaacHarrisHolt

    2 ай бұрын

    @SeanLazer apologies, I've just learned I may be wrong here. Apparently Fly are just the sponsor and might not use it in production. You can definitely deploy Gleam to Fly though, so there's nothing stopping you trying it for free/cheap!

  • @carlo.casorzo
    @carlo.casorzo2 ай бұрын

    Please more gleam videos!

  • @IsaacHarrisHolt

    @IsaacHarrisHolt

    2 ай бұрын

    On it!

  • @AbdolaMike
    @AbdolaMikeАй бұрын

    id like to see some stuff you tried to build in gleam! even if its just code challenges. Been reading functional programming in python but maybe i should try in gleam to push myself even further!

  • @IsaacHarrisHolt

    @IsaacHarrisHolt

    Ай бұрын

    Take a look at my isaacharrisholt/youtube repo! There's a PR there for an upcoming Gleam video. It's my first time writing Gleam/FP though, so it's not perfect yet

  • @AbdolaMike

    @AbdolaMike

    Ай бұрын

    @@IsaacHarrisHolt thanks so much i'll check it out! and looking forward to more videos :)!

  • @IsaacHarrisHolt

    @IsaacHarrisHolt

    Ай бұрын

    @@AbdolaMike Thanks!

  • @stefanmaric
    @stefanmaric2 ай бұрын

    Can you do Grain next?

  • @IsaacHarrisHolt

    @IsaacHarrisHolt

    2 ай бұрын

    I've not heard of it! Sell me on Grain

  • @Lestibournes
    @Lestibournes2 ай бұрын

    I want type annotation to be required. I guess you can grow a list by spreading it into a new list together with the new elements?

  • @IsaacHarrisHolt

    @IsaacHarrisHolt

    2 ай бұрын

    That's right, yeah

  • @Lestibournes

    @Lestibournes

    2 ай бұрын

    @@IsaacHarrisHolt how do you let the user know which types a function expects without type annotation, and how does the function guarantee that it receives correct types without type annotation?

  • @IsaacHarrisHolt

    @IsaacHarrisHolt

    2 ай бұрын

    Gleam can infer the types from the operators and functions used. It's still 100% statically typed :)

  • @magne6049
    @magne60492 ай бұрын

    6:48 typo Andrew -> Mr Clark

  • @IsaacHarrisHolt

    @IsaacHarrisHolt

    2 ай бұрын

    You're right, thank you!

  • @doxologist
    @doxologist2 ай бұрын

    Gleam looks awesome. Only thing i hate is lack of early returns. Can easily cause nesting hell

  • @IsaacHarrisHolt

    @IsaacHarrisHolt

    2 ай бұрын

    You can still get nesting hell with early returns 😅 you just have a different way of dealing with it. With functional languages, you use case statements and more functions

  • @JohnDoe-np7do
    @JohnDoe-np7do8 күн бұрын

    Could be ignorance on my part but was looking through gleam stdlib & i didnt find a native networking library, not even TCP clients. Wish you covered calling into/referencing native erlang modules. In elixir its as easy as referencing an erlang module as a symbol/atom (identifier prefixed with a semi colon ':'). Im ocd ab dependencies, thats why i like go alot, its stdlib is robust. Even rust has a native networking library 😢 heck zig has built in http clients & listeners aswell 😂

  • @IsaacHarrisHolt

    @IsaacHarrisHolt

    8 күн бұрын

    The reason there's no networking in the stdlib is because of Gleam's multiple targets. The networking layer looks different depending on whether you're on Erlang or JavaScript. There are first party networking libs available though that already do the referencing for you: gleam_httpc for Erlang and gleam_fetch for JS. As for using FFI yourself, it's covered in the Gleam tour! tour.gleam.run

  • @JohnDoe-np7do

    @JohnDoe-np7do

    8 күн бұрын

    @@IsaacHarrisHolt ayee thanks for the reply, sure ill take a look myself! Great vids btw 👍

  • @IsaacHarrisHolt

    @IsaacHarrisHolt

    7 күн бұрын

    @@JohnDoe-np7do Thank you!

  • @GoldenBeholden
    @GoldenBeholden2 ай бұрын

    Not having if-else statements is certainly an odd one. I'd like to build something with Gleam just to see how far pattern matching can take me.

  • @akindurosegun2459

    @akindurosegun2459

    2 ай бұрын

    Elixir developer here, pattern matching is addictive… so much so that I forgot how to code without it

  • @IsaacHarrisHolt

    @IsaacHarrisHolt

    2 ай бұрын

    Pattern matching is great. Gleam's is a little restricted compared to some other languages, but a lot of that is because of the immutability

  • @alexnoman1498

    @alexnoman1498

    2 ай бұрын

    You can match mutiple values at once separated by comma. And wildcard any one or more. And assign the matches to a local const var easily. And qualify the match with an if guard. It's incredible.

  • @IsaacHarrisHolt

    @IsaacHarrisHolt

    2 ай бұрын

    It is pretty good, but I do wish you could do more complex string matching. For example, I'd love to be able to extract values without having to do regex: ``` case log_line { "[" level "]: " message -> ... _ -> ... } ``` Same with lists - you can only match on the beginning of the list (though I understand the performance implications for both of these).

  • @GreyDeathVaccine

    @GreyDeathVaccine

    2 ай бұрын

    @@alexnoman1498And what about nested conditionals? Can it be done with pattern matching as well?

  • @Nextdesu
    @Nextdesu2 ай бұрын

    I watched the video and usage of linked lists as basic lists blown my mind, can someone explain me why gleam devs took such desicion in language design??? I always heard that for modern cpus linked lists almost always worse than arrays because they are really hard to cache in l1, l2, l3 cpu caches due to them being despersed in memory, so in my view it just looks like a big perfomance hit out of the box.

  • @IsaacHarrisHolt

    @IsaacHarrisHolt

    2 ай бұрын

    Gleam (and other BEAM VM languages) aren't performance focused. Using a single linked list makes sense when the list is immutable, and allows you to reduce memory usage by sharing the tail of the list across multiple variables etc. If an array was used instead, there would have to be a lot of memory copying to get the same immutability

  • @Nextdesu

    @Nextdesu

    2 ай бұрын

    @@IsaacHarrisHolt Thanks for the answer, that finally makes sense, just surprised for such a decision when everyone else chasing speed and perfomance

  • @SnowTheParrot
    @SnowTheParrot2 ай бұрын

    i would love a deeper Gleam video

  • @IsaacHarrisHolt

    @IsaacHarrisHolt

    2 ай бұрын

    Awesome! What sort of stuff would you like to see?

  • @SnowTheParrot

    @SnowTheParrot

    2 ай бұрын

    @@IsaacHarrisHolt I would really like to hear about what its MOST optimized for and what niche (if any) you think it will be adopted by. What type of projects do you think will Gleam be chosen for? Do you think it will be a general purpose language? Or be utilized exclusively by a whole industry like Elixir and Erlang have with Telecom? What does it do well and not so well? This is the first opportunity Ive had to try a brand new language and im kinda excited to try it

  • @IsaacHarrisHolt

    @IsaacHarrisHolt

    2 ай бұрын

    Interesting! I think Gleam's path is yet to be set, to be honest. Telecoms is probably going to adopt it at some point given it runs on the BEAM, but it's also got potential uses in web development and other areas. Honestly I can't predict the future, and it's still a very young language. I think the community will shape the language a lot in the coming years.

  • @Yerdanimagap-di7iq
    @Yerdanimagap-di7iq2 ай бұрын

    But I'm wondering why/what problem gleam can but others can't solve?

  • @alexnoman1498

    @alexnoman1498

    2 ай бұрын

    There are pretty much no programming languages that can solve a problem that C can't solve. Silly argument, categorically.

  • @IsaacHarrisHolt

    @IsaacHarrisHolt

    2 ай бұрын

    At the moment, the biggest one is type safety on the BEAM. It's also similar enough to C-like languages that it acts as a nice intro to FP for people

  • @soufianeg3815
    @soufianeg3815Ай бұрын

    Something wrong at 1:55 on line 4. Assigning the string "Skyrim" to a variable named best_game should result in an unbiasedBadTaste error

  • @IsaacHarrisHolt

    @IsaacHarrisHolt

    Ай бұрын

    I appreciate the effort you went through for this burn. Unfortunately my response hit a 451 error when trying to upload to KZread.

  • @soufianeg3815

    @soufianeg3815

    Ай бұрын

    Fair enough

  • @Voidstroyer
    @Voidstroyer2 ай бұрын

    Yeah, the only unique thing that this brings with it is that it has the option to compile to javascript and that it already has static typing built-in. I would still prefer to use Elixir though since it is more mature, has a larger ecosystem, and is already battle tested. And with the progress on Elixir's static type system coming "relatively soon", I don't see why people would choose to use Gleam over Elixir at that point. If you need javascript, why not just directly use javascript (or Typescript) instead? And if you need BEAM stuff, I would argue that Elixir is still a better choice.

  • @alexnoman1498

    @alexnoman1498

    2 ай бұрын

    Their ecosystems are the same. You can use every erlang and elixir package with gleam already.

  • @IsaacHarrisHolt

    @IsaacHarrisHolt

    2 ай бұрын

    "Relatively soon" has been promised for a while. Gleam is also being used in production at Fly.io, so it's definitely prod-ready. The nice part about the transpilation is that you can write one language for frontend and backend without having to use JS directly or a WASM-compiled language. Gleam also just feels more familiar to devs coming from C-like languages, so I think it's well-placed to drive adoption of FP

  • @Voidstroyer

    @Voidstroyer

    2 ай бұрын

    @@IsaacHarrisHolt Yeah that's why I put "relatively soon" in quotes. There is still no ETA of when it will be ready for use. Maybe i'm just a bit skeptical about the "one language for both frontend & backend" thing since a lot of people would argue that Javascript on the backend was a mistake. Of course, reality is a bit more nuanced than that. In a lot of cases (if not most), using javascript on the backend is fine for as long as performance isn't critical. If this does indeed help to drive adoption for FP then I would see it as a net win. I would still recommend you at least take a look at Elixir though (since you mentioned in the video that Gleam was the first FP language that you have tried). Elixir, together with Phoenix & Phoenix Liveview make it possible to create full stack applications without touching any Javascript (or at least keeping it to the bare minimum).

  • @IsaacHarrisHolt

    @IsaacHarrisHolt

    2 ай бұрын

    I do want to look at Elixir for sure, but I'm gonna stick with Gleam for a while to make sure I understand BEAM etc. before moving on. I already spend too much time chasing shiny new things!

  • @Voidstroyer

    @Voidstroyer

    2 ай бұрын

    @@IsaacHarrisHolt Totally get the feeling. I myself am still not adept at using Elixir and I was first introduced to it (& Phoenix) back in 2020. I haven't used it in production and I constantly restart my own projects with it so I haven't actually built anything using Elixir yet lol.

  • @joyousblunder
    @joyousblunder2 ай бұрын

    do Odin next ❤

  • @IsaacHarrisHolt

    @IsaacHarrisHolt

    2 ай бұрын

    On the list!

  • @Dozer456123
    @Dozer4561232 ай бұрын

    I love to see functional programming leaking into javascript dev land :P

  • @IsaacHarrisHolt

    @IsaacHarrisHolt

    2 ай бұрын

    Honestly anything is an improvement over JavaScript

  • @pokefreak2112
    @pokefreak21122 ай бұрын

    But what are people actually making in it? I checked the package registry and awesome-gleam repo and everything seems extremely young. I also fear for the double compilation model, right now it seems like people are either making libs targeting js _or_ beam, not supporting both. This is a pretty major red flag for the ecosystem moving forward

  • @IsaacHarrisHolt

    @IsaacHarrisHolt

    2 ай бұрын

    It is pretty young because the language is. I don't think the double compilation thing is necessarily a red flag. Some libraries will support both, while some will be specific. It's no different from a JS library being frontend or backend only.

  • @pokefreak2112

    @pokefreak2112

    2 ай бұрын

    @@IsaacHarrisHolt That's fair, I just don't really understand why people are hyping up the language when it's not particularly good at anything just yet. I like the syntax and the vision for the project, but that's about all there is to say right now. And yeah not saying it's a problem specific to gleam, I'd argue node.js also got this very wrong by not attempting to be as browser-compatible as possible. I just think languages could be doing a lot better at being cross-platform, just having an ffi and letting userspace do the rest of the work isn't particularly interesting as even ancient languages like C already do the exact same thing

  • @IsaacHarrisHolt

    @IsaacHarrisHolt

    2 ай бұрын

    That's the problem with C though, at this point. There's an article I read somewhere about C being more of an API language than a programming language now. It's mostly used by other programming languages interfacing with the OS

  • @palgun.
    @palgun.2 ай бұрын

    Can you make Linux commands for impatient devs pls?

  • @IsaacHarrisHolt

    @IsaacHarrisHolt

    2 ай бұрын

    Oooh interesting! That'd probably be really useful for me too, tbh

  • @palgun.

    @palgun.

    2 ай бұрын

    ​@@IsaacHarrisHoltthanks Isaac

  • @VivekYadav-ds8oz
    @VivekYadav-ds8oz2 ай бұрын

    Ok I was lovin' it until you said it doesn't have early returns?! Wtf! Doesn't that mean you cannot extract edge-cases and handle them first? You now have to nest your if-else's. I've never touched a functional language so I don't know if there's a common pattern for this, but I find it crazy.

  • @IsaacHarrisHolt

    @IsaacHarrisHolt

    2 ай бұрын

    It's a pretty common pattern. You'd normally handle it with pattern matching :)

  • @sfulibarri

    @sfulibarri

    2 ай бұрын

    I'd say its a bit of a trade off. On one hand it can sometimes feel uncomfortable to need to organize your code around this design choice in the language but on the other you can always and forever know for sure that the last statement in any function is what it returns. Pattern matching does typically take most of the edge off that discomfort though. The biggest hurdle is getting comfortable with it all; when I first learned erlang my brain felt broken 2-3 weeks until it clicked, then it felt surprisingly natural and ergonomic.

  • @IsaacHarrisHolt

    @IsaacHarrisHolt

    2 ай бұрын

    It's started clicking for me slowly. I'm enjoying it greatly

  • @SuperOblivionfan

    @SuperOblivionfan

    2 ай бұрын

    You only really want to do an early return in two cases i can think of. One is to break out of a loop early, which gleam doesnt have any loops so no need there. Or another is some special condition is met, where you want to return something before going on to do other things. That is covered by pattern matching as others have said. In functional programming in general, you want to try to make your functions as small / simple as possible, and compose them from other functions. So you typically wont run into a problem where you wish you could use an early return, because the function is so small anyways.

  • @SuperOblivionfan

    @SuperOblivionfan

    2 ай бұрын

    And regarding deep nesting issues, you can usually use monads to "short circuit" a complicated tree of code paths into a single linear path. Sorry to use the word monad there as if you are new to FP it is just going to send you down an annoying, but hopefully interesting, rabbit hole. But the main idea is to think of it as short circuiting in this case. Like, do thing A that might return a result or an error (edge case), and then push that result if it exists into a function to do things with that valid result, otherwise just return the error / bubble it up. Usually the errors that are bubbled up are dealt with at the top of the call stack

  • @johannbauer2863
    @johannbauer28632 ай бұрын

    Can't tell whether this looks like more convenient Haskell or less convenient Haskell, lol

  • @IsaacHarrisHolt

    @IsaacHarrisHolt

    2 ай бұрын

    It's Haskell that you can actually use in production

  • @mintx1720
    @mintx17202 ай бұрын

    If only I knew I could have just not added things like return I might have finished my scripting language lmao.

  • @IsaacHarrisHolt

    @IsaacHarrisHolt

    2 ай бұрын

    I think a scripting language probably needs early returns 😅 but valid

  • @aleksd286
    @aleksd2869 күн бұрын

    We need something in production to run with Gleam

  • @IsaacHarrisHolt

    @IsaacHarrisHolt

    9 күн бұрын

    Yes! Please build for prod. Gleam is ready for it, are you 👀

  • @aleksd286

    @aleksd286

    8 күн бұрын

    @@IsaacHarrisHolt haven’t seen any examples, or any big companies using it in production. A bit risky imo

  • @IsaacHarrisHolt

    @IsaacHarrisHolt

    7 күн бұрын

    @@aleksd286 because it's only recently become production ready. People are starting to move to it

  • @user-tb4ig7qh9b
    @user-tb4ig7qh9b2 ай бұрын

    Came to elixir and keep your heart on it

  • @IsaacHarrisHolt

    @IsaacHarrisHolt

    2 ай бұрын

    Not a Gleam fan?

  • @user-tb4ig7qh9b

    @user-tb4ig7qh9b

    2 ай бұрын

    @@IsaacHarrisHolt No it is awesome language but i prefer elixir

  • @IsaacHarrisHolt

    @IsaacHarrisHolt

    2 ай бұрын

    Fair!

  • @JinKee
    @JinKeeАй бұрын

    2:21 I am not thrilled that x/0===0 that sounds pretty risky to not check for that

  • @IsaacHarrisHolt

    @IsaacHarrisHolt

    Ай бұрын

    There's a stdlib function that returns a Result if you need it :)

  • @JinKee

    @JinKee

    Ай бұрын

    @@IsaacHarrisHolt okay that sounds alright

  • @FabioNascimentoToli
    @FabioNascimentoToli2 ай бұрын

    Ola, tenho uma 48SX muito bem conservada, porem eu dei bobeira e uma das pilhas "vazou" e acabou danificando um dos contatos. Gostaria de envia-la para que voce tentasse conserta-la.

  • @IsaacHarrisHolt

    @IsaacHarrisHolt

    2 ай бұрын

    Não tenho certeza se isso é algo em que posso ajudar. Sou engenheiro de software

  • @Rundik
    @Rundik2 ай бұрын

    Looking at backend benchmarks, every single language on beam vm is very slow, like slower than php slow

  • @IsaacHarrisHolt

    @IsaacHarrisHolt

    2 ай бұрын

    In single-threaded benchmarks perhaps, but the strength of the BEAM is how easy it makes concurrency

  • @GreyDeathVaccine

    @GreyDeathVaccine

    2 ай бұрын

    When was the last time you checked your php speed? Versions 7 & 8 brought great speed gains.

  • @sfulibarri

    @sfulibarri

    2 ай бұрын

    BEAM was originally purpose built for high reliability and concurrency in critical telecom infrastructure, it deliberately trades raw speed to achieve this but it is generally considered *at least* fast enough for most use cases where its qualities are desirable. The success of tools like RabbitMQ and EjabberD at massive scale demonstrate this.

  • @gosnooky
    @gosnooky2 ай бұрын

    Not having loops is just an alien concept to me.

  • @IsaacHarrisHolt

    @IsaacHarrisHolt

    2 ай бұрын

    Yeah, having never written in a functional language before, it's a little tricky to get your head around first time.

  • @Soul-Burn

    @Soul-Burn

    2 ай бұрын

    Iterative loops are usually implemented in functional languages as map/fold/reduce/accumulate and the likes. The body inside the "for" is given as a function which returns the result and and the state for the next iteration. Example in pseudo code. Instead of: sum = 0 for item in list: sum += item You have: sum = fold(list, 0, fn(cur, state) { cur + state })

  • @IsaacHarrisHolt

    @IsaacHarrisHolt

    2 ай бұрын

    Absolutely! And Gleam provides all of these

  • @emptydata-xf7ps

    @emptydata-xf7ps

    2 ай бұрын

    I mean if you think about it a for and while loop is just a recursive call after a comparison. “If this condition isn’t met do this again”.. The only difference is recursion is wrapped inside its own function. And functional languages use function overloading so you have a base case function and a recursive case function.

  • @neoplumes
    @neoplumes2 ай бұрын

    Now this is what functional languages were supposed to be

  • @IsaacHarrisHolt

    @IsaacHarrisHolt

    2 ай бұрын

    Isn't it great? Let me know what you build with it!

  • @aenguswright7336
    @aenguswright73362 ай бұрын

    Okay, no ifs is a bit weird but I can live without it, but no early returns and no float mods are pretty much deal breakers for me. I’m not even sure when you would use a mod operator when it’s not a float…?

  • @IsaacHarrisHolt

    @IsaacHarrisHolt

    2 ай бұрын

    You could use it to create a round robin counter (e.g. 0, 1, 2, 0, 1, 2, ...) without needing if statements etc (e.g. counter = { counter + 1 } % 3). A lack of early returns is pretty common for a functional language, and you can achieve most of what you need by separating into multiple functions and using case statements.

  • @fg786
    @fg7862 ай бұрын

    2:31 Why is that needed?

  • @IsaacHarrisHolt

    @IsaacHarrisHolt

    2 ай бұрын

    It's so that Gleam can infer when something should be a Float!

  • @fg786

    @fg786

    2 ай бұрын

    @@IsaacHarrisHoltThat relates to the result? Would 1.0 + 1.5 give an error or be 2 or 3?

  • @IsaacHarrisHolt

    @IsaacHarrisHolt

    2 ай бұрын

    1.0 + 1.5 would give a compile error 1.0 +. 1.5 would give 2.5

  • @fg786

    @fg786

    2 ай бұрын

    @@IsaacHarrisHoltThan I'm too dumb to understand, why does it need to infer type from the operator rather than the values? 1 + 2.0 would give an error but 1 +. 2 is fine and be 3.0? What's the underlying thought behind a special operator "because you are adding floats instead of ints"? Is the compiler handling the operation differently?

  • @IsaacHarrisHolt

    @IsaacHarrisHolt

    2 ай бұрын

    Consider the following function: ``` fn add(a, b) { a + b } ``` If the same operator was used for both, the compiler wouldn't know the types of `a` and `b` here. However, if we only use `+` for `Int` values, then the compiler knows `a` and `b` must both be integers. This way we don't need type annotations everywhere

  • @justy1337
    @justy13372 ай бұрын

    No install info on Linux 💀

  • @IsaacHarrisHolt

    @IsaacHarrisHolt

    2 ай бұрын

    You can use Homebrew, or it's available on a lot of the package managers

  • @carbon_wavelight

    @carbon_wavelight

    2 ай бұрын

    Gleam package is available on the AUR

  • @GreyDeathVaccine

    @GreyDeathVaccine

    2 ай бұрын

    @justy1337 Linux users does not need install instructions 🙂

  • @IsaacHarrisHolt

    @IsaacHarrisHolt

    2 ай бұрын

    There's some Linux instructions here: gleam.run/getting-started/installing/

  • @MarcoDamaceno
    @MarcoDamaceno2 ай бұрын

    Some Gleam's features remind me Ada.

  • @IsaacHarrisHolt

    @IsaacHarrisHolt

    2 ай бұрын

    Ooh interesting, I've never written Ada. What's the similarity?

  • @ernstmayer3868
    @ernstmayer38684 күн бұрын

    I find it unnecessarily complicated not having if/else or loop. Would improve readability and dx.

  • @IsaacHarrisHolt

    @IsaacHarrisHolt

    4 күн бұрын

    For loops are practically pointless in a language like Gleam where data is immutable. It's very common for functional programming languages (like Gleam, Erlang, Elixir, Haskell) not to have loops for this reason. As for if/else statements, one of Gleam's biggest values is simplicity. Since if/else can be accomplished with a case statement (and should actually be more performant than long if/else if chains on the BEAM target), there's no reason to have if/else. The goal is to minimise the surface area of the language, effectively. For example: ``` if cond { func1() } else { func2() } ``` becomes ``` case cond { True -> func1() False -> func2() } ``` You can also match on multiple values in a case statement, and that tends to be easier to read than a long if/else with lots of boolean logic.

  • @ernstmayer3868

    @ernstmayer3868

    3 күн бұрын

    @@IsaacHarrisHoltThank you. Can "True" or "False" be replaced by functions? Like: if (isSomethingGood()) doAnotherThing();

  • @IsaacHarrisHolt

    @IsaacHarrisHolt

    3 күн бұрын

    Of course! The predicate can be any value you can match on: ``` case is_something_good() { True -> do_another_thing() False -> cry() } ``` You can even match on strings etc. ``` case name { "Isaac" -> do_something() "Ernst" -> do_something_else() _ -> panic as "Unknown name!" } ```

  • @momoladebrouill
    @momoladebrouill2 ай бұрын

    It's OcamL with brackets

  • @IsaacHarrisHolt

    @IsaacHarrisHolt

    2 ай бұрын

    And better tooling 😉

  • @Nellak2011
    @Nellak20112 ай бұрын

    Gleam is the closest language to perfect that I can find.

  • @IsaacHarrisHolt

    @IsaacHarrisHolt

    2 ай бұрын

    It's great! And the fact it runs on the BEAM makes it even greater

  • @ismaelgrahms
    @ismaelgrahms2 ай бұрын

    Rust with a GC

  • @IsaacHarrisHolt

    @IsaacHarrisHolt

    2 ай бұрын

    A little, yeah!

  • @raglandasir6885

    @raglandasir6885

    2 ай бұрын

    (Gleam complier is written in Rust)

  • @IsaacHarrisHolt

    @IsaacHarrisHolt

    2 ай бұрын

    Yes, it is! It was definitely inspired in some places

  • @sfulibarri

    @sfulibarri

    2 ай бұрын

    Not entirely wrong though Gleam's pattern matching (erlang's really) is far more powerful than rust's, as nice as rust's is.

  • @fuzzy-02
    @fuzzy-022 ай бұрын

    It changed my perspective when I realized that whenever you learn a new language, you are learning the philosophy of another person. So dont waste your time learning books upon books of philosophies of different people and never sticking to at least one and using it for real. I personally dislike the /0 returning 0, the use of {} for math priority and for concatenation of strings.

  • @IsaacHarrisHolt

    @IsaacHarrisHolt

    2 ай бұрын

    That's totally fair. There are very good reasons for all of these, but there are equally good reasons for not doing them, so I definitely see your point. The last one, concatenation, is so that Gleam can infer when something needs to be a string over an int, float etc. and can therefore keep things statically-typed without needing to have type annotations everywhere

  • @agustinpizarro
    @agustinpizarro2 ай бұрын

    I am missing UFCS, but cool language

  • @IsaacHarrisHolt

    @IsaacHarrisHolt

    2 ай бұрын

    Fair, but you can achieve the same thing with the pipe operator most of the time. Gleam doesn't support any form of methods on types

  • @azizsafudin
    @azizsafudinАй бұрын

    The only thing I’m not a huge fan of, is allowing FFIs. Would prefer if they went the Elm route and created their own package manager and all projects be strictly Gleam.

  • @IsaacHarrisHolt

    @IsaacHarrisHolt

    Ай бұрын

    I understand the reasoning, but since they're running primarily on the BEAM anyway, allowing FFIs gives access to the incredible Erlang ecosystem. It's also the primary reason they're able to use OTP APIs for concurrency (more in my next video!) and fault tolerant, scalable systems.

  • @sootguy
    @sootguy2 ай бұрын

    seems to be mix between typescript and python :)

  • @IsaacHarrisHolt

    @IsaacHarrisHolt

    2 ай бұрын

    Interesting! That's a new one. I think Gleam matches up with a lot of languages

  • @sootguy

    @sootguy

    2 ай бұрын

    @@IsaacHarrisHolt ⁦yeah but the syntax look like typescript alot and the Camel case of types and boolean from python :D this why i said that

  • @IsaacHarrisHolt

    @IsaacHarrisHolt

    2 ай бұрын

    Gotcha!

  • @MattWyndham
    @MattWyndham2 ай бұрын

    spaceship operator

  • @IsaacHarrisHolt

    @IsaacHarrisHolt

    2 ай бұрын

    Oooh I love that! The UFO 👀

  • @homework8969
    @homework89692 ай бұрын

    Someone pythonified my rust D:

  • @IsaacHarrisHolt

    @IsaacHarrisHolt

    2 ай бұрын

    At least there's no significant whitespace!

  • @formyeve
    @formyeve2 ай бұрын

    I was excited until i saw recursion and then remembered my beef with erlang

  • @IsaacHarrisHolt

    @IsaacHarrisHolt

    2 ай бұрын

    It's common to use recursion in a lot of functional languages. It makes sense here where values are immutable

  • @formyeve

    @formyeve

    2 ай бұрын

    @@IsaacHarrisHolt idk my brain is just too dumb to structure recursive functions correctly. Skill issue, I know, I just like my for loops that's all

  • @Soul-Burn

    @Soul-Burn

    2 ай бұрын

    @@formyeve Don't do recursion directly. For most things, a map/fold/reduce/accumulate etc is more than enough. You only need custom recursion in rare cases.

  • @IsaacHarrisHolt

    @IsaacHarrisHolt

    2 ай бұрын

    This is true. I write JS/TS for a living and honestly I rarely find myself using for loops

  • @motbus3
    @motbus32 ай бұрын

    Oh no. Division by 0 is zero. What could possibly go wrong?

  • @IsaacHarrisHolt

    @IsaacHarrisHolt

    2 ай бұрын

    There's a standard library function that returns a Result :)

  • @JohnBrewerly
    @JohnBrewerly2 ай бұрын

    The function returns the last expression???? Cuteness and that always ends the same way

  • @IsaacHarrisHolt

    @IsaacHarrisHolt

    2 ай бұрын

    Yep! It's how Rust works too. It's quite common in functional languages

  • @JohnBrewerly

    @JohnBrewerly

    2 ай бұрын

    @@IsaacHarrisHolt yep and that's why with Python not running all code ends bad too in these statements

  • @JohnBrewerly

    @JohnBrewerly

    2 ай бұрын

    @@IsaacHarrisHolt and specifically in functional this would be the worst feature ever. Imagine multiple returns? I mean my God what a bad thing to watch

  • @IsaacHarrisHolt

    @IsaacHarrisHolt

    2 ай бұрын

    Yeah it would be awful

  • @Wawwior
    @WawwiorАй бұрын

    Gleam sounds cool! Although i feel like defining 'x / 0 = 0' should be a crime

  • @IsaacHarrisHolt

    @IsaacHarrisHolt

    Ай бұрын

    There's a good reason for it, and there's also a div method in the std lib that handles this case using the Result type :)

  • @Wawwior

    @Wawwior

    Ай бұрын

    @@IsaacHarrisHolt i get how it might be good im some cases, its just that it fucks with pure math. I feel like this breaks at least 5 Axioms in the Field of Real Numbers under multiplication and addition.

  • @Wawwior

    @Wawwior

    Ай бұрын

    @@IsaacHarrisHolt Also i think defining it to be +infinity would make more sense, regarding the limit of e.g. 1/x under x -> 0

  • @IsaacHarrisHolt

    @IsaacHarrisHolt

    Ай бұрын

    Gleam doesn't have the concept of infinity, and this result is actually quite common for BEAM languages. It's about making sure things don't crash as much as possible

  • @Wawwior

    @Wawwior

    Ай бұрын

    @@IsaacHarrisHolt :C

  • @4.0.4
    @4.0.42 ай бұрын

    I don't get it. Why have different operators for floats?

  • @IsaacHarrisHolt

    @IsaacHarrisHolt

    2 ай бұрын

    That way the compiler knows when a value is supposed to be a float without you having to write type annotations

  • @guelakais1438
    @guelakais14382 ай бұрын

    Sounds like the well-protected child of Rust and Typescript. From Rust it has learnt that the world is hard and evil and that you have to reckon with everything. From Typescript it has learnt to strike a softer note. I prefer to stick with Rust because I always want to know explicitly what's going on, the world is still hard and evil and I have to reckon with everything.

  • @IsaacHarrisHolt

    @IsaacHarrisHolt

    2 ай бұрын

    I would argue that Gleam always tells you what's going on. There's little to no magic

  • @guelakais1438

    @guelakais1438

    2 ай бұрын

    @@IsaacHarrisHoltThere are no nulltypes in Gleam. The error handling looks very similar to Rust. It also has strong similarities to Rust in terms of syntax. There are differences to Rust. Wasn't Gleam a real dynamically typed programming language?

  • @IsaacHarrisHolt

    @IsaacHarrisHolt

    2 ай бұрын

    Gleam is statically typed :)

  • @guelakais1438

    @guelakais1438

    2 ай бұрын

    @@IsaacHarrisHolt I truly need to check again, what are the differences between rust and gleam.

  • @IsaacHarrisHolt

    @IsaacHarrisHolt

    2 ай бұрын

    Gleam is a functional language, so values are always immutable, and there are no such thing as methods. It also runs on the BEAM VM rather than compiling to native code

  • @Jesse_Carl
    @Jesse_Carl2 ай бұрын

    Lists are homogeneous. Tuples are heterogenous.

  • @IsaacHarrisHolt

    @IsaacHarrisHolt

    2 ай бұрын

    Yep! You're right, thanks :)

  • @AGeekTragedy
    @AGeekTragedy2 ай бұрын

    "Lists are heterogeneous" ... wait. what? EDIT: oh it was just a mistake that you acknowledged below. phew

  • @IsaacHarrisHolt

    @IsaacHarrisHolt

    2 ай бұрын

    Yeah sorry 'bout that 😅

  • @seasong7655
    @seasong76552 ай бұрын

    How is something divided by 0 equal to 0 💀💀

  • @IsaacHarrisHolt

    @IsaacHarrisHolt

    2 ай бұрын

    It ensures the program never panics! It's a good tradeoff, I think. If you need 0 to be an invalid divisor, you can check it yourself and handle it that way

  • @jeggo182
    @jeggo1822 ай бұрын

    I don't know any coding yet I'm watching this. I have a problem. And his name is the Primeagen.

  • @IsaacHarrisHolt

    @IsaacHarrisHolt

    2 ай бұрын

    I understand your plight

  • @jeggo182

    @jeggo182

    2 ай бұрын

    Yeah, I watch him and get recommended all these coding videos :) Gleam does look cool, but my mind goes dead beyond basic HTML :D@@IsaacHarrisHolt

  • @IsaacHarrisHolt

    @IsaacHarrisHolt

    2 ай бұрын

    Hahahah well there are some great places to learn! Definitely an amazing skill to have

  • @user-tw2kd5wb5i
    @user-tw2kd5wb5i14 күн бұрын

    This looks a lot like rescript

  • @IsaacHarrisHolt

    @IsaacHarrisHolt

    14 күн бұрын

    A little, yeah! I prefer Gleam personally. I find the syntax more familiar, but I do see the benefits of ReScript

  • @Danielo515

    @Danielo515

    14 күн бұрын

    @@IsaacHarrisHolt yeah, I see how gleam is a bit more terse. However, they are making some of the same mistakes rescript did and even some of the ones they did when they were reasonml

  • @IsaacHarrisHolt

    @IsaacHarrisHolt

    14 күн бұрын

    @@Danielo515 interesting! What mistakes do you think those are?

  • @Danielo515

    @Danielo515

    14 күн бұрын

    @@IsaacHarrisHolt The lack of return keyword is one of them. Sure, having implicit returns is very nice, but having early returns really reduces complexity. Also the way they define type generics. Using parenthesis may look cooler, but makes it a lot harder to differentiate runnable code from just type definitions. There is a reason why most languages have settled in

  • @IsaacHarrisHolt

    @IsaacHarrisHolt

    13 күн бұрын

    The lack of early returns is very common in functional languages, and Gleam kinda gives you a way to emulate early returns by using: `use _

  • @_slier
    @_slier2 ай бұрын

    please, compile to native instead of just beam

  • @IsaacHarrisHolt

    @IsaacHarrisHolt

    2 ай бұрын

    It can also transpile to JavaScript! Compiling to native would be a loooot of work. A lot of the Gleam standard library requires the underlying Erlang/JS functions and there's a lot of FFI going on

  • @elieobeid77
    @elieobeid772 ай бұрын

    It's disgusting how everyone claims it's designed to create scalable applications and it's fast and whatnot even though it's never been used in production...

  • @IsaacHarrisHolt

    @IsaacHarrisHolt

    2 ай бұрын

    It runs on the BEAM, which is the most fault-tolerant platform out there. Also, you can deploy it on Fly.io, so there's no reason you can't try it in production and test it yourself :)

  • @elieobeid77

    @elieobeid77

    2 ай бұрын

    @@IsaacHarrisHolt i don't want to test it thanks. i know how it works but to claim all those claims while it's still in beta it's stupid. Rust had all those claims from the start and barely started to become usable in 2022 and broke backwards compatibility a million times to the point I don't care about it anymore

  • @IsaacHarrisHolt

    @IsaacHarrisHolt

    2 ай бұрын

    It's not in beta! They've just released V1 of the language. I think to make comments like this without even being willing to give the language a shot is a little short-sighted.

  • @SR-ti6jj
    @SR-ti6jj2 ай бұрын

    Can zoomers use this language?

  • @gosnooky

    @gosnooky

    2 ай бұрын

    Not unless emojis can be used for variable names.

  • @IsaacHarrisHolt

    @IsaacHarrisHolt

    2 ай бұрын

    Absolutely! Very zoomer-friendly

  • @davguev
    @davguev2 ай бұрын

    Ugh... It enforces snake case...

  • @IsaacHarrisHolt

    @IsaacHarrisHolt

    2 ай бұрын

    Yep! Your code will forever be readable

  • @davguev

    @davguev

    2 ай бұрын

    @@IsaacHarrisHolt I understand your love for snake case readability, but also really dislike using underscores, so uncomfortable. I know I can remap it to faster key combinations, but I'd have to do that for every machine I work on and I won't be able to do that if I'm using a shared or lent one.

  • @IsaacHarrisHolt

    @IsaacHarrisHolt

    2 ай бұрын

    True, but how often do you use a shared machine? You spend more time reading code than writing it, so I personally think the tradeoff is worth it regardless

  • @davguev

    @davguev

    2 ай бұрын

    @@IsaacHarrisHolt I think it should be a matter of choice.

  • @IsaacHarrisHolt

    @IsaacHarrisHolt

    2 ай бұрын

    Fair, but many modern languages will enforce one way or another. Personally, I think it's better to be consistent.

  • @Lestibournes
    @Lestibournes2 ай бұрын

    No instructions for Linux, despite it being popular among developers.

  • @IsaacHarrisHolt

    @IsaacHarrisHolt

    2 ай бұрын

    You can install via Homebrew :)

  • @Lestibournes

    @Lestibournes

    2 ай бұрын

    @@IsaacHarrisHolt isn't homebrew for Mac? I'm confused.

  • @IsaacHarrisHolt

    @IsaacHarrisHolt

    2 ай бұрын

    It's for Mac and Linux. Plus, there's quite a few Linux distros mentioned here: gleam.run/getting-started/installing/

  • @Lestibournes

    @Lestibournes

    2 ай бұрын

    @@IsaacHarrisHolt cool.

  • @nathanb011
    @nathanb0112 ай бұрын

    "Has Nil" "No null or undefined" I don't think that's quite accurate

  • @IsaacHarrisHolt

    @IsaacHarrisHolt

    2 ай бұрын

    Typically, null and undefined can be applied to any value. In Gleam, Nil is equivalent to () in Rust, and is only ever Nil.

  • @alexnoman1498

    @alexnoman1498

    2 ай бұрын

    Nil can never sneak up on you. Null can. Massive difference. The typechecker reminds you whether something returns only ever Nil or something else that can never ever be null.

  • @IsaacHarrisHolt

    @IsaacHarrisHolt

    2 ай бұрын

    Absolutely! And you can use `Option` or `Result(_, Nil)` (which is how the Gleam stdlib does it) if you want optionality

  • @forsureitsme
    @forsureitsme13 күн бұрын

    It was all fun and games, but you lost me on "gleam does not uses parenthesis to determine order of operation"

  • @IsaacHarrisHolt

    @IsaacHarrisHolt

    13 күн бұрын

    It uses blocks! It's just a different symbol, ultimately

  • @GuyMichaely
    @GuyMichaely2 ай бұрын

    Anyone else not really like the this language from just seeing this one video? Seems unnecessarily clunky. The pattern matching is neat though

  • @IsaacHarrisHolt

    @IsaacHarrisHolt

    2 ай бұрын

    I wouldn't say it's clunky - it's a simple language. It has a similar philosophy and feel to Go, in that sense.

  • @fuzzy-02

    @fuzzy-02

    2 ай бұрын

    Yeah, I thought the language was new shiny cool but after seeing it I found it very bad for my taste. Like.... "why?" Is what I found myself asking on many many points

  • @IsaacHarrisHolt

    @IsaacHarrisHolt

    2 ай бұрын

    Not everyone can like the same things. That would make the world very boring

  • @kallehed6330
    @kallehed63303 күн бұрын

    brooo who cares???? WOW, THE SYNTAX

  • @IsaacHarrisHolt

    @IsaacHarrisHolt

    2 күн бұрын

    I'm a little confused at what you're trying to say here 😅