query
On this page

pathHasContext

lib.sources.pathHasContext

Primop
Docs pulled from | This Revision | about 2 hours ago

Takes 1 arguments

s


Return true if string s has a non-empty context. The context can be obtained with getContext.

Example

Many operations require a string context to be empty because they are intended only to work with "regular" strings, and also to help users avoid unintentionally loosing track of string context elements. builtins.hasContext can help create better domain-specific errors in those case.

name: meta:

if builtins.hasContext name
then throw "package name cannot contain string context"
else { ${name} = meta; }

Noogle detected

Aliases

Implementation

This function is implemented in c++ and is part of the native nix runtime.