| career | drupal | java | mac | mysql | perl | scala | uml | unix  

Scala example source code file (Transforms.scala)

This example Scala source code file (Transforms.scala) is included in my "Source Code Warehouse" project. The intent of this project is to help you more easily find Scala source code examples by using tags.

All credit for the original source code belongs to; I'm just trying to make examples easier to find. (For my Scala work, see my Scala examples and tutorials.)

Scala tags/keywords

erasure, lazy, posterasure, refchecks, symbol, symboltable, t, transforms, type, uncurry

The Transforms.scala Scala example source code

package scala
package reflect
package internal
package transform

import scala.language.existentials

trait Transforms { self: SymbolTable =>

  /** We need to encode laziness by hand here because the three components refChecks, uncurry and erasure
   *  are overwritten by objects in Global.
   *  It would be best of objects could override lazy values. See SI-5187.
   *  In the absence of this, the Lazy functionality should probably be somewhere
   *  in the standard library. Or is it already?
  private class Lazy[T](op: => T) {
    private var value: T = _
    private var _isDefined = false
    def isDefined = _isDefined
    def force: T = {
      if (!isDefined) { value = op; _isDefined = true }

  private val refChecksLazy = new Lazy(new { val global: Transforms.this.type = self } with RefChecks)
  private val uncurryLazy = new Lazy(new { val global: Transforms.this.type = self } with UnCurry)
  private val erasureLazy = new Lazy(new { val global: Transforms.this.type = self } with Erasure)
  private val postErasureLazy = new Lazy(new { val global: Transforms.this.type = self } with PostErasure)

  def refChecks = refChecksLazy.force
  def uncurry = uncurryLazy.force
  def erasure = erasureLazy.force
  def postErasure = postErasureLazy.force

  def transformedType(sym: Symbol) =

  def transformedType(tpe: Type) =


Other Scala source code examples

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

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

#1 New Release!

FP Best Seller


new blog posts


Copyright 1998-2021 Alvin Alexander,
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.