Trait

scala.reflect.macros

Names

Related Doc: package macros

Permalink

trait Names extends AnyRef

EXPERIMENTAL

A slice of the Scala macros context that provides functions that generate fresh names.

In the current implementation, fresh names are more or less unique in the sense that within the same compilation run they are guaranteed not to clash with: 1) Results of past and future invocations of functions of freshName family 2) User-defined or macro-generated names that don't contain dollar symbols 3) Macro-generated names that are created by concatenating names from the first, second and third categories

Uniqueness of fresh names across compilation runs is not guaranteed, but that's something that we would like to improve upon in future releases. See https://issues.scala-lang.org/browse/SI-6879 for more information.

Self Type
blackbox.Context
Source
Names.scala
Linear Supertypes
Known Subclasses
Type Hierarchy
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. Names
  2. AnyRef
  3. Any
Implicitly
  1. by any2stringadd
  2. by StringFormat
  3. by Ensuring
  4. by ArrowAssoc
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. All

Abstract Value Members

  1. abstract def freshName[NameType <: blackbox.Context.Name](name: NameType): NameType

    Permalink

    Creates a more or less unique name having a given name as a prefix and having the same flavor (term name or type name) as the given name.

    Creates a more or less unique name having a given name as a prefix and having the same flavor (term name or type name) as the given name. Consult scala.reflect.macros.Names for more information on uniqueness of such names.

  2. abstract def freshName(name: String): String

    Permalink

    Creates a string that represents a more or less unique name having a given prefix.

    Creates a string that represents a more or less unique name having a given prefix. Consult scala.reflect.macros.Names for more information on uniqueness of such names.

  3. abstract def freshName(): String

    Permalink

    Creates a string that represents a more or less unique name.

    Creates a string that represents a more or less unique name. Consult scala.reflect.macros.Names for more information on uniqueness of such names.

  4. abstract def fresh[NameType <: blackbox.Context.Name](name: NameType): NameType

    Permalink

    Creates a more or less unique name having a given name as a prefix and having the same flavor (term name or type name) as the given name.

    Creates a more or less unique name having a given name as a prefix and having the same flavor (term name or type name) as the given name. Consult scala.reflect.macros.Names for more information on uniqueness of such names.

    Annotations
    @deprecated
    Deprecated

    (Since version 2.11.0) Use freshName instead

  5. abstract def fresh(name: String): String

    Permalink

    Creates a string that represents a more or less unique name having a given prefix.

    Creates a string that represents a more or less unique name having a given prefix. Consult scala.reflect.macros.Names for more information on uniqueness of such names.

    Annotations
    @deprecated
    Deprecated

    (Since version 2.11.0) Use freshName instead

  6. abstract def fresh(): String

    Permalink

    Creates a string that represents a more or less unique name.

    Creates a string that represents a more or less unique name. Consult scala.reflect.macros.Names for more information on uniqueness of such names.

    Annotations
    @deprecated
    Deprecated

    (Since version 2.11.0) Use freshName instead