Is it possible to assign a signature to a variable and then reuse it in different functions / methods? I found my $sig = :($a, $b);, but I don’t know how to use this variable as a signature in a function.
my $sig = :($a, $b);
One of the methods:
my $sig = :( $a, $b ); sub foo ( &function where { .signature ~~ $sig } ) {} sub bar ( $p, $q ) {} sub qux ( $waldo ) {} foo &bar; say "OK at line 10"; # OK at line 10 foo &qux; # Constraint type check failed ... line 12".
Source: https://habr.com/ru/post/1677628/More articles:An unlimited table is structured streaming - scalaКакая разница между "virtualenv" и "-m venv" при создании виртуальных сред (Python) - pythonList all the BibTex entries in the .bib file to create a list of Hakyll publications? - haskellWhen can I omit the return type in Kotlin - kotlinWhat is a Collection object in asp using vbscript? - vbscriptFailed to import Spark Implicits into ScalaTest - scalaOrg-mode Cc a undefined - emacsHow can I show a map of the route from the current location to some destination (some address)? - androidPass C # variable to helper function in jsrender template - javascriptjson_object and the dart: mirror - dartAll Articles