txt: ## new.md
  ## Chunk 1 of 2
  new
  
  Combined from primary sources listed below.
  
  # [In Uni](#___top "go to top of document")[§](#(Uni)_method_new "direct link")
  
  See primary documentation
  [in context](/type/Uni#method_new)
  for **method new**.
  
  ```raku
  method new(*@codes --> Uni:D)
  ```
  
  Creates a new `Uni` instance from the given codepoint numbers.
  
  # [In IO::Socket::INET](#___top "go to top of document")[§](#(IO::Socket::INET)_method_new "direct link")
  
  See primary documentation
  [in context](/type/IO/Socket/INET#method_new)
  for **method new**.
  
  ```raku
  multi method new(
          :$host,
          :$port,
          :$family = PF_INET,
          :$encoding = 'utf-8',
          :$nl-in = "\r\n",
      --> IO::Socket::INET:D)
  multi method new(
          :$localhost,
          :$localport,
          :$family = PF_INET,
          :$listen,
          :$encoding = 'utf-8',
          :$nl-in = "\r\n",
      --> IO::Socket::INET:D)
  
  ```
  
  Creates a new socket.
  
  If `:$listen` is True, creates a new socket that listen on `:$localhost` (which can be an IP address or a domain name) on port `:$localport`; in other words the `:$listen` flag determines the *server mode* of the socket. Otherwise (i.e., `:$listen` is `False`), the new socket opens immediately a connection to `:$host` on port `:$port`.
  
  `:$family` defaults to `PF_INET` constant for IPv4, and can be set to `PF_INET6` constant for IPv6.
  
  For text operations (such as [method lines](#method_lines) and [method get](#method_get)), `:$encoding` specifies the encoding, and `:$nl-in` determines the character(s) that separate lines.
  
  # [In Num](#___top "go to top of document")[§](#(Num)_method_new "direct link")
  
  See primary documentation
  [in context](/type/Num#method_new)
  for **method new**.
  
  ```raku
  multi method new()
  multi method new($n)
  ```
  
  `Num.new` without argument will create a `Num` with the value `0e0`. With an argument, it will be coerced to `Num` and then returned.
  
  ```raku
  say Num.new(⅓); # OUTPUT: «0.3333333333333333␤»
  ```
  
  # [In role CX::Warn](#___top "go to top of document")[§](#(role_CX::Warn)_method_new "direct link")
  
  See primary documentation
  [in context](/type/CX/Warn#method_new)
  for **method new**.
  
  `CX::Warn` objects are created when a warning is thrown in any block.
  
  # [In IO::Special](#___top "go to top of document")[§](#(IO::Special)_method_new "direct link")
  
  See primary documentation
  [in context](/type/IO/Special#method_new)
  for **method new**.
  
  ```raku
  method new(:$!what!)
  
  ```
  
  Takes a single required attribute [what](/routine/what). It is unlikely that you will ever need to construct one of these objects yourself.
  
  # [In Version](#___top "go to top of document")[§](#(Version)_method_new "direct link")
  
  See primary documentation
  [in context](/type/Version#method_new)
  for **method new**.
  
  ```raku
  method new(Str:D $s)
  ```
  
  Creates a `Version` from a string `$s`. The string is combed for the numeric, alphabetic, and wildcard components of the version object. Any characters other than alphanumerics and asterisks are assumed to be equivalent to a dot. A dot is also assumed between any adjacent numeric and alphabetic characters.
  
  # [In Proxy](#___top "go to top of document")[§](#(Proxy)_method_new "direct link")
  
  See primary documentation
  [in context](/type/Proxy#method_new)
  for **method new**.
  
  ```raku
  method new(:&FETCH!, :&STORE! --> Proxy:D)
  ```
  
  Creates a new `Proxy` object. `&FETCH` is called with one argument (the proxy object) when the value is accessed, and must return the value that the fetch produces. `&STORE` is called with two arguments (the proxy object, and the new value) when a new value is stored in the container.
  
  # [In Proc](#___top "go to top of document")[§](#(Proc)_routine_new "direct link")
  
  See primary documentation
  [in context](/type/Proc#routine_new)
  for **routine new**.
  
  ```raku
  method new(Proc:U:
          :$in = '-',
          :$out = '-',
          :$err = '-',
          Bool :$bin = False,
          Bool :$chomp = True,
          Bool :$merge = False,
          Str:D :$enc = 'UTF-8',
          Str:D :$nl = "\n",
      --> Proc:D)
  
  sub shell(
          $cmd,
          :$in = '-',
          :$out = '-',
          :$err = '-',
          Bool :$bin = False,
          Bool :$chomp = True,
          Bool :$merge = False,
          Str:D :$enc = 'UTF-8',
          Str:D :$nl = "\n",
          :$cwd = $*CWD,
          Hash() :$env = %*ENV
      --> Proc:D)
  
  ```
  
  `new` creates a new `Proc` object, whereas `run` or `shell` create one and spawn it with the command and arguments provided in `@args` or `$cmd`, respectively.
  
  `$in`, `$out` and `$err` are the three standard streams of the to-be-launched program, and default to `"-"` meaning they inherit the stream from the parent process. Setting one (or more) of them to `True` makes the stream available as an [`IO::Pipe`](/type/IO/Pipe) object of the same name, like for example `$proc.out`. You can set them to `False` to discard them. Or you can pass an existing [`IO::Handle`](/type/IO/Handle) object (for example [`IO::Pipe`](/type/IO/Pipe)) in, in which case this handle is used for the stream.
  
  Please bear in mind that the process streams reside in process variables, not in the dynamic variables that make them available to our programs. Thus, modifying [the dynamic filehandle variables (such as `$*OUT`)](/language/variables#Special_filehandles:_STDIN,_STDOUT_and_STDERR) inside the host process will have no effect in the spawned process, unlike `$*CWD` and `$*ENV`, whose changes will be actually reflected in it.
  
  ```raku
  my $p-name = "/tmp/program.raku";
  my $program = Q:to/END/;
      #!/usr/bin/env raku
  
      $*OUT.say( qq/\t$*PROGRAM: This goes to standard output/ );
  END
  
  spurt $p-name, $program;
  
  $*OUT.put: "1. standard output before doing anything weird";
  
  {
      temp $*OUT = open '/tmp/out.txt', :w;
      $*OUT.put: "2. temp redefine standard output before this message";
      shell( "raku $p-name" ).so;
  }
  
  $*OUT.put: "3. everything should be back to normal";
  # OUTPUT
  # 1. standard output before doing anything weird
  #     /tmp/program.raku: This goes to standard output
  # 3. everything should be back to normal
  
  # /tmp/out.txt will contain:
  # 2. temp redefine standard output before this message
  
  ```
  
  This program shows that the program spawned with `shell` is not using the temporary `$*OUT` value defined in the host process (redirected to `/tmp/out.txt`), but the initial `STDOUT` defined in the process.
  
  `$bin` controls whether the streams are handled as binary (i.e. [`Blob`](/type/Blob) object) or text (i.e. [`Str`](/type/Str) objects). If `$bin` is False, `$enc` holds the character encoding to encode strings sent to the input stream and decode binary data from the output and error streams.
  
  With `$chomp` set to `True`, newlines are stripped from the output and err streams when reading with `lines` or `get`. `$nl` controls what your idea of a newline is.
  
  If `$merge` is set to True, the standard output and error stream end up merged in `$proc.out`.
  
  # [In IntStr](#___top "go to top of document")[§](#(IntStr)_method_new "direct link")
  
  See primary documentation
  [in context](/type/IntStr#method_new)
  for **method new**.
  
  ```raku
  method new(Int $i, Str $s)
  ```
  
  The constructor requires both the [`Int`](/type/Int) and the [`Str`](/type/Str) value, when constructing one directly the values can be whatever is required:
  
  ```raku
  my $f = IntStr.new(42, "forty two");
  say +$f; # OUTPUT: «42␤»
  say ~$f; # OUTPUT: «"forty two"␤»
  ```
  
  # [In RakuAST::Doc::Paragraph](#___top "go to top of document")[§](#(RakuAST::Doc::Paragraph)_method_new "direct link")
  
  See primary documentation
  [in context](/type/RakuAST/Doc/Paragraph#method_new)
  for **method new**.
  
  ```raku
  method new(*@atoms)
  ```
  
  The `new` method must be called to create a new `RakuAST::Doc::Paragraph` object. It takes any number of positional arguments as the atoms of the logical paragraph, where an atom is either a string or a [`RakuAST::Doc::Markup`](/type/RakuAST/Doc/Markup) object.
  
  Typically a `RakuAST::Doc::Paragraph` object is only created if a logical paragraph has at least one markup object.
  
  ```raku
  my $paragraph = RakuAST::Doc::Paragraph.new(
    "Text before ",
    RakuAST::Doc::Markup.new(:letter<B>, :atoms("and")),
    " after markup\n"
  );
  
  ```
  
  # [In Seq](#___top "go to top of document")[§](#(Seq)_method_new "direct link")
  
  See primary documentation
  [in context](/type/Seq#method_new)
  for **method new**.
  
  ```raku
  proto method new(Seq: |) {*}
  multi method new(Seq: Iterator:D $iter)
  multi method new(Seq:)
  
  ```
  
  Creates a new `Seq` object from the supplied iterator passed as the single argument. Creates an empty `Seq` if called with no argument.
  
  # [In NumStr](#___top "go to top of document")[§](#(NumStr)_method_new "direct link")
  
  See primary documentation
  [in context](/type/NumStr#method_new)
  for **method new**.
  
  ```raku
  method new(Num $i, Str $s)
  ```
  
  The constructor requires both the [`Num`](/type/Num) and the [`Str`](/type/Str) value, when constructing one directly the values can be whatever is required:
  
  ```raku
  my $f = NumStr.new(42.1e0, "forty two and a bit");
  say +$f; # OUTPUT: «42.1␤»
  say ~$f; # OUTPUT: «"forty two and a bit"␤»
  ```
  
  # [In Complex](#___top "go to top of document")[§](#(Complex)_method_new "direct link")
  
  See primary documentation
  [in context](/type/Complex#method_new)
  for **method new**.
  
  ```raku
  multi method new(Real $re, Real $im --> Complex:D)
  ```
  
  Creates a new `Complex` object from real and imaginary parts.
  
  ```raku
  my $complex = Complex.new(1, 1);
  say $complex;    # OUTPUT: «1+1i␤»
  ```
  
  When created without arguments, both parts are considered to be zero.
  
  ```raku
  say Complex.new; # OUTPUT: «0+0i␤»
  ```
  
  # [In Format](#___top "go to top of document")[§](#(Format)_method_new "direct link")
  
  See primary documentation
  [in context](/type/Format#method_new)
  for **method new**.
  
  ```raku
  method new($format --> Format:D)
  
  ```
  
  Creates a new `Format` object from a `sprintf` compatible format string.
  
  ```raku
  use v6.e.PREVIEW;
  my $d = Format.new("%05d");
  say $d;                         # OUTPUT: «%05d␤»
  say $d(42);                     # OUTPUT: «00042␤»
  
  ```
  
  # [In RakuAST::Doc::Markup](#___top "go to top of document")[§](#(RakuAST::Doc::Markup)_method_new "direct link")
  
  See primary documentation
  [in context](/type/RakuAST/Doc/Markup#method_new)
  for **method new**.
  
  ```raku
  method new(
    Str:D  :$letter!,      # markup identifier, e.g. "B"
    Str:D  :$opener = "<", # opener marker
    Str:D  :$closer = ">", # closer marker
           :@atoms,        # any atoms of this markup
           :@meta,         # any meta of this markup
  )
  
  ```
  
  The `new` method can be called to create a new `RakuAST::Doc::Markup` object. It only takes named arguments, with the `:letter` argument being mandatory.
  
  Rakudoc highlighting
  
  ```
  B<and>
  
  ```
  
  ```raku
  my $markup = RakuAST::Doc::Markup.new(
    :letter<B>,
    :atoms("and")
  );
  
  ```
  
  Note that all arguments except `:letter` are optional. So it is possible to create "empty" markup as well.
  
  # [In Map](#___top "go to top of document")[§](#(Map)_method_new "direct link")
  
  See primary documentation
  [in context](/type/Map#method_new)
  for **method new**.
  
  ```raku
  method new(*@args)
  ```
  
  Creates a new Map from a list of alternating keys and values, with [the same semantics](/language/hashmap#Hash_assignment) as described in the [Hashes and maps](/language/hashmap) documentation, but also accepts [`Pair`](/type/Pair)s instead of separate keys and values. Use the [grouping operator](/language/operators#term_(_)) or quote the key to ensure that a literal pair is not interpreted as a named argument.
  
  ```raku
  my %h = Map.new('a', 1, 'b', 2);
  
  # WRONG: :b(2) interpreted as named argument
  say Map.new('a', 1, :b(2)).keys; # OUTPUT: «(a)␤»
  
  # RIGHT: :b(2) interpreted as Pair because of extra parentheses
  say Map.new( ('a', 1, :b(2)) ).keys.sort; # OUTPUT: «(a b)␤»
  
  # RIGHT: 'b' => 2 always creates a Pair
  say Map.new('a', 1, 'b' => 2).keys.sort; # OUTPUT: «(a b)␤»
  ```
  
  A shorthand syntax for creating Maps is provided:
  
  ```raku
  my %h is Map = 'a', 1, 'b', 2;
  ```
  
  # [In IO::Path::Cygwin](#___top "go to top of document")[§](#(IO::Path::Cygwin)_method_new "direct link")
  
  See primary documentation
  [in context](/type/IO/Path/Cygwin#method_new)
  for **method new**.
  
  Same as [`IO::Path.new`](/type/IO/Path#method_new), except `:$SPEC` cannot be set and defaults to [`IO::Spec::Cygwin`](/type/IO/Spec/Cygwin), regardless of the operating system the code is being run on.
  
  # [In Metamodel::PackageHOW](#___top "go to top of document")[§](#(Metamodel::PackageHOW)_method_new "direct link")
  
  See primary documentation
  [in context](/type/Metamodel/PackageHOW#method_new)
  for **method new**.
  
  ```raku
  method new(*%named)
  ```
  
  Creates a new `PackageHOW`.
  
  # [In Proc::Async](#___top "go to top of document")[§](#(Proc::Async)_method_new "direct link")
  
  See primary documentation
  [in context](/type/Proc/Async#method_new)
  for **method new**.
  
  ```raku
  multi method new(*@ ($path, *@args), :$w, :$enc, :$translate-nl, :$arg0,
                   :$win-verbatim-args = False,
                   :$started = False --> Proc::Async:D)
  multi method new(   :$path, :@args,  :$w, :$enc, :$translate-nl, :$arg0,
                   :$win-verbatim-args = False,
                   :$started = False --> Proc::Async:D)
  ```
  
  Creates a new `Proc::Async` object with external program name or path `$path` and the command line arguments `@args`.
  
  If `:w` is passed to `new`, then a pipe to the external program's standard input stream (`stdin`) is opened, to which you can write with `write` and `say`.
  
  The `:enc` specifies [the encoding](/type/IO/Handle#method_encoding) for streams (can still be overridden in individual methods) and defaults to `utf8`.
  
  If `:translate-nl` is set to `True` (default value), OS-specific newline terminators (e.g. `\r\n` on Windows) will be automatically translated to `\n`.
  
  If `:arg0` is set to a value, that value is passed as arg0 to the process instead of the program name.
  
  The `:started` attribute is set by default to `False`, so that you need to start the command afterwards using [`.start`](/type/Proc/Async#method_start). You probably don't want to do this if you want to bind any of the handlers, but it's OK if you just need to start an external program immediately.
  
  On Windows the flag `$win-verbatim-args` disables all automatic quoting of process arguments. See [this blog](https://docs.microsoft.com/en-us/archive/blogs/twistylittlepassagesallalike/everyone-quotes-command-line-arguments-the-wrong-way) for more information on windows command quoting. The flag is ignored on all other platforms. The flag was introduced in Rakudo version 2020.06 and is not present in older releases. By default, it's set to `False`, in which case arguments will be quoted according to Microsoft convention.
  
  # [In IO::Path::Parts](#___top "go to top of document")[§](#(IO::Path::Parts)_method_new "direct link")
  
  See primary documentation
  [in context](/type/IO/Path/Parts#method_new)
  for **method new**.
  
  ```raku
  method new(\volume, \dirname, \basename)
  ```
  
  Create a new `IO::Path::Parts` object with `\volume`, `\dirname` and `\basename` as respectively the volume, directory name and basename parts.
  
  # [In Distribution::Hash](#___top "go to top of document")[§](#(Distribution::Hash)_method_new "direct link")
  
  See primary documentation
  [in context](/type/Distribution/Hash#method_new)
  for **method new**.
  
  ```raku
  method new($hash, :$prefix)
  ```
  
  Creates a new `Distribution::Hash` instance from the metadata contained in `$hash`. All paths in the metadata will be prefixed with `:$prefix`.
  
  # [In Pair](#___top "go to top of document")[§](#(Pair)_method_new "direct link")
  
  See primary documentation
  [in context](/type/Pair#method_new)
  for **method new**.
  
  ```raku
  multi method new(Pair: Mu  $key, Mu  $value)
  multi method new(Pair: Mu :$key, Mu :$value)
  ```
  
  Constructs a new `Pair` object.
  
  # [In RakuAST::Doc::Block](#___top "go to top of document")[§](#(RakuAST::Doc::Block)_method_new "direct link")
  
  See primary documentation
  [in context](/type/RakuAST/Doc/Block#method_new)
  for **method new**.
  
  ```raku
  method new(
    Str:D  :$type!,        # type of block, e.g. "head"
    Int:D  :$level = 0,    # level of block, e.g. 1 for "=head1"
           :%config,       # any configuration to be applied
    Str:D  :$margin = "",  # left margin (0 or more spaces)
           :@paragraphs,   # paragraphs of this block
    Bool:D :$for,          # this is a =for block
    Bool:D :$abbreviated,  # this is an abbreviated block
    Bool:D :$directive     # this is a directive (also abbreviated)
  )
  
  ```
  
  The `new` method can be called to create a new `RakuAST::Doc::Block` object. It only takes named arguments, with the `:type` argument being mandatory.
  
  ```raku
    =begin foo
    bar
    =end foo
  
  my $block = RakuAST::Doc::Block.new(
    :margin("  "),
    :type<foo>,
    :paragraphs("bar\n",)
  );
  
  ```
  
  Note that the paragraphs should **not** contain the left margin whitespace.
  
  # [In Distribution::Path](#___top "go to top of document")[§](#(Distribution::Path)_method_new "direct link")
  
  See primary documentation
  [in context](/type/Distribution/Path#method_new)
  for **method new**.
  
  ```raku
  method new(IO::Path $prefix, IO::Path :$meta-file = IO::Path)
  ```
  
  Creates a new `Distribution::Path` instance from the `META6.json` file found at the given `$prefix`, and from which all paths in the metadata will be prefixed with. `:$meta-file` may optionally be passed if a filename other than `META6.json` needs to be used.
  
  # [In Mu](#___top "go to top of document")[§](#(Mu)_method_new "direct link")
  
  See primary documentation
  [in context](/type/Mu#method_new)
  for **method new**.
  
  ```raku
  multi method new(*%attrinit)
  ```
  
  Default method for constructing (create + initialize) new objects of a class. This method expects only named arguments which are then used to initialize attributes with accessors of the same name.
  
  Classes may provide their own `new` method to override this default.
  
  `new` triggers an object construction mechanism that calls submethods named `BUILD` in each class of an inheritance hierarchy, if they exist. See [the documentation on object construction](/language/objects#Object_construction) for more information.
  
  # [In Failure](#___top "go to top of document")[§](#(Failure)_method_new "direct link")
  
  See primary documentation
  [in context](/type/Failure#method_new)
  for **method new**.
  
  ```raku
  multi method new(Failure:D:)
  multi method new(Failure:U:)
  multi method new(Failure:U: Exception:D \exception)
  multi method new(Failure:U: $payload)
  multi method new(Failure:U: |cap (*@msg))
  ```
  
  Returns a new `Failure` instance with payload given as argument. If called without arguments on a `Failure` object, it will throw; on a type value, it will create an empty `Failure` with no payload. The latter can be either an [`Exception`](/type/Exception) or a payload for an [`Exception`](/type/Exception). A typical payload would be a [`Str`](/type/Str) with an error message. A list of payloads is also accepted.
  
  ```raku
  my $e = Failure.new(now.DateTime, 'WELP‼');
  say $e;
  CATCH{ default { say .^name, ': ', .Str } }
  # OUTPUT: «X::AdHoc: 2017-09-10T11:56:05.477237ZWELP‼␤»
  ```
  
  # [In Telemetry::Sampler](#___top "go to top of document")[§](#(Telemetry::Sampler)_method_new "direct link")
  
  See primary documentation
  [in context](/type/Telemetry/Sampler#method_new)
  for **method new**.
  
  ```raku
  method new(Telemetry::Sampler: @instruments --> Telemetry::Sampler:D)
  
  ```
  
  The `new` method takes a list of instruments. If no instruments are specified, then it will look at the `RAKUDO_TELEMETRY_INSTRUMENTS` environment variable to find specification of instruments. If that is not available either, then [`Telemetry::Instrument::Usage`](/type/Telemetry/Instrument/Usage) and [`Telemetry::Instrument::ThreadPool`](/type/Telemetry/Instrument/ThreadPool) will be assumed.
  
  Instruments can be specified by either the type object of the instrument class (e.g. [`Telemetry::Instrument::Usage`](/type/Telemetry/Instrument/Usage)) or by a string, in which case it will be automatically prefixed with "Telemetry::Instrument::", so "Usage" would be the same as [`Telemetry::Instrument::Usage`](/type/Telemetry/Instrument/Usage).
  
  # [In role Blob](#___top "go to top of document")[§](#(role_Blob)_method_new "direct link")
  
  See primary documentation
  [in context](/type/Blob#method_new)
  for **method new**.
  
  ```raku
  multi method new(Blob:)
  multi method new(Blob: Blob:D $blob)
  multi method new(Blob: int @values)
  multi method new(Blob: @values)
  multi method new(Blob: *@values)
  ```
  
  Creates an empty `Blob`, or a new `Blob` from another `Blob`, or from a list of integers or values (which will have to be coerced into integers):
  
  ```raku
  my $blob = Blob.new([1, 2, 3]);
  say Blob.new(<1 2 3>); # OUTPUT: «Blob:0x<01 02 03>␤»
  ```
  
  # [In IO::CatHandle](#___top "go to top of document")[§](#(IO::CatHandle)_method_new "direct link")
  
  See primary documentation
  [in context](/type/IO/CatHandle#method_new)
  for **method new**.
  
  ```raku
  method new(*@handles, :&on-switch, :$chomp = True,
             :$nl-in = ["\n", "\r\n"], Str :$encoding, Bool :$bin)
  
  ```
  
  Creates a new `IO::CatHandle` object.
  
  The `@handles` positional argument indicates a source of handles for the `IO::CatHandle` to read from and can deal with a mixed collection of [`Cool`](/type/Cool), [`IO::Path`](/type/IO/Path), and [`IO::Handle`](/type/IO/Handle) (including [`IO::Pipe`](/type/IO/Pipe)) objects. As input from `IO::CatHandle` is processed (so operations won't happen during `.new` call, but only when `@handles`' data is needed), it will walk through the `@handles` list, processing each argument as follows:
  
  * the [`Cool`](/type/Cool) objects will be coerced to [`IO::Path`](/type/IO/Path);
  * [`IO::Path`](/type/IO/Path) objects will be opened for reading using the `IO::CatHandle`'s (invocant's) attributes for [`open`](/routine/open) calls;
  * un-opened [`IO::Handle`](/type/IO/Handle) objects will be opened in the same fashion as [`IO::Path`](/type/IO/Path) objects;
  * and already opened [`IO::Handle`](/type/IO/Handle) objects will have all of their attributes set to the attributes of the invocant `IO::CatHandle`.
  
  In short, all the `@handles` end up as [`IO::Handle`](/type/IO/Handle) objects opened in the same mode and with the same attributes as the invocant `IO::CatHandle`.
  
  See [`.on-switch` method](/type/IO/CatHandle#method_on-switch) for details on the `:&on-switch` named argument, which by default is not set.
  
  The [`:$encoding`](/type/IO/CatHandle#method_encoding) named argument specifies the handle's encoding and accepts the same values as [`IO::Handle.encoding`](/type/IO/Handle#method_encoding). Set `:$bin` named argument to `True` if you wish the handle to be in binary mode. Attempting to specify both a defined `:$encoding` and a `True` `:$bin` is a fatal error resulting in `X::IO::BinaryAndEncoding` exception thrown. If neither `:$encoding` is set nor `:$bin` set to a true value, the handle will default to `utf8` encoding.
  
  The `:$chomp` and `:$nl-in` arguments have the same meaning as in [`IO::Handle`](/type/IO/Handle) and take and default to the same values.
  
  # [In Supplier::Preserving](#___top "go to top of document")[§](#(Supplier::Preserving)_method_new "direct link")
  
  See primary documentation
  [in context](/type/Supplier/Preserving#method_new)
  for **method new**.
  
  ```raku
  method new()
  ```
  
  The [`Supplier`](/type/Supplier) constructor.
  
  # [In Nil](#___top "go to top of document")[§](#(Nil)_method_new "direct link")
  
  See primary documentation
  [in context](/type/Nil#method_new)
  for **method new**.
  
  ```raku
  method new(*@)
  ```
  
  Returns `Nil`
  
  # [In IO::Path](#___top "go to top of document")[§](#(IO::Path)_method_new "direct link")
  
  See primary documentation
  [in context](/type/IO/Path#method_new)
  for **method new**.
  
  ```raku
  multi method new(Str:D $path, IO::Spec :$SPEC = $*SPEC, Str() :$CWD = $*CWD)
  multi method new(
      :$basename!, :$dirname = '.', :$volume = ''
      IO::Spec :$SPEC = $*SPEC, Str() :$CWD = $*CWD
  )
  
  ```
  
  Creates a new `IO::Path` object from a path string (which is being parsed for volume, directory name and basename), or from volume, directory name and basename passed as named arguments.
  
  The path's operation will be performed using `:$SPEC` semantics (defaults to current [`$*SPEC`](/language/variables#Dynamic_variables)) and will use `:$CWD` as the directory the path is relative to (defaults to [`$*CWD`](/language/variables#Dynamic_variables)).
  
  If `$path` includes the null byte, it will throw an Exception with a "Cannot use null character (U+0000) as part of the path" message.
  
  # [In IO::Path::Unix](#___top "go to top of document")[§](#(IO::Path::Unix)_method_new "direct link")
  
  See primary documentation
  [in context](/type/IO/Path/Unix#method_new)
  for **method new**.
  
  Same as [`IO::Path.new`](/type/IO/Path#method_new), except `:$SPEC` cannot be set and defaults to [`IO::Spec::Unix`](/type/IO/Spec/Unix), regardless of the operating system the code is being run on.
  
  # [In Junction](#___top "go to top of document")[§](#(Junction)_method_new "direct link")
  
  See primary documentation
  [in context](/type/Junction#method_new)
  for **method new**.
  
  ```raku
  multi method new(Junction: \values, Str :$type!)
  multi method new(Junction: Str:D \type, \values)
  ```
  
  These constructors build a new junction from the type that defines it and a set of values.
  
  ```raku
  my $j = Junction.new(<Þor Oðinn Loki>, type => "all");
  my $n = Junction.new( "one", 1..6 )
  ```
  
  The main difference between the two multis is how the type of the `Junction` is passed as an argument; either positionally as the first argument, or as a named argument using `type`.
  
  # [In IO::Path::Win32](#___top "go to top of document")[§](#(IO::Path::Win32)_method_new "direct link")
  
  See primary documentation
  [in context](/type/IO/Path/Win32#method_new)
  for **method new**.
  
  Same as [`IO::Path.new`](/type/IO/Path#method_new), except `:$SPEC` cannot be set and defaults to [`IO::Spec::Win32`](/type/IO/Spec/Win32), regardless of the operating system the code is being run on.
  
  # [In Thread](#___top "go to top of document")[§](#(Thread)_method_new "direct link")
  
  See primary documentation
  [in context](/type/Thread#method_new)
  for **method new**.
  
  ```raku
  method new(:&code!, Bool :$app_lifetime = False, Str :$name = '<anon>' --> Thread:D)
  ```
  
  Creates and returns a new `Thread`, without starting it yet. `&code` is the code that will be run in a separate thread.
  
  `$name` is a user-specified string that identifies the thread.
  
  If `$app_lifetime` is set to `True`, then the thread is killed when the main thread of the process terminates. If set to `False`, the process will only terminate when the thread has finished.
  
  # [In Int](#___top "go to top of document")[§](#(Int)_method_new "direct link")
  
  See primary documentation
  [in context](/type/Int#method_new)
  for **method new**.
  
  ```raku
  multi method new(Any:U $type)
  multi method new(Any:D \value --> Int:D)
  multi method new(int   \value --> Int:D)
  ```
  
  The first form will throw an exception; the second and third form will create a new Int from the actual integer value contained in the variable.
  
  # [In X::NYI](#___top "go to top of document")[§](#(X::NYI)_method_new "direct link")
  
  See primary documentation
  [in context](/type/X/NYI#method_new)
  for **method new**.
  
  ```raku
  method new( :$feature, :$did-you-mean, :$workaround)
  ```
  
  This is the default constructor for `X:NYI` which can take three parameters with obvious meanings.
  
  ```raku
  class Nothing {
      method ventured( $sub, **@args) {
          X::NYI.new( feature => &?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
  
  ```raku
  # OUTPUT:
  # ventured not yet implemented. Sorry.
  # Did you mean: gained?
  # Workaround: Implement it yourself
  #   in method ventured at NYI.raku line 6
  #   in block <unit> at NYI.raku line 14
  
  ```
  
  Using the exception properties, it composes the message that we see there.
  
  # [In DateTime](#___top "go to top of document")[§](#(DateTime)_method_new "direct link")
  
  See primary documentation
  [in context](/type/DateTime#method_new)
  for **method new**.
  
  ```raku
  multi method new(Int :$year!, Int :$month = 1, Int :$day = 1,
                   Int :$hour = 0, Int :$minute = 0, :$second = 0,
                   Int :$timezone = 0, :&formatter)
  multi method new(Date :$date!,
                   Int :$hour = 0, Int :$minute = 0, :$second = 0,
                   Int :$timezone = 0, :&formatter)
  multi method new(Int() $year, Int() $month, Int() $day,
                   Int() $hour, Int $minute, $second,
                   Int() :$timezone = 0, :&formatter)
  multi method new(Instant:D $i,  :$timezone=