|
Scala example source code file (MutableSettings.scala)
The MutableSettings.scala Scala example source code/* NSC -- new Scala compiler * Copyright 2005-2013 LAMP/EPFL * @author Martin Odersky */ // $Id$ package scala package reflect.internal package settings /** A mutable Settings object. */ abstract class MutableSettings extends AbsSettings { type Setting <: SettingValue type BooleanSetting <: Setting { type T = Boolean } type IntSetting <: Setting { type T = Int } type MultiStringSetting <: Setting { type T = List[String] } // basically this is a value which remembers if it's been modified trait SettingValue extends AbsSettingValue { protected var v: T protected var setByUser: Boolean = false def postSetHook(): Unit = () def isDefault = !setByUser def isSetByUser = setByUser def value: T = v def value_=(arg: T) = { setByUser = true v = arg postSetHook() } } def Xexperimental: BooleanSetting def XfullLubs: BooleanSetting def XnoPatmatAnalysis: BooleanSetting def Xprintpos: BooleanSetting def strictInference: BooleanSetting def Yposdebug: BooleanSetting def Yrangepos: BooleanSetting def Yshowsymowners: BooleanSetting def Yshowsymkinds: BooleanSetting def breakCycles: BooleanSetting def debug: BooleanSetting def developer: BooleanSetting def explaintypes: BooleanSetting def overrideObjects: BooleanSetting def printtypes: BooleanSetting def uniqid: BooleanSetting def verbose: BooleanSetting def Yrecursion: IntSetting def maxClassfileName: IntSetting def isScala211: Boolean } object MutableSettings { import scala.language.implicitConversions /** Support the common use case, `if (settings.debug) println("Hello, martin.")` */ @inline implicit def reflectSettingToBoolean(s: MutableSettings#BooleanSetting): Boolean = s.value } Other Scala source code examplesHere is a short list of links related to this Scala MutableSettings.scala source code file: |
... this post is sponsored by my books ... | |
#1 New Release! |
FP Best Seller |
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.