Gleam 1.0 Is Out! (I think I'm in love...)

Theo - t3․gg
10 Mar 202433:25

Summary

TLDRGleam, a new programming language built on the Erlang VM, has released its first stable version, Gleam 1.0.0. Designed for type safety and concurrency, Gleam aims to simplify software development with a small, consistent language surface area. It offers robust static analysis, a practical type system, and a focus on developer productivity and sustainability. The language's features include immutability, pattern matching, and a unique approach to type definitions and function handling. Gleam's community-driven development and sponsorship model highlight the project's commitment to long-term support and growth.

Takeaways

  • 🌟 Gleam 1.0.0 has been released, marking the first stable release of the language.
  • 🛠️ Gleam is built on the Erlang VM (BEAM), inheriting its benefits and focusing on type safety and a practical type system.
  • 🚀 The language aims to make software development predictable, stress-free, and enjoyable, with a consistent and small surface area for easy learning.
  • 🔍 Gleam emphasizes type safety, avoiding null values, implicit conversions, and exceptions, providing clear error messages.
  • 🔄 It supports concurrency with ease, similar to Erlang and Elixir, making it suitable for building scalable systems.
  • 🔧 Gleam's compiler serves as a programming assistant, aiding in refactoring and reducing the risk of breaking changes.
  • 🌐 Gleam code can run on JavaScript runtimes, allowing for broader application possibilities, including in-browser execution.
  • 📚 The language includes a code formatter and language server, promoting a consistent coding style and improving developer experience.
  • 💼 Version 1 signifies stability and readiness for production use, with a commitment to maintaining backward compatibility.
  • 🤝 The Gleam community is actively contributing to the project, with a focus on impactful and meaningful development.

Q & A

  • What is Gleam and why is it significant?

    -Gleam is a programming language designed for building typesafe systems that scale. It is significant because it is built on top of the Erlang VM (BEAM), which provides the same benefits as Elixir, but with a stronger focus on type safety and a practical type system.

  • What are the key features of Gleam's type system?

    -Gleam's type system includes no null values, no exceptions, clear error messages, and a practical approach to type safety. It is inspired by languages like Elm, old Camo, and Rust, offering robust static analysis and a compiler that serves as a programming assistant.

  • How does Gleam handle concurrency?

    -Gleam leverages the concurrency capabilities of the Erlang VM, allowing for easy implementation of concurrency with features like process spawning and message passing. This makes it suitable for building high-performance, concurrent systems.

  • What does Gleam's version 1.0.0 release signify?

    -The release of Gleam 1.0.0 marks the first stable release of the language, indicating that it is now suitable for production use and that the developers will prioritize maintaining backward compatibility.

  • How does Gleam differ from other languages in terms of performance focus?

    -While many modern languages focus on raw performance, Gleam emphasizes the importance of concurrency and the ability to handle multiple cores effectively. It aims to solve performance issues related to concurrency rather than单纯的追求语言的执行速度.

  • What is the Gleam standard library and how does it relate to the V1 release?

    -The Gleam standard library is a collection of core packages maintained by the Gleam team. It is set to receive an accompanying V1 release, ensuring that the standard library is compatible with the new version of the language.

  • How does Gleam support developer productivity and sustainability of the project?

    -Gleam aims to improve developer productivity by continuously enhancing the language server, libraries, and developer experience. For project sustainability, Gleam relies on community contributions and financial support from sponsors like Fly, ensuring that the project can evolve without being limited by niche or unimportant tasks.

  • What are some of the language design principles that Gleam adheres to?

    -Gleam adheres to principles like simplicity, consistency, and a small surface area, making it easy to learn and understand. It also prioritizes readability and maintainability of code, with a focus on having one way of doing things.

  • How does Gleam handle pattern matching and case expressions?

    -Gleam uses pattern matching in its case expressions, allowing for concise and expressive code. It supports matching on various data structures like lists and tuples, and the compiler is smart enough to infer types and handle cases where certain arguments are not used.

  • What is the role of the Gleam community in the development of the language?

    -The Gleam community plays a crucial role in the development of the language. The core team actively seeks contributions from the community, and the project's sustainability relies on the efforts of part-time volunteers and sponsors like Fly, who provide financial support.

Outlines

00:00

🌟 Gleam Language Introduction

Gleam is a typesafe language built on the Erlang VM, offering the same benefits as Elixir but with a focus on type safety. It aims to make coding predictable, stress-free, and enjoyable. Gleam 1.0.0 has been released, marking a stable version of the language. It emphasizes type safety, clear error messages, and a practical type system. The language is designed to be easy to learn and understand, with a small surface area and a consistent approach to problem-solving.

05:01

🚀 Gleam's Version 1 Features and Goals

Gleam 1.0 includes all public APIs, a compiler, build tools, a package manager, a code formatter, a language server, and support for WebAssembly and JavaScript bindings. The language server and code formatter are prioritized to improve developer experience. The Gleam standard library and community packages will also receive V1 updates. The focus for Gleam post-V1 is to enhance productivity and sustainability, with an emphasis on simplicity and avoiding breaking changes.

10:02

🤝 Community and Financial Support for Gleam

Gleam is a community-driven project with a small team and part-time volunteers. The project emphasizes efficiency and meaningful contributions. The Gleam compiler and build tools are designed to be easy to contribute to. Financially, the project relies on sponsors like Fly, with the lead developer aiming to diversify funding sources. The goal is to ensure the project's sustainability and support for contributors.

15:03

📚 Gleam's Learning Resources and Features

Gleam offers a comprehensive language tour for beginners, showcasing its features like type inference, immutability, and pattern matching. The language includes a robust static type system, no null values, and no exceptions, ensuring full type checking. Gleam's standard library is well-developed, and the language supports features like emojis in variable names, type annotations, and blocks for scoped variables.

20:05

🔍 Exploring Gleam's Functional Programming Aspects

Gleam supports higher-order functions, allowing functions to take other functions as arguments. It also has anonymous functions and a shorthand syntax for creating and calling functions inline. The language enforces camel case for function names and does not support function overloading, ensuring a single implementation for each function name. Gleam's pattern matching is powerful, allowing for specific and flexible matching of data structures.

25:06

🎉 Gleam's Pattern Matching and Future Prospects

Gleam's pattern matching is sophisticated, allowing for matching complex data structures and opting out of certain cases. The language does not support function overloading, maintaining a single implementation per function name. The Gleam team is focused on improving the language's developer experience and sustainability, with plans to enhance the language server and libraries for real-world productivity. The project aims to avoid breaking changes and maintain simplicity as a core feature.

Mindmap

Keywords

💡Gleam

Gleam is a programming language designed for building typesafe systems that scale. It is built on top of the Erlang VM (BEAM), inheriting its benefits such as concurrency and performance. The language emphasizes type safety and a practical type system, aiming to make coding more enjoyable and stress-free. In the video, the speaker discusses the release of Gleam version 1.0.0, highlighting its stability and readiness for production use.

💡Type Safety

Type safety refers to the language's ability to prevent type errors, ensuring that operations on data are performed with the correct data types. Gleam's type system is designed to catch these errors at compile time, preventing runtime errors. This feature is a key selling point of Gleam, as it aims to make software development more predictable and less error-prone.

💡Concurrent Programming

Concurrent programming involves the execution of multiple processes or threads simultaneously. Gleam, like Erlang and Elixir, excels at concurrency, making it easy to implement parallel processing. This is particularly beneficial for systems that need to handle many users or high volumes of data, as seen with the example of WhatsApp's scalability.

💡Erlang VM (BEAM)

The Erlang VM, or BEAM, is a runtime environment for Erlang and other languages that target it, such as Elixir and Gleam. It is known for its ability to handle concurrency, fault tolerance, and distribution, making it suitable for building large-scale, reliable systems. Gleam leverages these features to provide a robust platform for its applications.

💡Semantic Versioning

Semantic versioning is a versioning scheme for software that aims to convey meaning about the underlying changes. It consists of a major, minor, and patch version number, where each increment indicates a specific type of change (major for incompatible changes, minor for new features, and patch for bug fixes). Gleam follows semantic versioning, ensuring that updates maintain backward compatibility.

💡Refactoring

Refactoring is the process of restructuring existing computer code without changing its external behavior. It is often done to improve code readability, performance, or to make it easier to maintain. Gleam's design goals include making refactoring low risk and low stress, which is a significant advantage for developers.

💡Web Frameworks

Web frameworks are software systems that provide a structure for building and maintaining web applications. They often include libraries, tools, and best practices to streamline development. Gleam has a web framework called Wisp, which is designed to work with the language's type system and concurrency model.

💡Language Server Protocol (LSP)

The Language Server Protocol is a standard protocol for language-specific code editing support in text editors. It allows for features like autocompletion, syntax highlighting, and code navigation to be implemented in a language-agnostic way. Gleam's support for LSP means that developers can enjoy a rich editing experience across different editors.

💡Community and Sustainability

The community aspect of open-source projects like Gleam refers to the group of contributors, users, and supporters who help develop, maintain, and promote the language. Sustainability in this context means ensuring the project's long-term viability, often through financial support, sponsorship, and a healthy contributor base.

💡Pattern Matching

Pattern matching is a feature in programming languages that allows a program to determine the structure of data and then execute code based on that structure. It is particularly useful for handling complex data types like lists and tuples. Gleam's pattern matching capabilities are showcased in the video, highlighting how it can simplify code and improve maintainability.

Highlights

Gleam is a friendly language for building typesafe systems that scale, built on top of the Elixir's BEAM runtime.

Gleam focuses more on type safety compared to Elixir, which is adding a type system.

Gleam 1.0.0 has been released, marking the first stable release of the language.

Gleam aims to make coding as predictable, stress-free, and enjoyable as possible with a consistent and easy-to-learn language design.

Gleam's type system is inspired by Elm, old Camo, and Rust, providing robust static analysis.

Gleam runs on the BEAM VM, which powers reliable and scalable systems like WhatsApp.

Gleam can also run on JavaScript, allowing for browser and mobile execution.

Gleam's V1 release includes public APIs, compiler, build tools, package manager, code formatter, language server, and compiler for WebAssembly APIs and JS bindings.

Gleam follows semantic versioning, ensuring backward compatibility and stability for production systems.

Gleam's design goals include making refactoring low risk and low stress.

Gleam's standard library and other packages will receive V1 releases to ensure a smooth transition for users.

Gleam is a community project with a small team, including full-time and part-time volunteers.

Gleam prioritizes developer experience and real-world productivity, focusing on improving the language server and libraries.

Gleam's sustainability relies on efficient efforts and impactful contributions from the community.

Gleam's creator, poor Lewis, is working full-time on the project thanks to support from sponsors like Fly.

Gleam's mascot, Lucy the starfish, represents the friendly nature of the language and community.

Gleam's learning resources include a language tour that compiles to JavaScript and runs in the browser.

Gleam enforces camel case for function names and has a simple and obvious syntax for public functions.

Gleam supports labeled arguments, making it easier to remember the order and purpose of function arguments.

Gleam has a robust static type system with no null, implicit conversions, or exceptions, ensuring full type checking.

Gleam's pattern matching allows for concise and maintainable code, with the compiler smart enough to optimize case expressions.

Gleam does not support function overloading, enforcing a single implementation for each function name and type combination.

Transcripts

play00:00

gleam is a friendly language for

play00:01

Building typesafe Systems that scale

play00:03

this is a project I've been keeping an

play00:04

eye on for a while largely because as an

play00:06

Elixir Fanboy it's interesting gleam is

play00:09

also built on top of the earling beam

play00:11

runtime which means it gets a lot of the

play00:13

same benefits in ecosystem that Elixir

play00:15

has but it's Focus much more on type

play00:17

safety and its type system whereas

play00:19

alixir is adding a type system and super

play00:21

super focused on the math side there

play00:23

this is an alternative approach to

play00:24

building on top of beam and it looks

play00:26

very similar this code looks hilariously

play00:29

similar to I was used to writing in

play00:31

Elixir but it comes with a lot of the

play00:33

type safety and other benefits that we

play00:35

would expect it does have the same

play00:37

piping functionality and behaviors it

play00:39

has the threads and all the cool Spawn

play00:41

tasking stuff that you can do in the

play00:42

earling beam VM but it gives us type

play00:44

safety as we do it here we see did you

play00:47

mean name instead of Alias no null

play00:49

values no exceptions clear error

play00:50

messages and a practical type system

play00:52

whether you're writing new code or

play00:53

maintaining old code gleam is designed

play00:55

to make your job as fun and stressfree

play00:57

as possible why are we talking about

play00:59

gleam today as I said I've been around

play01:01

for a bit I've been keeping an eye on

play01:02

this thing for even longer why today

play01:04

well gleam version one is finally here

play01:07

what is their version one release like

play01:09

let's take a look today gleam 1.0.0 has

play01:12

been released this is the first stable

play01:14

release of the language more on what

play01:16

that means later as well as a big

play01:18

milestone for the ecosystem it's been a

play01:19

long journey and I'm proud of both the

play01:21

tech and the community that we've built

play01:22

here with gleam thank you so much to

play01:24

everyone who has taken part in any way

play01:25

you've all contributed to the project

play01:27

getting here in meaningful ways of all

play01:28

sizes so what is gleam gleam is a

play01:31

programming language that tries to make

play01:32

your job as a writer and maintainer of

play01:33

software systems as predictable

play01:35

stressfree and enjoyable as possible the

play01:37

language is consistent and has a small

play01:39

surface area making it possible to learn

play01:41

in an afternoon coupled with a lack of

play01:43

magic and strong desires to have only

play01:44

one way of doing things gleam is

play01:46

typically easy to read and understand

play01:48

reading and debugging code is more

play01:49

difficult than writing new code so we

play01:50

try to optimize for that I will say this

play01:53

is very different from the direction

play01:54

we've seen in other languages recently I

play01:56

feel like all the languages people are

play01:58

hyped about and talking about right now

play02:00

are all in focused on performance and

play02:02

that's great there are a lot of things

play02:04

that need really good performance

play02:05

especially in a world where javascript's

play02:07

taken over way too much stuff when you

play02:08

end up running into massive performance

play02:10

issues because the language you chose

play02:11

was JS the thing you want to fix is

play02:13

performance so you look for things that

play02:15

fix performance I would make a

play02:17

counterargument a lot of the time there

play02:18

are performance problems it's not

play02:20

because the language itself is slow it's

play02:22

because the language doesn't have a good

play02:23

way to do concurrency and this is where

play02:25

erlang Elixir beam and all these things

play02:27

have a massive massive advantage they

play02:30

are so good at concurrency their code is

play02:32

still really fast I'm not saying that

play02:34

Elixir and orlang and these things are

play02:36

slow they're not they're not as fast as

play02:38

a language that is memory manually

play02:40

optimized like rust but they're really

play02:42

performant more importantly though they

play02:44

make concurrency trivial to implement so

play02:46

if you have multiple cores lying around

play02:49

the ability to just spawn processes on

play02:51

them and collect them in a map without

play02:53

writing any meaningful code is so

play02:55

comically better that I think for a lot

play02:57

of things these systems are better

play02:59

replacement for JavaScript than

play03:00

something like rust if your performance

play03:02

issue could be solved theoretically by

play03:04

making JS really good at concurrency you

play03:06

might not need to go to rust in the

play03:07

first place and that's why I'm excited

play03:09

here because there's so many problems

play03:10

where single-threaded JS even

play03:12

single-threaded Ruby is obviously not

play03:14

good enough well you don't need to go to

play03:15

rust instead we don't even need to go to

play03:17

goang instead we need to go somewhere

play03:18

that is not going to make our lives

play03:20

harder as devs maybe it'll even make

play03:21

them easier while also giving us

play03:23

incredible concurrent Primitives that

play03:26

have logical behaviors and scale

play03:28

infinitely this is how WhatsApp was

play03:29

would be built with like what five

play03:31

Engineers when they were acquired with

play03:33

hundreds of millions of users that's

play03:34

only possible because the concurrency

play03:36

model of earling is so powerful but yes

play03:40

theoretically on a single-threaded

play03:41

benchmark this is going to be slower

play03:42

than rust complain to my comments

play03:44

anyways gleam has robust static analysis

play03:47

and a type system inspired by languages

play03:48

such as Elm old camo and rust so the

play03:51

compiler serves as a programming

play03:52

assistant giving you additional context

play03:54

to help you make the changes you want to

play03:56

make don't worry about writing perfect

play03:57

code the first time with gleam

play03:58

refactoring is low risk and low stress

play04:00

so you continue to improve your code as

play04:02

you learn more about the problem at hand

play04:03

it's cool that refactoring is like part

play04:05

of their design goals of the language I

play04:07

think that's somewhat rare I'll say rust

play04:09

is good about this not good in the sense

play04:12

that you can meaningfully change the way

play04:14

a code base Works quickly but it's good

play04:16

in the sense that if you make a mistake

play04:17

while making changes you get yelled at a

play04:19

bunch and it helps you think through

play04:20

those things whereas typescript kind of

play04:22

lets you YOLO while also being able to

play04:24

rename things without it all Breaking

play04:25

seems like they're aiming for something

play04:26

between those which is exciting running

play04:29

administrating software is as important

play04:30

as writing it gleam runs on the earling

play04:32

VM a mature and battl tested platform

play04:34

that powers many of the world's most

play04:35

reliable and scalable systems such as

play04:37

WhatsApp I I will admit WhatsApp being

play04:39

our go-to thing to sight we need more we

play04:43

really need more there are a lot more

play04:45

the Telecom world is deep on all things

play04:47

beam in Arling that's what it was built

play04:49

for originally but we need better

play04:50

companies to site here gleam can also

play04:52

run on JavaScript wait I did not read

play04:54

that part what what gleam can run and Ja

play04:58

gleam can run in JavaScript run times

play05:01

huh okay that changes things so now you

play05:04

can run gleam code in browser on mobile

play05:06

or anywhere else here's an example of

play05:08

some gleam handle request request

play05:10

context response use Json wisp cool this

play05:14

is using the Wisp to get Json out of the

play05:17

request let result use data try to

play05:20

decode it the Json as a person is a

play05:22

model that has been imported I'm

play05:23

assuming yeah my app person so we've

play05:25

created this model we're trying to

play05:26

decode the Json as that model then we're

play05:28

trying to insert the person into

play05:30

database and we have the row now okay

play05:32

person. tojson row this is taking that

play05:35

row and asserting that that's okay then

play05:37

we have a result case if okay then we

play05:39

Json respond and if error then we say

play05:41

it's an unprocessable entity using wisp

play05:43

which is I'm assuming their web

play05:45

framework got to love some good pattern

play05:47

matching this is so nice just case

play05:49

result and then the cases are two things

play05:52

that could be the case so okay Json is

play05:54

only true if the Json result is okay if

play05:56

it isn't then error empty is the case

play05:58

instead nice and clear clean good stuff

play06:01

what does gleam V1 include well this

play06:03

version covers all the public apis found

play06:05

in the main gleam git repo which is The

play06:07

Gleam language compiler build tools

play06:09

package manager code formatter the

play06:11

language server and the compiler for

play06:13

wasm apis and JS bindings that's a lot

play06:15

to include in a V1 release it's also

play06:18

really nice seeing the code formatter or

play06:19

and language server being prioritized

play06:21

enough to be in this announcement post

play06:23

especially code formatter huge shout out

play06:25

to go for normalizing this the idea of

play06:27

what if the language just had one way

play06:29

supposed to look so that the developers

play06:31

can stop bitching about syntax

play06:32

constantly we just pick it for them and

play06:34

then it works I love that the this is

play06:36

now normal for new languages is so cool

play06:38

I still remember when Elixir added

play06:40

format and was so so hyped to not have

play06:42

to worry about those things in my code

play06:43

base anymore go was first at this I

play06:45

believe there's some things in R now too

play06:47

but having this be a thing from the

play06:48

official team squashes out so much

play06:50

think about how many videos

play06:51

I've made and how much time I've wasted

play06:53

just complaining about ways to format

play06:54

turn Aries that doesn't happen when you

play06:56

have a formatter built into the language

play06:58

really cool stuff they they also have

play06:59

the language server which is great

play07:00

because this means not only can you have

play07:02

a good experience in whatever editor

play07:03

they chose to support which is obviously

play07:05

going to be vs code now someone like

play07:06

Prime can go build the bindings to use

play07:08

this language server inside of vim and

play07:10

it takes almost no time to do that if

play07:12

you implement the language server

play07:13

protocol correctly which I'm sure they

play07:15

did if they're advertising it here

play07:16

really exciting stuff and also the wasm

play07:19

stuff which we're going to have to play

play07:20

with at the end of this so stick around

play07:21

if you want to see me actually trying it

play07:23

The Gleam standard library and other

play07:24

packages maintained by the core team

play07:26

will be getting an accompanying V1

play07:27

release shortly afterwards before these

play07:29

are least we will be making poll

play07:30

requests to Popular Community packages

play07:32

to relax their package manager version

play07:33

constraints to ensure that updating to

play07:34

V1 is as smooth as possible for all

play07:36

gleam users that's really cool since

play07:38

they're are 1.0 now it might not be that

play07:41

different from 0.9 or whatever it was on

play07:43

before and a lot of community stuff

play07:45

probably says it requires v.9 which

play07:48

means sver is going to say hey you can't

play07:50

install that on 1.0 rather than just

play07:52

letting that be the community's problem

play07:53

they're going to go file poll requests

play07:55

to those major packages to bump them to

play07:57

1.0 and make sure they're ready for it

play07:59

so that the packages the community

play08:01

relies on now won't be as painful to

play08:02

install really cool to see but what does

play08:04

V1 even mean for them well version one

play08:06

is a statement about gleam stability and

play08:08

Readiness to be used in production

play08:09

systems We Believe gleam is suitable for

play08:11

use in products that matter and gleam

play08:12

will provide a stable and predictable

play08:14

Foundation gleam follows semantic

play08:15

versioning so maintaining backwards

play08:17

compatibility is now a priority we'll be

play08:19

making every effort to ensure gleam does

play08:20

not introduce braking changes the

play08:22

exception to this is for security and

play08:23

soundness issues should a critical bug

play08:25

of that nature be discovered we reserve

play08:27

the right to fix a security issue even

play08:28

if programs were taking advantage of the

play08:30

bug I've noticed this is a big thing in

play08:32

the erlang community they really hate

play08:34

breaking changes alixir has been

play08:35

considered a completed Language by the

play08:37

core team for a while now and most of

play08:39

the features are fixes to things and

play08:41

like quick API patches to make other

play08:44

people's packages more capable within

play08:46

the ecosystem but they're not adding new

play08:47

language features to Elixir really ever

play08:49

anymore one of the main reasons that

play08:51

they've done that is they built a

play08:53

language that's so extensible that the

play08:54

things you'd want to add can largely be

play08:56

added via libraries plugins and other

play08:58

packages in that just seems like how the

play09:00

earling world Works to be fair they're

play09:02

all running on a VM that's like 30 to 40

play09:04

years old so it makes sense they want

play09:05

the old things and the new things to run

play09:06

well but it is cool to see all these

play09:08

languages building on top of it

play09:09

maintaining the spirit of never breaking

play09:11

your

play09:12

stuff so what's next for gleam gleam is

play09:14

a practical language intended for making

play09:16

real things so our focus with gleam post

play09:18

V1 is to be split between the

play09:20

productivity for gleam users and

play09:21

sustainability for The Gleam project

play09:24

productivity side they're civically

play09:25

calling out the breaking changes again

play09:27

they'll also be avoiding language blow

play09:28

it's a big thing they call out earlier

play09:29

they clearly are inspired by like go and

play09:31

how simple things are they want there to

play09:33

be one way to do things it's cool that

play09:35

they want to maintain that it's easy to

play09:36

keep adding new features to a language

play09:38

to Aid with specific problems but with

play09:40

each new language feature or new way of

play09:42

solving a problem the language as a

play09:43

whole becomes more complex and harder to

play09:45

understand Simplicity is a feature in

play09:47

gleam and that will not change going

play09:48

forward there is scope adding new

play09:50

features to the language but we will be

play09:52

doing so extremely conservatively any

play09:54

new feature has to be generally useful

play09:55

and enable new things not otherwise

play09:57

possible in gleam while being a

play09:58

worthwhile tradeoff for the added

play10:00

complexity it brings to the language I

play10:02

like that they're calling this all out

play10:03

early like here is how we're thinking of

play10:05

what to and not to add to our language

play10:07

rather than adding new features to the

play10:08

language we'll be continuously improving

play10:10

The Gleam developer experience and

play10:11

enhancing real world productivity

play10:13

initially the focus will be on improving

play10:14

the language server as it's immature

play10:16

compared to the rest of the gleam

play10:17

tooling these really honest call outs

play10:19

are rare and nice I've never seen a post

play10:22

like this just straight up saying this

play10:23

part's not good enough we're going to

play10:25

fix it we also be working on all of the

play10:26

libraries and such that folks will

play10:28

likely want when making production

play10:29

systems in gleam with an additional

play10:31

focus on development of websites and web

play10:32

services makes sense that they're

play10:34

targeting this it's it's cool that

play10:35

they're aware of this being the right

play10:37

initial focus and eventually doing more

play10:40

like microservices scalable servers all

play10:42

those types of crazy things

play10:43

documentation is always a priority we

play10:45

want to have tutorials and guides for

play10:46

all manner of tasks in gleam it should

play10:48

always be easy to find how something is

play10:50

done in gleam so you can focus on

play10:51

achieving your goal here's the

play10:54

sustainability section gleam is not a

play10:55

project from Microsoft or Google it's a

play10:57

community project there's one full-time

play10:59

Dev working on it me I'll get his name

play11:01

right after as well as a number of

play11:02

part-time volunteers who do excellent

play11:04

work with this small team we need to be

play11:05

efficient with our efforts anything we

play11:07

work on needs to be impactful and

play11:08

meaningful to the whole gleam Community

play11:10

we cannot afford to spend time on Niche

play11:12

or unimportant situations I want to

play11:14

quickly call out a couple things first

play11:16

off I want to get the name of that

play11:17

author I should just go back to the blog

play11:19

post to get that at the bottom I also

play11:20

want to call out fly fly's dope I know

play11:22

they're not a thing I talk about a lot I

play11:24

have a couple videos where I cover stuff

play11:25

they're working on but fly has quickly

play11:26

become one of the most important

play11:28

contributors to the erlang and elixir

play11:30

ecosystems by a lot and they're really

play11:32

taking the opportunity here to jump on

play11:34

another thing in the beam world really

play11:36

cool to see them jumping on this and

play11:38

helping support a project like this

play11:39

especially if this project is by poor

play11:42

Lewis all by himself right now so huge

play11:44

shout out to fly for jumping on these

play11:46

things as much as they do and as they

play11:48

say here anything they work on needs to

play11:50

be impactful and meaningful to the whole

play11:51

Community otherwise they can't afford it

play11:53

because they don't have the time to

play11:54

spend on Niche or unimportant situations

play11:56

internal docks are also important so an

play11:58

open source project we want folks to be

play11:59

able to open up the code base and make

play12:01

their contributions as easily as

play12:02

possible so far the feedback has been

play12:04

that gleams compiler and build tools are

play12:06

easy to contribute to that's encouraging

play12:08

and we'll continue to work on this to

play12:09

ensure The Gleam project never gets to a

play12:10

point where only a select few people are

play12:12

able to meaningfully contribute to its

play12:13

maintenance uh let's take a quick look

play12:16

on GitHub first off I need to start this

play12:18

repo because holy this is really

play12:20

cool 6.2k Stars I'm expecting this to be

play12:22

over 10K by the time this video has been

play12:24

out for 24 hours so hit the link in the

play12:26

description go give them a star we need

play12:27

to support cool new projects like this

play12:29

especially when they're being done

play12:32

independently what I wanted to see here

play12:34

is insights that's actually huge

play12:37

obviously he's been working on this

play12:38

forever now but seeing multiple new

play12:40

people coming in with really solid

play12:42

amounts of contributions especially if I

play12:44

was to shorten the dates here which I

play12:46

think is a thing you can do via the URL

play12:47

if I recall okay I can't trivially do

play12:49

that there's some way to modify the URL

play12:51

so it shortens to just be like a Time

play12:52

window but it looks like recently there

play12:54

are some people making massive

play12:55

contributions 139 commits from a third

play12:58

party that that's working on this

play12:59

part-time I he's he's a core team member

play13:01

but it's clearly not his job as well as

play13:03

Anis contributing a ton crowd haer

play13:05

having this many people over 100 commits

play13:07

is nuts for reference here is es build

play13:11

which is the glue holding together a ton

play13:13

of the web ecosystem right now and here

play13:15

you see the next highest number of

play13:17

commits is 16 and then we have seven

play13:19

then we have six here we have

play13:22

significantly more I'm not picking onest

play13:24

build when I say this I just think it's

play13:26

important to understand the different

play13:28

projects in different communities have

play13:30

different expectations around

play13:32

contribution and it seems like gleams

play13:34

made it a high priority to make

play13:36

contribution meaningfully easy and it's

play13:38

showing in the numbers already for

play13:40

something this early that's huge I

play13:43

haven't looked at the code base I can't

play13:44

say for sure but I'll back up the

play13:46

feedback here that it's easy to

play13:47

contribute to seems like people are

play13:48

making good contributions okay this is

play13:50

an important piece last part of

play13:51

sustainability is financial I'm able to

play13:54

afford to work on gleam fulltime thanks

play13:55

to the support of the project sponsors

play13:57

on GitHub sponsors the largest

play13:58

contributor is fly who provides

play14:00

approximately half the funding thank you

play14:01

fly we wouldn't be here today without

play14:03

your support going forward I'd like to

play14:04

diversify the funding with more

play14:05

corporate sponsors as well as other

play14:07

revenue streams I earn less than half of

play14:08

what I would make with the median lead

play14:10

developer salary in London the city in

play14:12

which I live this is enough money for me

play14:13

to get by but I would very much like to

play14:15

earn around what I would if I had some

play14:17

other job this is very fair if you're

play14:19

inventing a new programming language

play14:21

hopefully you can get the sponsors and

play14:22

support that you deserve and again to

play14:24

anybody watching if you have the spare

play14:26

funds to support this developer and

play14:27

you're interested in what he's doing

play14:28

absolutely do that if you work at a

play14:30

company that might benefit from the work

play14:31

he's doing bring that up internally it's

play14:33

always a good thing to have your name in

play14:34

these types of sponsors and it's

play14:35

surprisingly cheap to do we go look at

play14:37

his GI him sponsors I bet a lot of the

play14:38

numbers are

play14:39

public he has a goal of 256 monthly

play14:42

sponsors uh does not have it public oh

play14:45

well regardless as he said he's making

play14:49

around half of what a median lead

play14:50

developer salary would be in London so

play14:52

let's see what this would be about 75k

play14:54

so about 100K USD that's what I was

play14:56

going to guess checks out which means

play14:58

he's making half which is 50k and fly is

play15:01

contributing half the funding which is

play15:03

another half so fly is contributing 25k

play15:06

a year in order to be this giant logo on

play15:08

the homepage do you know how cheap that

play15:10

is do you know how cheap it is to put

play15:12

your logo on a homepage for an upand

play15:14

cominging programming language like that

play15:16

that's insane if you're a company that's

play15:18

interested in the earling ecosystem

play15:20

throw this dude some money it's cheap

play15:21

you get huge positive press and

play15:23

involvement in an awesome new growing

play15:25

project and you're financially

play15:26

supporting it and it's probably going to

play15:27

go way further than 25 with an a

play15:29

traditional marketing budget jump in

play15:30

here it's a huge opportunity and I'm

play15:31

pumped that F taking it and honestly Le

play15:34

I hope that this helps like let me know

play15:36

if in the comments in my DMs however you

play15:38

want to reach out to me if there's

play15:39

anything else I can do to help because

play15:40

projects like this deserve really good

play15:42

sustainable long-term support even call

play15:44

this out here long term you'd like to

play15:46

financially reward the regular

play15:47

contributors to gleam folks in the court

play15:48

team are talented and they should be

play15:50

rewarded appropriately for their work I

play15:51

totally agree and I really hope we can

play15:53

get you some more funding because you

play15:54

deserve it they also have a new mascot

play15:57

well a glow up mascot Lucy's a kind and

play15:59

friendly little starfish who enjoys

play16:00

strawberry ice cream and functional

play16:02

programming honestly relatable the rest

play16:04

of Lucy's story is up to the community

play16:05

to tell thank you to Suppy ly for the

play16:07

wonderful redesign and for starting

play16:08

Lucy's Cannon to go with Lucy's New Look

play16:10

we've also snazzed up the website a

play16:12

little bit and adjusted the colors for

play16:14

legibility we hope you like it that's

play16:15

everything that's really cool

play16:17

things this is the list of all the

play16:19

people who have contributed sponsored

play16:20

and helped good stuff this is so cool

play16:23

thank you for reading and I hope you

play16:24

enjoy gleam enough talk we need to play

play16:26

with this don't tell me they have a

play16:27

whole how do they have a better learning

play16:30

point than most like modern web tools

play16:33

and Frameworks what I want to go through

play16:35

some of the tutorial here Welcome to The

play16:37

Gleam language tour I'll be sure to

play16:38

leave a link to this in the description

play16:39

if you want to check it out hard to put

play16:41

into words how cool it is they have this

play16:42

already for such an early launch like

play16:45

big web Frameworks don't even have these

play16:47

tools yet and this new language by one

play16:48

dude does anything you print using io.

play16:51

printline or i. debug will be shown at

play16:53

the bottom section along with any

play16:54

compile errors and warnings to evaluate

play16:56

gleam code the tour compiles gleam to

play16:58

JavaScript and runs it all entirely

play16:59

within your own browser window cool

play17:01

here's a program that prints out hello

play17:03

Joe that's actually really fast for

play17:06

compiling your different language and

play17:07

then running that's dope unqualified

play17:09

Imports normally functions from other

play17:11

modules are used in a qualified fashion

play17:13

with the module qualifier being before

play17:16

function names for example io. printline

play17:18

it's also possible to specify a list of

play17:20

functions to import from a module in an

play17:21

unqualified fashion such as print Line

play17:23

This is the equivalent in JavaScript of

play17:26

import thing from stuff you could import

play17:30

stuff as like that and then do stuff.

play17:32

thing but their language lets you do

play17:34

this as part of the import syntax going

play17:36

left to right I actually really like

play17:37

this I have a whole video about how we

play17:39

do Imports wrong in JavaScript because

play17:41

you can't autocomplete this if you don't

play17:43

know what module it's part of by putting

play17:44

the module first by putting the scope

play17:46

next and then putting the thing you want

play17:47

third autocomplete can carry you through

play17:50

that well this okay they don't have the

play17:52

auto complete in the browser which makes

play17:54

sense but this has all the pieces they

play17:56

need to do that experience really well

play17:58

cool GLE has a robust static type system

play18:00

as well let's play with the types

play18:01

uncomment okay the keyboard syntax and

play18:04

stuff is not quite as good here it's

play18:06

pretty good overall the language looks

play18:08

phenomenal though and the highlighting

play18:09

everything's solid error type mismatch

play18:11

Source main. gleam IO print line 4

play18:13

expects a string and it got an INT if I

play18:15

wrap this in

play18:17

string now it's good or I could change

play18:19

it to debug which will take things that

play18:21

aren't strings nice gleam has no null no

play18:25

implicit conversions no exceptions and

play18:26

always performs full type checking the

play18:28

code compiles you can be reasonably

play18:29

confident it does not have any

play18:30

inconsistencies that may cause bugs or

play18:32

crashes that SS like a certain other

play18:33

language that is not my favorite thing

play18:34

in the world it's cool they're doing it

play18:36

here though gleams int type represents

play18:38

whole numbers equality double equals

play18:41

that isn't stupid nice when running in

play18:43

the earling VM ins have no maximum

play18:45

minimum size when running in JavaScript

play18:46

ins are represented using javascript's

play18:48

64-bit floating Point numbers cool that

play18:50

they have like this explicitly called

play18:51

out The Gleam in standard Library module

play18:53

contains functions for working with ins

play18:55

well they have a library just for doing

play18:57

ins and doing them properly in. Max in.

play19:00

clamps my question would be if I delete

play19:02

this everything still behaves fine yes

play19:04

so these are only you only need to

play19:06

import in here in order to use it for

play19:08

the int Max in clamp in these standard

play19:10

Library functions seems like the

play19:11

standard library is in a good State

play19:12

though soly another thing I can say

play19:14

about my favorite language gleams float

play19:16

type represents numbers that are not

play19:17

integers cool we know what a float is

play19:19

number formats oh yes thank you for the

play19:22

underscore syntax this makes my life so

play19:23

much easier with random big numbers it's

play19:25

really nice you even do floats oh that's

play19:28

really nice gleam has equals and not

play19:30

equals operators cool strings that there

play19:33

a classic concatenate option always cool

play19:35

to see things like this being built in

play19:37

and working all the Unicode escapes all

play19:39

built in looks good to me Bulls either

play19:41

true or false we know how booleans work

play19:42

assignments I have to test something

play19:44

important let fire equal testing no I

play19:50

just wanted one more language that would

play19:53

let me use emojis for variable

play19:55

definitions why can't any language let

play19:57

me use variables that are emojis not

play20:00

asking for a lot yeah only Swift allows

play20:03

this right now it's the one thing that I

play20:05

want more languages to do just give me

play20:07

Emoji support for my variables and Julia

play20:09

does apparently according to chat good

play20:10

to know assignments uh variables could

play20:12

be reused later but the value they

play20:14

reference is immutable nice immutable

play20:16

values we love that discard patterns if

play20:18

if variable is assigned but not used GLE

play20:20

will emit a warning variables intended

play20:21

not to be used the name can be prefix

play20:22

with an underscore so if I just don't

play20:24

use that we get a warning with the

play20:26

prefix we don't get a warning that all

play20:27

being part of the language compiler is

play20:28

really nice type annotations let

play20:30

assignments can be written with a type

play20:32

annotation after the name type

play20:34

annotations may be useful for

play20:36

documentation purposes but they do not

play20:37

change how gleam type checks the code

play20:38

Beyond ensuring The annotation is

play20:40

correct interesting that this is

play20:41

optional they really leaned into the

play20:43

inferred everything which I love it's so

play20:45

cool seeing type inference as like the

play20:47

core of the language try changing this

play20:49

um in cool if I change this to not be

play20:51

underscore name and I tried to change

play20:53

this to name equals 4 nope I'm curious

play20:57

if we can do crazy things with the type

play20:58

definitions Hub type user ID int user ID

play21:01

int cool also able to resolve deep there

play21:04

nice

play21:05

blocks oh oh yes thank you I've had like

play21:10

three problems in code reviews in the

play21:12

last two days that made me want this in

play21:15

JavaScript so badly do you know how

play21:17

great this is to not have to like make a

play21:19

function just to call it to keep

play21:21

variables within a scope what this does

play21:23

for those who aren't familiar is it lets

play21:25

us to find a bunch of in here so if

play21:27

I just was to also do like let Celsius

play21:30

equals some random IOD do debug

play21:34

Celsius just so that they're all being

play21:36

used Celsius isn't touched here even

play21:39

though I defined it there since it lives

play21:40

within this closure it effectively

play21:43

disappears afterwards which means

play21:45

whatever you do at the end here can now

play21:46

be assigned here I can have this little

play21:48

section that goes and does its own

play21:50

and not have to call a function or in

play21:52

line a bunch of stuff it just does it

play21:54

Wonder can I do return they have return

play21:55

keyword they don't that's annoying I

play21:57

hate implicit returns I like explicit

play21:59

can functions return things or is it

play22:01

literally just whatever you put at the

play22:02

bottom is whatever you put at the bottom

play22:03

not my favorite thing fine yeah having

play22:07

block closures like this is so so so so

play22:10

useful I am hyped on this yeah and again

play22:12

the example here is if you uncommon

play22:13

degrees this won't compile because

play22:15

degrees is only defined within this

play22:16

scope it's not defined outside of it so

play22:18

this won't work because we don't have

play22:19

access to it because it was put in these

play22:20

brackets that is so nice the number of

play22:23

random functions I've defined that just

play22:24

call themselves that this helps us

play22:25

Escape magical lists lists are order

play22:28

cool yeah we know how lists work the

play22:29

interesting thing here is that lists are

play22:30

immutable very similar to Elixir I think

play22:33

it's a thing in earling as well

play22:34

mutability is great love this lists are

play22:36

immutably single linked lists the

play22:38

benefit here is you don't have to worry

play22:39

about like running a DOT reverse and it

play22:41

breaking your original list if you want

play22:42

to make changes to your lists you make a

play22:44

new list this is how it should be I love

play22:46

this Nan's the creator of stylex he

play22:48

loves lurking in chat and I trust his

play22:51

takes on language design if the only

play22:53

issue he has with gleam is implicit

play22:54

returns that sounds like a pretty good

play22:56

language to me and I'm thus far are

play22:58

leaning the same way because God this is

play23:00

really impressive the more I look in the

play23:01

more happy I get constants cool we know

play23:03

how constants work but they're actually

play23:05

constants unlike in certain other

play23:07

languages who who would ever make those

play23:09

other languages the FN keyword is used

play23:11

to define new functions the double and

play23:12

multiply functions are used are defined

play23:14

without the pub keyword this makes them

play23:15

private functions interesting oh just

play23:17

Pub yeah that is expected Pub is just to

play23:20

make this exported so other things can

play23:21

access it I thought that was more

play23:22

complex than it is that's really simple

play23:23

and obvious that's the equivalent of

play23:24

like export nice and simple higher order

play23:26

functions nice functional programming

play23:28

languages need the ability to stack

play23:30

functions and it looks like we can do

play23:31

that we have add one which takes an INT

play23:33

and it returns argument plus one that

play23:34

syntax looks really familiar for type

play23:36

definitions ravs must be pumped right

play23:38

now twice argument it also takes in a

play23:40

function into int and it runs this

play23:41

function twice that's cool I would have

play23:43

named this function I'd say past Funk

play23:46

I'm sure I can no hm in GLE functions

play23:49

are values they could be assigned to

play23:50

variables past other function anything

play23:51

else here function add one is being pass

play23:53

as an argument FN is not what I should

play23:55

use there um past function somebody said

play23:58

is it camel case yeah it's a they can't

play24:00

you can't camel case past Funk not a

play24:03

valid name they actually enforce camel

play24:05

case cool I didn't like this being

play24:07

called function cuz confusing cool stuff

play24:10

Anonymous functions again really

play24:11

important to be able to quickly inline a

play24:13

function when you need to shouldn't

play24:14

always have to Define so in this

play24:15

case we Define add1 equal FNA A+ 1 and

play24:19

we pass that as a variable here nice

play24:21

simple to the point cool stuff function

play24:23

captures g a short hand synex for

play24:25

creating Anonymous functions to take an

play24:26

argument and immediately call another

play24:27

function with that argument trying to

play24:29

figure out how to explain this this is

play24:30

an interesting bit Anonymous function

play24:32

can be written as with any number of

play24:34

arguments passed to the inner function

play24:35

the underscores a placeholder for the

play24:36

argument okay so add 1 V2 okay now I

play24:40

think I know how to explain this so if

play24:41

you want to quickly Define a function

play24:43

that is just calling another function if

play24:44

you put underscores for the arguments

play24:46

those become the arguments for your

play24:48

function so if I change this to be a b i

play24:51

no uh random string this variable is

play24:55

never used but if I IO do print Ln

play24:58

random now we're getting an issue that

play25:00

we didn't pass the argument here so I'll

play25:02

pass hello here now we're getting the

play25:04

same thing here the interesting thing

play25:05

with the underscores is now for add 1 V2

play25:08

I've basically told the compiler add 1

play25:10

V2 takes two arguments and they're these

play25:12

two in this order so since I put these

play25:14

blanks here it will just expose those in

play25:16

the OD one function so now I can do hi

play25:19

there's more than one argument hole in

play25:20

this function call um I assume you can

play25:22

do multiple oh it's just for one

play25:23

argument okay it makes sense that it's

play25:25

just for one argument limits what you

play25:26

can do with this but it convenient to do

play25:28

something like that where a function

play25:30

needs some things pass but you want to

play25:32

expose just one thing to be quickly

play25:33

called inline it's a quick way to do

play25:35

that be cool if you do more with it but

play25:37

it's a nice quick syntax there's also

play25:38

generic functions you know the thing

play25:40

that go finally added generics in

play25:41

general anyways up until now each

play25:43

function has accepted precisely one type

play25:45

for each of its arguments the twice

play25:47

function for example only works with

play25:49

functions that would take and return ins

play25:51

cool so twice takes in a function with

play25:53

value value value this is a generic

play25:55

though so theoretically you can Define

play25:57

whatever you want this to take we have

play25:59

an add one here where function of X is

play26:01

returning X+ one and exclaim which is

play26:03

function of x x exclamation point so

play26:05

these both are this would infer to a

play26:08

number and this would infer to a string

play26:10

for the inputs here the type variable is

play26:12

replaced by the type int so we're

play26:14

calling twice with the number 10 and add

play26:16

one it knows that's a number the type

play26:18

definition gets handled I change this to

play26:19

xclaim we'll get an error because xclaim

play26:22

been inferred to need a string instead

play26:24

of a number and since we gave it a

play26:25

number in a string twice is smart enough

play26:28

to infer that these things are different

play26:30

that the value and the type definition

play26:32

here is different from the type

play26:33

definition for the function return and

play26:35

since these are different it gets mad at

play26:36

you this is really cool reverse

play26:39

inference it's nice to see this in a

play26:41

language that isn't rust or o camel and

play26:44

my favorite my absolute favorite the

play26:47

thing I cannot believe has not made its

play26:48

way to JS yet pipes it's so good it's so

play26:51

simple there are so many times where you

play26:53

like let's be real who who has written

play26:55

this code before let's say we have const

play26:58

user equals some stuff now we need to do

play27:00

something with the user const off user

play27:03

equals off user then you have your

play27:06

function that actually does something to

play27:08

it like you format it or you process the

play27:11

payment so const processed user equals

play27:14

process off user and then return like

play27:18

process request processed user there's

play27:22

only three possibilities for everyone

play27:24

here either you don't write JS you write

play27:26

JS and you've done this a bunch or

play27:28

you're lying because this is one of the

play27:30

most common things I find myself doing

play27:32

where I'm defining like 15 variables

play27:34

just to use them once as I pass them to

play27:35

the next thing the other option I could

play27:37

have here is I could take this put it

play27:40

here take this put it here take this put

play27:43

it here and no one likes this especially

play27:46

once the chains get big this is the

play27:48

worst What If instead of compromising on

play27:51

both the line syntax as well as from

play27:54

having to define a bunch of variables

play27:55

you shouldn't have to name every single

play27:56

step along the way one what if a pipe

play27:58

just took the thing from the last line

play28:00

and made it the first argument in the

play28:01

next line so here we take one we append

play28:04

two to the end and then after here's

play28:05

where it gets interesting because we

play28:07

have the blank here we're passing one to

play28:09

that spot instead if we don't have that

play28:11

it just goes in the front we get 1 2

play28:12

three but if we put that blank we also

play28:14

put it here and that's going to be 2 one

play28:16

three because one gets put after two

play28:18

when you put the blank there three blank

play28:20

same deal 312 tell me that's not the

play28:22

coolest in the world tell me that's

play28:24

not hilariously cool going to try one

play28:26

thing I'm actually not sure this will

play28:27

work but I'm so so curious uh hello oh

play28:32

since this isn't a whole argument it's

play28:34

not smart enough to pass it through was

play28:35

worth a shot still so cool I love this

play28:38

so much labeled arguments more really

play28:41

handy useful features when functions

play28:43

take several arguments it can be

play28:44

difficult to remember what the arguments

play28:45

are and what order they're expected in

play28:47

to help with this gleam supports labeled

play28:48

arguments where function arguments are

play28:49

given an external label in addition to

play28:51

their internal name so this is what it's

play28:53

called externally multiply internally

play28:55

it's going to be called multiplier

play28:56

externally is be called internally it's

play28:57

going to be add end cool not super super

play29:00

important but nice documentation

play29:02

comments documentation comments are

play29:03

important they have regular double slash

play29:05

as well as triple and quadruple slash

play29:07

which are used for attaching

play29:08

documentation to code triple slash is

play29:09

for documentation for types and

play29:11

functions quadruple slash is for modules

play29:12

and should be placed at the top of the

play29:13

module so here's the definition for the

play29:15

module here's everything else I would

play29:16

like something different than additional

play29:17

slashes it's a little too easy to like

play29:19

glance over and not notice the

play29:20

difference there but the fact they have

play29:22

Syntax for this built into the language

play29:24

version one is really nice deprecations

play29:26

cool everything should have that case

play29:28

exceptions they have a whole pattern

play29:30

matching section in here

play29:32

maybe a bunch of flow control

play29:36

stuff I could sit here all day just

play29:38

going through the different language

play29:39

decisions I don't want that to be what

play29:40

this video becomes but I do want to take

play29:43

a look at cases and pattern matching so

play29:47

here's a pretty simple case we have X

play29:49

which is a random int 01 or other you

play29:52

pass it it's X let results it's zero we

play29:54

print zero if it's one we print one

play29:56

otherwise we print other I refresh

play29:58

this get different values each time cool

play30:02

last the program to say if this data has

play30:03

this shape then run this code a process

play30:05

called pattern matching I'm going to do

play30:07

something silly I'm just curious if this

play30:10

works 1 2 3 here we can pattern match to

play30:14

say one two we don't care one 2 4 and

play30:20

then here we don't care either int is

play30:22

never used cool first case second case

play30:27

this will be a good example so we'll do

play30:28

1 2 3 and then 1 2

play30:30

4 then 1 2 underscore so we're going to

play30:33

hit the first case here cu the array is

play30:34

1 2 3 and it matches 1 2 3 where things

play30:37

get magical though is you can opt out of

play30:39

certain arguments there's now

play30:40

unreachable cases which makes sense that

play30:42

it's actually really cool that compiler

play30:43

smart enough to notice that so I'll

play30:45

actually delete these other cases

play30:46

because the point of this one is very

play30:48

simple if two is in the middle doesn't

play30:49

matter what the other values are this is

play30:51

what we should run this is so so nice

play30:53

the alternative here would be in like a

play30:56

case true and each of these values would

play30:58

be doing a manually written if check in

play31:00

something like typescript but here it's

play31:02

just built into the language in the case

play31:03

syntax when you pass something like an

play31:05

object or an array the level of

play31:07

specificity in your match is up to you

play31:09

that is so good you could also somebody

play31:12

just said Define a variable here so if I

play31:14

wanted to do first case Fu can I cast

play31:18

this is a string let me import gleam int

play31:22

int. 2 string I'm

play31:24

assuming look at that look at how

play31:26

helpful they little compiler stuff is so

play31:28

now since we bound Fu as the third

play31:30

argument here we can actually pass it

play31:32

but we could also make a case here

play31:34

that's like one 3 4 we don't have that

play31:38

variable so I'll just delete that for

play31:40

now and the magic here is whichever case

play31:42

your code passes first is the one that

play31:44

you hit I change this to 133 it will

play31:47

only match the bottom so we get other

play31:49

change this to 134 it matches this

play31:50

middle case if I change this to two in

play31:52

the middle again even if I have two here

play31:54

it'll hit this first case because it

play31:56

matches and it's going through step by

play31:57

step so it says okay here's the first

play31:59

one we don't care about the first

play32:00

argument two two cool that matches four

play32:02

F cool we can B that everything matches

play32:04

cool run the code wait no it doesn't

play32:06

check the next one this is I don't know

play32:08

how to put into words how much this

play32:09

helps with maintainability it looks good

play32:11

here once you get into function

play32:12

overloads where you're defining the same

play32:14

function four times and defining these

play32:16

things in the syntax for the function

play32:17

definition that's where it gets crazy

play32:19

that's curious if they have function

play32:21

overloading that's the one thing I would

play32:23

really like oh that's the one thing I

play32:26

really want

play32:27

they actually have oh wow they have a

play32:29

whole guide for gleam for Elixir users

play32:31

they're really focused on this stuff

play32:33

that's dope unlike Elixir gleam does not

play32:35

support function overloading there can

play32:37

only be one function with a given name

play32:38

and the function can only have a single

play32:40

implementation for the types it accepts

play32:42

I get it I'm sad but I get it there had

play32:46

to be some negative right couldn't be

play32:48

literally perfect language it's close

play32:50

it's weirdly close but it couldn't be

play32:53

perfect I think I've covered everything

play32:56

I want to here it's clear there's way

play32:57

more I didn't even start going into

play32:59

luster which is their web framework it's

play33:02

not actually by the core gleam team but

play33:04

it is a supported functioning web system

play33:08

for writing gleam in the browser which

play33:10

is really really cool they're already at

play33:11

that point I haven't been this excited

play33:12

about a new language in a minute I'll be

play33:13

honest I am blown away if you haven't

play33:16

already checked out gleam go take a look

play33:17

and if you can support the team making

play33:19

it because they're clearly working

play33:20

really really hard that's all I to say

play33:22

for now until next time peace nerds

Rate This

5.0 / 5 (0 votes)

Ähnliche Tags
GleamLangTypesafeSystemsElixirFanboyErlangVMConcurrentProgrammingTypeSafetySoftwareDevelopmentCommunityDrivenOpenSourceWebDevelopment
Benötigen Sie eine Zusammenfassung auf Englisch?