class X::NYI
ErrorsCollection

class X::NYI

Error due to use of an unimplemented feature

class X::NYI is Exception { }

Error class for unimplemented features. NYI stands for Not Yet Implemented.

If a Raku compiler is not yet feature complete, it may throw an X::NYI exception when a program uses a feature that it can detect and is somehow specified is not yet implemented.

A full-featured Raku compiler must not throw such exceptions, but still provide the X::NYI class for compatibility reasons.

A typical error message is

HyperWhatever is not yet implemented. Sorry.

Methods

method new

method new:$feature:$did-you-mean:$workaround)

This is the default constructor for X:NYI which can take three parameters with obvious meanings.

class Nothing {
    method ventured$sub**@args{
        X::NYI.newfeature => &?ROUTINE.name,
                    did-you-mean => "gained",
                    workaround => "Implement it yourself" ).throw;
    }
}
 
my $nothing = Nothing.new;
$nothing.ventured("Nothing""Gained");

In this case, we are throwing an exception that indicates that the ventured routine has not been implemented; we use the generic &?ROUTINE.name to not tie the exception to the method name in case it is changed later on. This code effectively throws this exception

# OUTPUT: 
# ventured not yet implemented. Sorry. 
# Did you mean: gained? 
# Workaround: Implement it yourself 
#   in method ventured at NYI.p6 line 6 
#   in block <unit> at NYI.p6 line 14 

Using the exception properties, it composes the message that we see there.

method feature

Returns a Str describing the missing feature.

method did-you-mean

Returns a Str indicating the optional feature that is already implemented.

method workaround

It helpfully shows a possible workaround for the missing feature, if it's been declared.

method message

Returns the message including the above properties.