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

Redesign Kotlin verb "interface" #803

Closed
alecthomas opened this issue Jan 17, 2024 · 0 comments · Fixed by #916
Closed

Redesign Kotlin verb "interface" #803

alecthomas opened this issue Jan 17, 2024 · 0 comments · Fixed by #916
Assignees

Comments

@alecthomas
Copy link
Collaborator

alecthomas commented Jan 17, 2024

Currently verbs have to be in a class and there can be multiple. This is a bit weird given how we want verbs to be seen as stateless single units.

Proposal is to make verbs top-level functions, rather than member functions of a module class. Modules will be declared with a file-level annotation, like in Go. The module name will be derived from the package name (as is the case presently).

@file:Module
package ftl.exemplar

import xyz.block.ftl.Module
import xyz.block.ftl.Verb

data class Request(val value: String)
data class Response(val status: String)

@Verb
fun something(context: Context, req: Request): Response {
  ...
}
@github-project-automation github-project-automation bot moved this to Todo in FTL Jan 17, 2024
@worstell worstell self-assigned this Jan 18, 2024
@alecthomas alecthomas changed the title Redesign Kotlin verb "interface" (@worstell) Redesign Kotlin verb "interface" Feb 7, 2024
@alecthomas alecthomas mentioned this issue Feb 7, 2024
worstell added a commit that referenced this issue Feb 10, 2024
fixes #803

with this change, verbs in kotlin are defined as top-level functions rather than class member functions. this change also introduces the `Module` file annotation in Kotlin,
which will be used to declare an FTL module as the package of the annotated file.
worstell added a commit that referenced this issue Feb 10, 2024
fixes #803

with this change, verbs in kotlin are defined as top-level functions rather than class member functions. this change also introduces the `Module` file annotation in Kotlin,
which will be used to declare an FTL module as the package of the annotated file.
worstell added a commit that referenced this issue Feb 10, 2024
fixes #803

with this change, verbs in kotlin are defined as top-level functions rather than class member functions. this change also introduces the `Module` file annotation in Kotlin,
which will be used to declare an FTL module as the package of the annotated file.
worstell added a commit that referenced this issue Feb 10, 2024
fixes #803

with this change, verbs in kotlin are defined as top-level functions rather than class member functions. this change also introduces the `Module` file annotation in Kotlin,
which will be used to declare an FTL module as the package of the annotated file.
worstell added a commit that referenced this issue Feb 11, 2024
fixes #803

with this change, verbs in kotlin are defined as top-level functions rather than class member functions. this change also introduces the `Module` file annotation in Kotlin,
which will be used to declare an FTL module as the package of the annotated file.
worstell added a commit that referenced this issue Feb 11, 2024
fixes #803

with this change, verbs in kotlin are defined as top-level functions rather than class member functions. this change also introduces the `Module` file annotation in Kotlin,
which will be used to declare an FTL module as the package of the annotated file.
worstell added a commit that referenced this issue Feb 11, 2024
fixes #803

with this change, verbs in kotlin are defined as top-level functions
rather than class member functions
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

Successfully merging a pull request may close this issue.

2 participants