\/

class \/ extends Request

VOID Request Type

Scalqa supports a concept of "void object" ("empty object"), which can be defined for many types. This is similar to Null Object Pattern

Unlike 'null', void object can have methods invoked, getting some behavior pertinent to 'voidness'

Examples:

  • Void stream can be a singleton empty stream, which can be re-used for any type
  • Void String is a string of zero length, which can be re-used for String type instead of null

Types with void values have to define implicit conversions from \/

class Foo

object Foo{
 val void = new Foo with Gen.Void

 implicit inline def implicitRequest(inline v: \/): Foo = void
}

var v: Foo = \/   // Standard void assignment

\/ is a shortcut to assign empty implementations for many types

var s: ~[Int]       = \/     // Assigning empty stream of Ints
var o: Opt[String]  = \/     // Assigning empty optional value of String
var i: Long.Idx     = \/     // Assigning empty indexed collection of Long

Also see Any.Gen.Void

A standard way to test for voidness is universal .isVoid method.

Source
VOID.scala
class Request
class java.lang.Object
trait scala.Matchable
class Any
object \/