Last active
February 3, 2026 20:26
-
-
Save dacr/c4842a95218ebd21bbdc49fa5b0b3852 to your computer and use it in GitHub Desktop.
scala3 macro examples - basic / published by https://github.com/dacr/code-examples-manager #e6698631-4a91-4982-9c5a-aae0b9f91f25/b09c649254bddbc2b0372364f7f1429135381a7a
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 macro examples - basic | |
| // keywords : scala3, tutorial, macro, @testable | |
| // publish : gist | |
| // authors : David Crosson | |
| // license : Apache License Version 2.0 (https://www.apache.org/licenses/LICENSE-2.0.txt) | |
| // id : e6698631-4a91-4982-9c5a-aae0b9f91f25 | |
| // created-on : 2023-08-10T15:25:31+02:00 | |
| // managed-by : https://github.com/dacr/code-examples-manager | |
| // run-with : scala-cli $file | |
| // Some resources | |
| // https://medium.com/codex/scala-3-macros-without-pain-ce54d116880a | |
| inline val valueEvaluatedAtCompileTime = 42d * math.Pi | |
| println(s"42*PI = $valueEvaluatedAtCompileTime") | |
| inline def upper(inline str: String) = str.toUpperCase | |
| println(s"An uppercase string : ${upper("hello world")}") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment