Skip to content

Should we drop inline if syntax? #9765

Closed
@nicolasstucki

Description

@nicolasstucki

With the scala.compiletime.requireConst in #9764 the inline if concept becomes redundant.
const trivially subsume all use-cases of inline if with no extra syntactic overhead

- inline if n == 0 then ... 
- else inline if n % 2 == 0 then ...
+ if requireConst(n == 0) then ...
+ else if requireConst(n % 2 == 0) then ...
else

Using const has also the advantage of linking to some documentation in the IDE and is more consistent with the other compile-time operations such as summonInline.

Advantages

  • Less special syntax
  • Most inline operations will be found by looking in scala.compiletime
  • Easier to read else ifs

Disadvantages

  • Legacy code

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions