f-string interpolation calls `str` by name, so a user binding named `str` changes every f-string
Los mantenedores suelen responder en 1 día
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 4/5
- Tiempo estimado
- 3-5 días
- Aptitud para principiantes
- 68/100
- Tipo de issue
- Error
- Claridad
- Bien especificado
- Estado de actividad
- Activo
- Stack tecnológico
- c
- Área
- compilers, testing-qa
Línea de trabajo
Start in the f-string block of src/lexer.c and inspect the lowering used by the VM, then compare the ouroboros frontend/AOT path. Run the two reproductions with EIGS_JIT_OFF=1 and use tests/test_fstrings.eigs as the regression-test entry point. Done means the global, defined, and function-local str cases produce the specified result or fail loudly, with both lowering paths aligned.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
The lexer lowers f"a{e}b" to ("a" + (str of (e)) + "b") using an ordinary TOK_IDENT "str" (src/lexer.c, f-string block). That identifier is resolved like any other name at run time. A program that binds str therefore changes, or breaks, every f-string evaluated in that scope. Nothing in the source of the f-string mentions str.
Reproduce (origin/main 94c4c5b, release build)
define str(x) as:
return "HIJACK"
print of f"<{5}>"
Actual: exit 0, stdout <HIJACK>. Expected: <5> (or a loud error, if rebinding str is to be forbidden).
str is 3
print of f"<{str}>"
Actual: exit 1, Error line 2: cannot call num. The failing call is one the user never wrote.
The first case is a silent wrong answer (PRINCIPLES.md §2). A str local inside a function body does the same thing to every f-string in that function.
Done when
- f-string interpolation converts values with the builtin conversion no matter what
stris bound to in the enclosing scopes (for example, a dedicated opcode or a reserved internal name the user cannot bind). The alternative is a decision, recorded here, that rebindingstris an error. - Both programs above print
<5>and<3>(or fail loudly at the rebinding, if that is the decision), under the VM and withEIGS_JIT_OFF=1. - A regression in
tests/test_fstrings.eigscovers a globalstr, adefine str, and a function-localstr. - The ouroboros frontend/AOT mirror whatever lowering is chosen (it lowers f-strings the same way).
Found while fixing #1244, where the synthetic str token is now marked as having no source span so LSP rename never edits it; this issue is about the runtime meaning of that token.
- Lenguaje dominante
- C
- Estrellas
- 3
- Forks
- 7
- Merge medio
- 4 h 7 min
- PR fusionados (30 d)
- 112
Preparar el entorno
Inicia el contenedor de desarrollo del proyecto en tu navegador, con tu propia cuenta de GitHub.
- Incluye un Dockerfile o un archivo de Docker Compose
- Tiene una plantilla de pull request
- Leer la guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de InauguralSystems/EigenScript
-
area:embed kind:silent-wrong
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
InauguralSystems/EigenScript#1387 ·
Los mantenedores suelen responder en 1 día
-
area:stdlib kind:silent-wrong
Dificultad 2/5 1-3 horas Aptitud para principiantes 86/100
InauguralSystems/EigenScript#1378 ·
Los mantenedores suelen responder en 1 día
-
area:gates kind:gate-defect
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
InauguralSystems/EigenScript#1374 ·
Los mantenedores suelen responder en 1 día
-
Error carets pad multi-byte UTF-8 byte-for-byte, so the ^ lands right of the token on a terminalAbiertoarea:lint-tooling kind:silent-wrong
Dificultad 2/5 1-3 horas Aptitud para principiantes 84/100
InauguralSystems/EigenScript#1373 ·
Los mantenedores suelen responder en 1 día
-
area:gates kind:docs-drift
Dificultad 1/5 Menos de una hora Aptitud para principiantes 88/100
InauguralSystems/EigenScript#1372 ·
Los mantenedores suelen responder en 1 día
Todos los issues de InauguralSystems/EigenScript
Issues similares
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 90/100
BasedHardware/omi#19711 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 85/100
microsoft/ebpf-for-windows#5604 ·
Los mantenedores suelen responder en 3 días
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 68/100
trezor/trezor-firmware#7985 ·
Los mantenedores suelen responder en 2 días
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 84/100
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 70/100
Los mantenedores suelen responder en 2 días