Ask for Feedback: Make `JSObject` / `JSFunction` calls be `throws`
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 5/5
- Tempo stimato
- Più di una settimana
- Idoneità per principianti
- 25/100
- Tipo di issue
- Funzionalità
- Chiarezza
- Da chiarire
- Stato di attività
- Ferma
- Stack tecnologico
- javascript, swift, wasm
- Ambito
- api
Direzione di ricerca
La issue indica JSObject e JSFunction come le API interessate, ma non fornisce alcun file né punto di ingresso per i test. Esamina le loro implementazioni delle chiamate e il comportamento esistente di .throws/.throwing, quindi misura il compromesso in termini di prestazioni e definisci test per le chiamate che generano eccezioni e per quelle che non le generano prima di decidere la modifica incompatibile dell’API.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Every dynamic JS function calls can throw an exception, but the current JSObject and JSFunction are non-throws by default.
They can be throws by .throws or .throwing but it's still opt-in.
For example, if an exception is thrown during a JS function call but the call site in Swift side is not throws, the control unwinding wasm call frames without executing function epilogues even if there is do { } catch {} clause in Swift. And also in that case, defer blocks won't be called.
This behavior is quite tricky and unwinding wasm call frames without executing function epilogues can lead to memory and resource leak.
I'm going to introduce an API breaking change to make JSObject / JSFunction calls be throws in the next next release to improve the situation.
This change has a performance tradeoff as throws variants are typically a little bit slower than non-throwing variants. We should measure the amount of the penalty but it shouldn't be a big deal. We can make non throwing calls as an opt-in feature so that those who want best performance can satisfy their needs.
// Before
let foo = JSObject.global.document.getElementById!("foo")
let foo = try JSObject.global.document.throwing.getElementById!("foo")
// After
let foo = try JSObject.global.document.getElementById!("foo")
let foo = JSObject.global.document.nonthrowing.getElementById!("foo")
Let me know here if you have a strong objection 🙏 Thanks.
- Lingua principale
- Swift
- Stelle
- 986
- Fork
- 76
- Merge medio
- 21h 11m
- PR unite (30g)
- 4
Guida per i contributori
Apri la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di swiftwasm/JavaScriptKit
-
Difficoltà 3/5 1-2 giorni Idoneità per principianti 55/100
swiftwasm/JavaScriptKit#793 ·
-
swiftwasm/JavaScriptKit#785 · 1 assegnatario ·
-
[SwiftBuild] Preserve duplicate archive members when SwiftBuild expands static archives for linking Aperta
Difficoltà 4/5 3-5 giorni Idoneità per principianti 48/100
swiftwasm/JavaScriptKit#781 · 3 commenti ·
-
Difficoltà 4/5 3-5 giorni Idoneità per principianti 25/100
swiftwasm/JavaScriptKit#773 ·
-
swiftwasm/JavaScriptKit#767 · 1 assegnatario ·
Tutte le issue di swiftwasm/JavaScriptKit
Issue simili
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 88/100
manaflow-ai/cmux#13763 ·
-
type: feature request
Difficoltà 2/5 1-3 ore Idoneità per principianti 82/100
googleapis/google-cloud-swift#1036 · 1 commento ·
-
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 78/100
wultra/mtoken-sdk-ios#253 ·
-
The correction-threshold rationale says 17 restraint cases collide; the current corpus has 16 Apertaarea:dictation documentation P2
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
uttrflow/uttrflow-swift#1180 ·
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100