Last active
May 25, 2024 10:18
-
-
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
This file contains hidden or 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.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