Last active
February 3, 2026 20: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/41f2d4d35aa4271b027f63ae024318ca368a7339
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 License Version 2.0 (https://www.apache.org/licenses/LICENSE-2.0.txt) | |
| // 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