Specio:...t::Union(3)

πŸ’œ Specio::Constraint::Union(3) β€” like, the whole page, bestie

okay so real quick β€” this one's straight out of the User Contributed Perl Documentation, and the page header is lowkey cursed looking (Specio:...t::Union(3), the terminal ate some letters, it's fine, we move) but it's just the manpage for Specio::Constraint::Union. let's get into it ✨


🌸 NAME 🌸

Specio::Constraint::Union β€” a class for union constraints. that's it, that's the name, periodt πŸ’…


πŸŽ€ VERSION πŸŽ€

version 0.49


πŸ¦‹ SYNOPSIS πŸ¦‹

my $type = Specio::Constraint::Untion->new(...);
ok do NOT come for me β€” yes, it says Untion in the synopsis, not Union. that's exactly what the original says, character for character, so I'm not touching it. copy it as-is at your own risk, bestie 😭 (it's giving typo, but the vibes are immaculate and the docs are the docs)

✨ DESCRIPTION ✨

so this is a specialized type constraint class made specifically for unions. what's a union? it's a type that says "yeah, this value can be any one of several distinct types and I'm chill with all of them" 🫢

basically: Int | Str energy. a value walks in matching any one of the types in the union? it slays. it's in. 🌈


πŸ’– API πŸ’–

this class gives you all of the same methods as Specio::Constraint::Simple, with just a few differences. same energy, tiny plot twists πŸ‘‘

🌟 Specio::Constraint::Union->new( ... )

the deets on the constructor, ok:

  • the parent parameter is ignored if you pass it β€” like, straight up not perceived. it's always undef
  • the inline_generator and constraint parameters are also ignored. this class brings its own default inline generator subroutine reference, thank you very much, it doesn't need yours πŸ’…
  • and this class requires one extra parameter: of. it must be an arrayref of type objects. that's the whole lineup of types making up the union β€” no of, no union, no cap 🧒

🌟 $union->of

returns an array reference of the individual types that make up this union. that's the roster. the squad. the whole cast πŸ’œ


🧚 ROLES 🧚

this class does two roles, and it does them well:

  • Specio::Constraint::Role::Interface
  • Specio::Role::Inlinable

iconic behavior, honestly.


πŸ”₯ SUPPORT πŸ”₯

found a bug? bestie, report it, don't sit on it πŸ’€

bugs may be submitted at https://github.com/houseabsolute/Specio/issues


⭐ SOURCE ⭐

the source code repository for Specio lives at https://github.com/houseabsolute/Specio β€” go peek, it's right there πŸŽ€


πŸ‘‘ AUTHOR πŸ‘‘

Dave Rolsky <autarch@urth.org>


this software is Copyright (c) 2012 - 2024 by Dave Rolsky.

it's free software, licensed under:

The Artistic License 2.0 (GPL Compatible)

the full text of the license can be found in the LICENSE file included with this distribution. read it, it's good for you, no cap πŸ“œβœ¨


ngl none of the caveats here are scary-dangerous, but do remember: parent, inline_generator, and constraint get silently ignored and of is required β€” so if your union is being weird, check those first πŸ™ˆ

and that's the whole page!! 🫢 this version was generated for perl v5.42.0 on 2024-12-24 (the manpage rendering was literally generated on Christmas Eve, main character energy), muah, bye bestie πŸ’–πŸŽ€πŸ¦‹

πŸ“¦ where this page comes from