Skip to content

Conflicting language around type annotations in strict syntax documentation #5900

Open
@keysmashes

Description

@keysmashes

The new documentation about strict syntax states that when you use def, you must not include a type annotation:

In the strict syntax, variables must be declared with `def` and must not specify a type:

However, a later example includes a type annotation, and even states they they are preferred over as-casts:

In the strict syntax, only hard casts are supported. However, hard casts are discouraged because they can cause unexpected behavior if used improperly. Groovy-style type annotations should be used instead:
```groovy
def Map map = readJson(json)
```

There is a note that type annotations will be addressed properly in the future:

Because type annotations are useful for providing type checking at runtime, the language server will not report errors for Groovy-style type annotations at this time. Type annotations will be addressed in a future version of the Nextflow language specification.

but this only mentions that the language server will not produce an error – should this instead say that Nextflow as a whole will accept type annotations at the moment? (but, for example, that they are discouraged and may cause an error in the future, if that is the case?)

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions