alvinalexander.com | career | drupal | java | mac | mysql | perl | scala | uml | unix  

Scala example source code file (StdNames.scala)

This example Scala source code file (StdNames.scala) is included in the DevDaily.com "Java Source Code Warehouse" project. The intent of this project is to help you "Learn Java by Example" TM.

Java - Scala tags/keywords

expand_separator_string, librarycommonnames, librarycommonnames, librarytermnames, librarytypenames, module_suffix, nametype, nametype, stdnames, string, string, symbol, termname, termname

The Scala StdNames.scala source code

package scala.reflect
package generic

import scala.reflect.NameTransformer

@deprecated("scala.reflect.generic will be removed", "2.9.1") trait StdNames {
  self: Universe =>

  val nme: LibraryTermNames
  val tpnme: LibraryTypeNames
  
  def encode(str: String): TermName = newTermName(NameTransformer.encode(str))
  
  implicit def stringToTermName(s: String): TermName = newTermName(s)

  trait LibraryCommonNames {
    type NameType <: Name
    implicit def createNameType(name: String): NameType
    
    val EMPTY: NameType              = ""
    val ANON_FUN_NAME: NameType      = "$anonfun"
    val EMPTY_PACKAGE_NAME: NameType = "<empty>"
    val IMPORT: NameType             = "<import>"
    val MODULE_SUFFIX: NameType      = "$module"
    val ROOT: NameType               = "<root>"
  }
  
  trait LibraryTermNames extends LibraryCommonNames {
    val EXPAND_SEPARATOR_STRING = "$$"
    val LOCAL_SUFFIX_STRING     = " "
    val ROOTPKG: NameType       = "_root_"

    /** The expanded name of `name' relative to this class `base` with given `separator` 
     */
    def expandedName(name: TermName, base: Symbol, separator: String = EXPAND_SEPARATOR_STRING): TermName = 
      newTermName(base.fullName('$') + separator + name)
      
    def moduleVarName(name: TermName): TermName = newTermName("" + name + MODULE_SUFFIX)
  }
  trait LibraryTypeNames extends LibraryCommonNames {
    val REFINE_CLASS_NAME: NameType  = "<refinement>"
    val ANON_CLASS_NAME: NameType    = "$anon"
  }
}

Other Scala examples (source code examples)

Here is a short list of links related to this Scala StdNames.scala source code file:

... this post is sponsored by my books ...

#1 New Release!

FP Best Seller

 

new blog posts

 

Copyright 1998-2024 Alvin Alexander, alvinalexander.com
All Rights Reserved.

A percentage of advertising revenue from
pages under the /java/jwarehouse URI on this website is
paid back to open source projects.