Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change return values to singleton strings #46

Open
soronpo opened this issue Apr 17, 2018 · 0 comments
Open

Change return values to singleton strings #46

soronpo opened this issue Apr 17, 2018 · 0 comments

Comments

@soronpo
Copy link

soronpo commented Apr 17, 2018

If the string values returned will be singleton values (<: String with Singleton), then it's possible to perform more string operations at compile-time (using singleton-ops), and possibly even enforce naming conventions. E.g.:

def foo(implicit n: sourcecode.Name.Aux[N], check: RequireMsg[Substring[N, 3]=="Fun", "Name must start with Fun"] : Unit = {}
val Fun1 = foo //OK
val fun2 = foo //Error: "Name must start with Fun"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant