Skip to content

Frequently Asked Questions

Ovid edited this page Aug 12, 2023 · 5 revisions

FAQ

You have questions? We have answers!

What's Oshun about?

Dynamic runtime data checks, such as my INT $foo = 42;.

User-supported checks such as my EvenInt $foo = 3; # error

The intent is to make it easier for developers to know that the kinds of data they're expecting are actually the data they need. Want an arrayref of integers? my ARRAY[INT] $aref = get_data(...);.

Subgoals:

  1. Ability to downgrades checks from fatal to warnings (useful for production systems)
  2. Ability to completely disable those checks (useful for performance)

Where did the name "Oshun" come from?

Oshun is an orisha (deity) of the Nigerian Yoruba. She's a river deity, a fertility goddess. In stories, she's often depicted as protector, savior, or nurturer. In our context, Oshun will protect your data.

The world is a large, beautiful place, so the name was chosen to show a hint of part of the world that many of us do not see.

Read a bit more about her here.

These are types. Why aren't you calling them types?

As the poet Ovid said circa 20 CE (give or take 2K years):

Computer scientists have discussions about what they'd like from a type system.

Computer programmers have screaming matches.

So we don't use the naughty word "type" to avoid the screaming matches. These are simply runtime data checks, largely modelled after the highly successful checks done in Moo/se and with Type::Tiny.

Do you have a specification?

The first pass at the spec is here. It's very long and daunting to read through.

It should not be considered The Specification. It's a starting point for discussion.

Why not compile-time?

The extreme late-binding of Perl and its general resistance to being parsed makes it hard for some kinds of compile-time checks to be implemented. However, we don't object to compile-time checks, but if we want an MVP to be submitted to the Perl core, we need something as small and safe as possible.

Wait! This going into core?

We make no promises. We're largely modelling the process after the successful Corinna project to get modern object-oriented programming in the Perl core. We have a team, we have a spec, we're refining it. If there's enough public demand, we'd like to get to the point where we can propose this to the PSC and see if we can get it accepted.

I don't need data checks!

That's fine! There are plenty of utility scripts which would gain little benefit from them. However, for larger projects, people call your code and you call their code. There's often little guarantee that the data being passed back and forth conforms to expectations. Oshun is the start of making that both easier and native to the Perl language.

Why is this important?

When Perl 5 was released, it provided packages, an object system, lexical variables, and modules. This was done to make it easier to build larger, structured applications, to make Perl more scalable for developers. Shortly thereafter Perl became "the duct tape of the internet." It was a huge success. However, Perl struggled in subsequent years. Part of the reason for this, we believe, is that the later changes to Perl were often niche and didn't address the overall "scalability" issue. In fact, one could argue that in the past 30 years, the only major feature to touch on this was the years-long introduction of subroutine signatures.

However, in Perl 5, you could type perldoc -f my and see this as the grammar:

my VARLIST
my TYPE VARLIST
my VARLIST : ATTRS
my TYPE VARLIST : ATTRS

The TYPE only had fledgling support. It was a promise of greater maintainability of Perl, a promise that has not been kept for three decades. It's time to keep that promise.