Abstract
The Marker Trait pattern uses traits that declare no methods, functions, types or properties to indicate additional semantics of a type (class, object or further traits). An alternative could be to use annotations, however annotations are not part of the type system of Scala, and thus can only provide additional semantic meaning where as a Marker trait also adds the ability to be treated as part of Scala the type system.
Access this chapter
Tax calculation will be finalised at checkout
Purchases are for personal use only
Author information
Authors and Affiliations
Rights and permissions
Copyright information
© 2013 Springer International Publishing Switzerland
About this chapter
Cite this chapter
Hunt, J. (2013). Marker Trait. In: Scala Design Patterns. Springer, Cham. https://doi.org/10.1007/978-3-319-02192-8_6
Download citation
DOI: https://doi.org/10.1007/978-3-319-02192-8_6
Published:
Publisher Name: Springer, Cham
Print ISBN: 978-3-319-02191-1
Online ISBN: 978-3-319-02192-8
eBook Packages: Computer ScienceComputer Science (R0)