Skip to content

Conditionally use a distribution in the Raku Programming Language

License

Notifications You must be signed in to change notification settings

raku-community-modules/if

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

21 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Actions Status

NAME

if - Conditionally load a distribution

SYNOPSIS

use if; # activate the :if adverb on use statements

use My::Linux::Backend:if($*KERNEL.name eq 'linux');
use My::Fallback::Backend:if($*KERNEL.name ne 'linux');

# ... do something with the backend you got

DESCRIPTION

The if distribution will let you conditionally load a distribution. Use cases (no pun intended) are about loading different implementations of a functionality for different operating systems, compiler backends, or compiler versions.

This means that these switches for different implementations do not happen at runtime, but cheaply at compile time. This also means that a custom build and install hook is not needed because all implementations are installed. Then depending on the conditions only the desired implementation will be used.

Even if the switch is by backends you can share one installation by several backends using this technique.

AUTHOR

Tobias "FROGGS" Leich

COPYRIGHT AND LICENSE

Copyright 2016-2020 Tobias Leich Copyright 2023 Raku Community

This library is free software; you can redistribute it and/or modify it under the Artistic License 2.0.

About

Conditionally use a distribution in the Raku Programming Language

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors 4

  •  
  •  
  •  
  •  

Languages