Skip to content

consider unifying value and type cases #1296

@gavinking

Description

@gavinking

In an of clause we write stuff like of x | y | Type. Why can't we write that in a case?

Currently Ceylon forces you to distinguish type cases from value cases using the is keyword, which very occasionally pushes you towards nastiness like this:

case (is \Itrue | \Inull | Foo) { … }

Are there any really compelling reasons to not let you just write:

case (true | null | Foo) { … }

Historically, I think there were some reasons, since I had speculated about a lot of different kind of case conditions, case (satisfies ... ), etc, which we still don't have. Also the syntax for value cases was different to the syntax for union types with the ,s instead of |s.

Right now, I can't really think of much.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions