Skip to content

omit assert under --optimize; introduce@check macro? #10614

@StefanKarpinski

Description

@StefanKarpinski

People often use @assert in their code to check that functions are being used correctly. It's typical in other systems to eliminate assertions under higher optimization levels. Should we do that under --optimize? If assertions are ignored (compiled to no-ops) but also used to check correct usage – as opposed to checking the correctness of internal logic – then this can accidentally introduce a dangerous lack of argument checking. So perhaps we should introduce a @check macro that is not eliminated by --optimize and is intended for checking usage as opposed to internal correctness.

Metadata

Metadata

Assignees

No one assigned

    Labels

    error handlingHandling of exceptions by Julia or the user

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions