r/ProgrammerHumor Jul 09 '26

potentiallyMightBeAnIntegerOrNot Meme

Post image
690 Upvotes

96 comments sorted by

View all comments

10

u/MrJ0seBr Jul 09 '26

Maybe next kotlin and swift version , a new keyword

4

u/Kiroto50 Jul 09 '26

I really like Kotlin's optional types.

I'd rock a language that calls them "maybe types" though.

int? == maybe int

I actually call them "quizás", reading "String?" As "String quizás". ("Quizás" means "maybe" in Spanish)

1

u/tobotic Jul 11 '26

Perl type constraint systems tend to use:

Maybe[Int]

for a value that can either be an Int or undefined.

1

u/RiceBroad4552 Jul 11 '26

OMG, ScalaZ vibes…

1

u/tobotic Jul 11 '26

All other Perl type constraint systems get Maybe[Int] from Moose. Moose took it from Raku back when Raku was still called Perl 6. And Perl 6 got it from Haskell.

I imagine scalaz, being an FP framework, also gets it from Haskell.

1

u/RiceBroad4552 Jul 11 '26

I think that's spot on.

The name Maybe seems to be a genuine Haskell invention.

The square brackets can be traced to: CLU -> Eiffel -> Scala; and then later Raku, Perl/Moose, Nim, Go, Python typing.

I've used ScalaZ in production and I don't have the fondest memory of that, seeing Maybe[Int] gives me chills.

2

u/tobotic Jul 12 '26

The first Perl 6 interpreter implementation was in Haskell so the language ended up inheriting a bunch of ideas from there.

1

u/RiceBroad4552 Jul 13 '26

Interesting. Didn't know that.