Last active
April 2, 2023 10:11
Star
You must be signed in to star a gist
scala3 feature examples - export / published by https://github.com/dacr/code-examples-manager #fbc5ddb5-ab99-4e12-a5d2-e33c4d19edab/1f250fc9ec3f2c0c425a758c7f01bd54cef64379
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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.1.1" | |
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