menu
techminis

A naukri.com initiative

google-web-stories
Home

>

Programming News

>

Scala in t...
source image

Medium

1w

read

152

img
dot

Scala in the Boudoir: Lifting the Veil on Opaque Types and Exporting Our Secrets

  • Opaque types allow developers to wrap common primitive types, such as Int or String, to ensure that different concepts are not accidentally interchanged.
  • They provide a way to hide the logic or data associated with a type, exposing only controlled extension methods and maintaining full control over how the type is used.
  • Extension methods for opaque types can be placed in a separate object, allowing for selective importing and isolation from other methods with the same name.
  • Exporting extension methods using 'export' keyword brings them into scope and allows them to be called.

Read Full Article

like

9 Likes

For uninterrupted reading, download the app