Skip to content

call_statement: should only be able to call a function that yields void? #1413

Description

@dneto0

That can catch some programming errors.

If you really want to call a value-producing function at statement level, only for its side effects, then you can always capture its result in a const-declaration.

  const toss_it: T = CallForSideEffects();

Or

  const _ := CallForSideEffects();  // if we have type deduction

  _  := CallForSideEffects();  // even more aggressive throwaway with type deduction

  // Invent a void-constructor  explicitly for this purpose. 
  // It's a sink for values, producing void.
  void(CallForSideEffects());  

Activity

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

Metadata

Metadata

Assignees

Labels

wgslWebGPU Shading Language Issues

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions