-
Notifications
You must be signed in to change notification settings - Fork 34
Emit the type declaration file #654
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
- Now every .pln file compiled generates a .ptf file along with the target one - There isnow an option to only print the types, generating no files
|
Qual é a diferença entre aquelas funções lá do type_extractor e coisas como a types.tostring do types.T? |
Há algumas:
Em suma, |
|
Ok! Acho que seria uma boa ideia falar disso num comentário no código.Em 19 de nov. de 2025 3:24 PM, Igor de Araujo Vilhalba ***@***.***> escreveu:igrvlhlb left a comment (pallene-lang/pallene#654)
Qual é a diferença entre aquelas funções lá do type_extractor e coisas como a types.tostring do types.T?
Há algumas:
ao passar uma função types.tostring() a saída é function <paramtypes> -> <rettypes>; no type_extractor nós geramos a representação ( <paramtypes> ) -> <rettypes> (parênteses opcionais a depender da quantidade de parâmetros)os campos das tables não são ordenados para impressão no type_extractorem types.tostring(), ao receber um Record, a saída é só seu nome. No type_extractor imprimimos seus nomes de campos e respectivos tiposEm types.tostring(), ao receber um tipo Alias, fiz com que a saída fosse <nominal> [aka <actual>], enquanto que em type_extractor a saída é o próprio nome do alias.
Em suma, types.tostring() tem uma saída mais expressiva, pensada para mensagens para o usuário, por exemplo, enquanto type_extractor tem uma saída que tenta replicar a sintaxe de declaração de tipos em Pallene.
—Reply to this email directly, view it on GitHub, or unsubscribe.You are receiving this because you commented.Message ID: ***@***.***>
|
@hugomg feito! Aproveitei e subi a mudança da extensão do arquivo de tipos: |
This pull request adds support for extracting and displaying type declarations for Pallene modules. The main changes introduce a new
.ptfoutput file containing type information for exported names, and a new--print-typescommand-line flag. Supporting code and test updates ensure.ptffiles are generated propperly.Type extraction and output support:
src/pallene/type_extractor.luathat generates type declarations for exported names in Pallene modules.src/pallene/driver.luato support compiling.plnfiles to.ptffiles and to invoke type extraction when building shared objects. [1] [2] [3] [4] [5]Command-line and test integration:
--print-typesflag to the Pallene compiler CLI (src/pallene/pallenec.lua), allowing users to print type information to stdout. [1] [2] [3] [4].ptffile creation and clean up.ptffiles after test runs. [1] [2] [3] [4] [5]