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

inline arg/ret #42

Open
skaldesh opened this issue Apr 30, 2020 · 6 comments
Open

inline arg/ret #42

skaldesh opened this issue Apr 30, 2020 · 6 comments
Labels
enhancement New feature or request
Milestone

Comments

@skaldesh
Copy link
Member

If a call has very few arguments / return values, it would be neat to inline them, so that a separate struct is not needed. Example:

call test {
    arg: {  
        id string
    }
}

would now produce the func

Test(ctx context.Context, arg *TestArg) (err error)

which must be called like this

err := client.Test(ctx, &api.TestArg{Id: id})

but if one could inline the arguments:

Test(ctx context.Context, id string) (err error)

the call looks much neater imho

err := client.Test(ctx, id)
@skaldesh skaldesh added the enhancement New feature or request label Apr 30, 2020
@skaldesh
Copy link
Member Author

would be good, if this can be specifically switched on in the .orbit file

@r0l1
Copy link
Member

r0l1 commented May 4, 2020

call test {
    inline: true
    arg: {  
        id string
    }
}

@skaldesh skaldesh added this to the v1.5.0 milestone May 6, 2020
@skaldesh skaldesh modified the milestones: v1.5.0, v1.5.1 Oct 15, 2020
@skaldesh skaldesh modified the milestones: v1.5.1, v1.6.1 Jan 26, 2021
@skaldesh
Copy link
Member Author

skaldesh commented Mar 19, 2021

call test {
    inline: true
    arg: {  
        id string
    }
}

This would require a substantial amount of extra work. If you have many calls/streams you want to inline, you need as many inline: true statements.

How about something we supported earlier:

call test {
    arg: id string
}

This has the disadvantage though that we must also support this:

call test {
    arg: id string `validate:"min=5"`
}

which may be too much magic?

@r0l1
Copy link
Member

r0l1 commented Mar 22, 2021

which may be too much magic?
Seams ok :) Go for it.

@skaldesh
Copy link
Member Author

nice :)

@skaldesh
Copy link
Member Author

its still tricky though, because I could now write arg: id string json:"ID"``, which does not make any sense, as it is no struct anymore

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants