Skip to content

semantics with statics and prefixes #10

Description

@sigmundch

The current semantics of exp?.x are described in terms of evaluating this:

((a) => a == null ? null : a.x)(exp)

Because static fields cannot be read as instance members, this implies that we cannot use ?. with statics. Similarly, because we don't have first class libraries, we cannot use ?. with prefixes either.

This seems to match what the 07 test in conditional_property_access_test.dart checks, but I wanted to confirm before I implement this in dart2js.

This surprised me a little bit though. I was expecting that C?.x would be valid, it would issue a warning (e.g. "null-aware operators are not useful with statics"), but would otherwise execute as if the user had written C.x.

@gbracha @stereotype441 - what are your thoughts on switching to the latter?

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions