zed
zed copied to clipboard
"Strict mode" for Zed language
tl;dr
Zed may benefit from having a "strict mode" option that requires programs to be written in canonical form (#2197) in order to be parsed and executed.
Details
Zed's shorthand such as implied operators and implied field references allow for handy shorthand many users appreciate, especially when writing quick one-line queries. However, this contrasts with environments where multiple users may be collaborating on long Zed ETL pipelines that are maintained in version control systems and run in mission critical infrastructure. In these situations, the kinds of mistakes that can come from writing shorthand Zed may be seen more as a hazard than a convenience.
There's precedent here in the form of the use strict
directives in languages like JavaScript and Perl. If something similar were made available in Zed, it could require that a given program be written entirely using canonical Zed in order to be parsed and executed. Therefore a collaborative environment like the one above could adopt a convention that "all our Zed is written in strict mode".