Modulo Operator %%

Michael Haufe tno at thenewobjective.com
Wed Aug 14 03:32:15 UTC 2019


On 8/13/19 7:27 AM, Michael Haufe wrote:
> I would prefer the syntax be ‘a mod b’ consistent with my wishlist item:

On 8/13/19 9:12 PM, Waldemar Horwat wrote:
> This can bring up various syntactic troubles.  What does the following do?
>
> let mod
> +3
>
> Is it calling the mod operator on the variable named "let" and +3?  Or is it defining a variable named "mod" with no initializer, followed by an expression?

I can't declare 'let' or 'var' as variable names, but even if I could (Say non-strict mode or ES3) that form would be a VariableDeclaration followed by an ExpressionStatement.

The proposed grammar extension is:

MultiplicativeOperator: one of
    * / % div mod

Michael


More information about the es-discuss mailing list