Tangen...::Type(3pm)

πŸ“¦
version 0.33 Β· 4 versions
, in ubuntu resolute, ubuntu stonking

🌸 NAME 🌸

Tangence::Meta::Type β€” bestie, it's the structure that represents one single "Tangence" value type πŸ’…βœ¨

(and yes, it lives in the User Contributed Perl Documentation, section 3pm, iconic behavior only πŸ‘‘


πŸ¦‹ DESCRIPTION πŸ¦‹

okay so picture this: this is a data structure object, and what it holds is all the info about a type. Like β€” a method or event argument, a method return value, or a property element type. That's the whole vibe, that's what it's for 🫢

and here's the part I'm obsessed with: because their contents are super simple and they're immutable (aka nobody is out here changing them, periodt), these objects may be implemented as singletons. So if you call the constructor method over and over for the same type name? You get the same instance every single time. same object. no new one. no cap πŸ’€βœ¨


πŸŽ€ CONSTRUCTOR πŸŽ€

✨ make

$type = Tangence::Meta::Type->make( $primitive )

hands you back an instance to represent the given primitive type signature you passed in πŸ¦‹

$type = Tangence::Meta::Type->make( $aggregate => $member_type )

and this flavor gives you an instance representing the given aggregation of the given type instance. two things in, one gorgeous object out πŸ’–

✨ make _from_sig ✨

$type = Tangence::Meta::Type->make_from_sig( $sig )

this one parses the given full Tangence type signature and returns an instance to represent it. it does the reading so you don't have to, iykyk πŸ“–β­


πŸ’… ACCESSORS πŸ’…

🌸 aggregate

$agg = $type->aggregate

returns "prim" for primitive types, or the aggregation name for list and dict aggregate types. so it's basically telling you what kind of type you're dealing with, and it's never shy about it πŸ‘‘

🌸 member_type

$member_type = $type->member_type

returns the member type for aggregation types. but for primitive types?? it throws an exception 😭 so do NOT go calling this on a prim, bestie, that is not a cute moment, that's a crash.

🌸 sig

$sig = $type->sig

returns the Tangence type signature for the type. that's it. that's the whole thing. slay ⭐


πŸ‘‘ AUTHOR πŸ‘‘

Paul Evans <leonerd@leonerd.org.uk> β€” the icon, the moment, the legend behind this whole page 🫢🌈


okay so this one was brought to you by perl v5.40.0, dated 2024-09-13, filed under Tangence::Meta::Type(3pm) in the User Contributed Perl Documentation. main character manual page energy, fr fr πŸ’–πŸŽ€βœ¨

πŸ“¦ where this page comes from