-
Notifications
You must be signed in to change notification settings - Fork 6
try only #6
Comments
try {
....code
} finally {
....code
} is already legal. Moreover, it has the semantics of not swallowing the error, but rather propagating it; this establishes the precedent that omitting the (This precedent is also seen in languages where you can have conditional catch clauses: if you have some number of conditional catch clauses and an error matches none of them, it propagates.) Edit, 2018-06-15: For posterity, I want to note that Julia supported try-without-catch and has since deprecated it for the reason given here. |
@bakkot @michaelficarra well then what about
? |
@Mouvedia this feature is already landed in ES2019; however, i suspect your suggestion would run into trouble with ASI. Additionally, how would you have multiple statements in a |
Good.
Sorry but, could you explain what you mean by " |
@Mouvedia ah, are you asking if the That seems like it'd be inconsistent with the rest of the language unless you could have an empty |
Yes, I though my example was clear enough. My bad I should have been explicit.
I don't think you can make a parallel for all of these. Only do/while could be considered somewhat similar.
|
That sounds like a different proposal; I'd encourage you to write one up and email it to es-discuss :-) |
As far as I can tell, this is all about
but what about situations that we want to run some code and simply do not care about errors occurring at all?
or
I would think there are plenty of situations like that that occur.
My apologies if this is already implemented in some way that I am unaware of.
The text was updated successfully, but these errors were encountered: