Parameters

Learn how to define parameters in Slice.

The syntax and semantics of tagged parameters is the same as the syntax and semantics of tagged fields. The scope of a tag number within an operation is the parameter list or return type that contains the tagged parameter. It doesn't encroach on the scope of other tagged parameters or fields.

For example, the following Slice definitions are valid since all tag(1) are in different tag scopes:

slice
interface SingingGreeter {
// Creates a personalized greeting and a song.
greet(
name: string
tag(1) timeOfDay: TimeOfDay?
) -> (
greeting: string
tag(1) song: Sequence<uint8>?
)
}

An operation parameter name: Type is mapped to a C# parameter with the same name, with name converted to camel case. The type of the C# parameter is the mapped C# type for Type. For example, an int32 parameter is mapped to an int parameter in C#, as described in Primitive types.

A return parameter name: Type is mapped to a C# return tuple field with the same name, with name converted to Pascal case. The type of the C# field is the mapped C# type for Type.

Tagged parameters are mapped just like regular parameters. The tag and tag number don't appear in the mapped C# API.

Was this page helpful?