DEV Community

Cover image for Bringing more sweetness to Ruby with Sorbet types 🍦

Bringing more sweetness to Ruby with Sorbet types 🍦

Cherry Ramatis on September 18, 2023

Have you ever wanted to add type-checking to your Ruby code? Going from a rubber duck to a full-armed duck? (pun intended) no? So allow me to intro...
Collapse
 
topofocus profile image
Hartmut B.

Hi, thanks for summarizing this topic.
To be honest, I am using ruby for its simplicity.
May I ask, why you are promoting such a complex approach just for type-checking?
I am using Dry::Types regularly for this purpose. Simple, elegant, robust.
You are invited to compare the two aproaches.

Collapse
 
cherryramatis profile image
Cherry Ramatis • Edited

I don't think sorbet is complex, honestly is quite simpler than other approaches (such as rbs or typescript for another language example).

I do know about Dry::Types, it's a nice validation gem but for me it relies only on that field: validating structs

Sorbet allow you to express types for a whole new set of parts in your codebase, like variables by using T.let

Also sorbet allow more expressive typing via generics

Although Dry::Types are presented as a type system, I would treat more as a validation layer gem while sorbet or steep as proper type systems

🍒

Collapse
 
clerijr profile image
Clerivaldo Junior

Icecream is wonderfull in any context

Collapse
 
cherryramatis profile image
Cherry Ramatis

Yeah I love sugar

Collapse
 
phenriquesousa profile image
Pedro Henrique

Thanks for sharing<3

Collapse
 
zoldyzdk profile image
Hewerton Soares • Edited

Awesome content!

Collapse
 
canhassi profile image
Canhassi

Great article!!

Collapse
 
lliw profile image
William Rodrigues

Congratulations, Cherry! Great post again, if there's "sorbet" in the name It will be awesome!

Collapse
 
user_hello23 profile image
Thiago Christo

Nice

Collapse
 
guto profile image
guto

Amazing!

Collapse
 
camilacodes profile image
Camila Figueira

pica

Collapse
 
lliw profile image
William Rodrigues

OMG IT'S CHERRY FROM BRAZIL? BIG FAN HERE

Collapse
 
lorenalgm profile image
Lorena GM

Great content!

Collapse
 
k8adev profile image
Keit Oliveira

Supeeeer good

Collapse
 
orionth1 profile image
Matheus Emanoel

Awesome

Collapse
 
nandosts profile image
Fernando Melo

omg, the ruby queen attacks again!!! Great post!

Collapse
 
mels profile image
Melina Schneider

Complete and interesting article! Saving this to read more times! Thx, Cherry <3

Collapse
 
zoldyzdk profile image
Hewerton Soares

Awesome content!!

Collapse
 
dantas profile image
Gustavo

omg another great article from cherry hiiii

Collapse
 
vklisman profile image
Victor Klisman

Great!

Collapse
 
igorsantos13 profile image
Igor Santos

Sensational, as usual.

Collapse
 
fransborges profile image
Fran Borges • Edited

High quality content!, Just the patroa <3

Collapse
 
renanvidal profile image
Renan Vidal Rodrigues

Great content, as always and great to read everything you produce. congratulations Cherry

Collapse
 
cherryramatis profile image
Cherry Ramatis

thanks a lot <3 <3

Collapse
 
rikokami profile image
William Dantas

Nice tutorial 🔥🔥🔥

Collapse
 
cherryramatis profile image
Cherry Ramatis

thanks!! <3 <3

Collapse
 
danielhe4rt profile image
Daniel Reis

Never heard about Icecream, but I liked it a lot.

Really nice tutorial, Cherry! Keep going!

Collapse
 
cherryramatis profile image
Cherry Ramatis

Thanks a lot cousin! sorbet is a really nice tool

Collapse
 
fernandoandrade profile image
Fernando Andrade

Amazing content cherry, I liked the meme references =D

Collapse
 
cherryramatis profile image
Cherry Ramatis

hope it's a cool experience for you cousin <3 <3

Collapse
 
pandasuco profile image
Nathalia Costa

Perfeita que merece uma música:

주세요 달콤한 그 맛 ice cream cake

Collapse
 
igorsantos13 profile image
Igor Santos

Amazing!!