BUG: function name erasure
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Idoneità per principianti
- 35/100
- Tipo di issue
- Bug
- Chiarezza
- Abbastanza chiara
- Stato di attività
- Ferma
- Stack tecnologico
- javascript, python
- Ambito
- compilers
Direzione di ricerca
Compare the Python example with the generated JavaScript shown in the issue, focusing on how function names are emitted. The work is done when translated functions retain their names so that StateFun.increment.name and similar reflection calls return the original function name.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
- the following python:
class StateFun:
@staticmethod
def increment(state, *_) -> None:
state.count += 1
@staticmethod
def decrement(state, *_) -> None:
state.count -= 1
- is translated as javascript with anonymous functions:
export var StateFun = __class__ ('StateFun', [object], {
__module__: __name__,
get increment () {return function (state) {
var _ = tuple ([].slice.apply (arguments).slice (1));
state.count++;
};},
get decrement () {return function (state) {
var _ = tuple ([].slice.apply (arguments).slice (1));
state.count--;
};},
});
- which makes it hard to recover function name for reflection:
function (args) {...}
console.log(StateFun.increment.name) # will print "undefined"
- instead, it should use named functions everywhere:
function <NAME-HERE> (args) {...}
console.log(StateFun.increment.name) # will print "increment"
- Lingua principale
- Python
- Stelle
- 2.9k
- Fork
- 218
- Metriche di merge delle PR
- Nessuna PR unita negli ultimi 30g
Guida per i contributori
Nessuna guida per i contributori indicizzata per questo repository
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 TranscryptOrg/Transcrypt
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 84/100
TranscryptOrg/Transcrypt#913 ·
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 88/100
TranscryptOrg/Transcrypt#911 · 2 commenti ·
-
IS: bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 70/100
TranscryptOrg/Transcrypt#908 ·
-
SUB: documentation
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 62/100
TranscryptOrg/Transcrypt#656 · 7 commenti ·
-
Difficoltà 3/5 1-2 giorni Idoneità per principianti 76/100
TranscryptOrg/Transcrypt#914 ·
Tutte le issue di TranscryptOrg/Transcrypt
Issue simili
-
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 90/100
-
bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 86/100
zostera/django-bootstrap4#894 ·
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
use-agent-os/agent-os#3276 ·
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 88/100
zephyrproject-rtos/zephyr#119726 ·
-
area/auth bug comp/agent P3 platform/discord type/security
Difficoltà 2/5 1-3 ore Idoneità per principianti 88/100
NousResearch/hermes-agent#117848 ·