Skip to content

Instantly share code, notes, and snippets.

@dacr
Last active May 25, 2024 10:18
Show Gist options
  • Save dacr/96f869e2c59de1cfaed82df02c77611b to your computer and use it in GitHub Desktop.
Save dacr/96f869e2c59de1cfaed82df02c77611b to your computer and use it in GitHub Desktop.
scala3 feature examples - export / published by https://github.com/dacr/code-examples-manager #fbc5ddb5-ab99-4e12-a5d2-e33c4d19edab/1b1a8427231bf73d362e6e4b0fe2a02a5915ae45
// summary : scala3 feature examples - export
// keywords : scala3, tutorial, macros, export, meta-programming
// publish : gist
// authors : David Crosson
// license : Apache NON-AI License Version 2.0 (https://raw.githubusercontent.com/non-ai-licenses/non-ai-licenses/main/NON-AI-APACHE2)
// id : fbc5ddb5-ab99-4e12-a5d2-e33c4d19edab
// created-on : 2021-12-21T15:01:34+01:00
// managed-by : https://github.com/dacr/code-examples-manager
// run-with : scala-cli $file
// Inspired from https://www.youtube.com/watch?v=OPBuCQRgyV4&t=1283s from Josh Suereth
//> using scala "3.4.2"
case class Somewhere(town: String):
export town.isEmpty
export town.{endsWith => `ends-with`}
@main def go() =
val place = Somewhere("Here")
println(place.isEmpty())
println(place.`ends-with`("re"))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment