Skip to content
This repository has been archived by the owner on Nov 18, 2020. It is now read-only.

dimastark/proposal-shut-up

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 

Repository files navigation

Shut-up Operator @

Motivation

We all love good old JavaECMAScript. And we all want to write code the way our ancestors did. Without fear of suddenly appearing exceptions, type errors and undefined is not a function.

Best practices from Vanilla ES:

  • There is no "division by zero error", only Infinity
  • There is no errors in parseInt('💩'), only NaN
  • There is no "reference error", only undefined

And that's really beautiful...

Why not generalize this practices and silence all these annoying errors? Just use "shut-up" operator @.

Usage examples

No need to check input arguments.

function f(callback) {
    callback('result');
}

// Haters gonna hate
@f(undefined);

No uncontrolled exceptions.

// Bye-bye "Cannot read property"
@(null.is.safe.now);

Unlimited power.

'use strict';  // Pfftt, @ don't care

@(true.value = 1);

Just add @.

Potential problems

  • Conflicting syntax with decorators. But who needs decorators, if you have such a feature as @ operator.
  • Maybe too powerful for mere mortals.

Other languages

About

No description or website provided.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published