arthurfiorette / proposal-safe-assignment-operator

Draft for ECMAScript Error Safe Assignment Operator
https://arthur.run/proposal-safe-assignment-operator/
MIT License
1.44k stars 16 forks source link

Using Colon #34

Open itsabgr opened 2 months ago

itsabgr commented 2 months ago

Using ?= a bit confusing. The := operator, like in Go, is a better option.

arthurfiorette commented 2 months ago

Hmm, that's also a good idea.

But i think this proposal is leaning towards a "operator" like void or throw than a assignment operator that could only be used within code blocks.

itsabgr commented 2 months ago

What about something like


const [error, response] = try {
 return await fetch("https://arthur.place")
}

or


const [error, response] = try await fetch("https://arthur.place")

?