Pawns 编程语言简要概述
A Brief Overview of the Pawns Programming Language
AI总结:
Pawns 是一种集成纯函数式与命令式编程的语言,通过编译器共享分析和强制效果标注来保证纯度检查与安全更新。
摘要:
Pawns 是一种正在开发中的编程语言,它同时支持纯函数式编程(包括代数数据类型、高阶编程和参数化多态)与命令式编程(包括指针、共享数据结构的破坏性更新和全局变量),并将二者集成,使每种范式都能调用另一种,且纯度由编译器检查。对于纯函数式代码,程序员无需理解数据结构的表示。对于命令式代码,则必须理解其表示,并且所有效果和依赖关系都必须在代码中记录。例如,如果一个函数可能更新它的某个参数,就必须在函数类型签名中声明,并在调用该函数的地方注明。由于表示共享(指针别名),单个更新操作可能影响多个变量。Pawns 代码要求在所有可能被更新的变量处进行标注,并声明有关共享的信息。在使用 IO 或其他全局变量的地方也需要标注,并且这同样必须在类型签名中声明。由编译器执行的共享分析是 Pawns 许多方面的关键。它使我们能够检查所有效果是否在源代码中清晰可见,效果可以被封装在纯接口内部,并且效果可以在存在多态的情况下被安全使用。
英文摘要:
Pawns is a programming language under development which supports pure functional programming (including algebraic data types, higher order programming and parametric polymorphism) and imperative programming (including pointers, destructive update of shared data structures and global variables), integrated so each can call the other and with purity checked by the compiler. For pure functional code the programmer need not understand the representation of the data structures. For imperative code the representation must be understood and all effects and dependencies must be documented in the code. For example, if a function may update one of its arguments, this must be declared in the function type signature and noted where the function is called. A single update operation may affect several variables due to sharing of representations (pointer aliasing). Pawns code requires all affected variables to be annotated wherever they may be updated and information about sharing to be declared. Annotations are also required where IO or other global variables are used and this must be declared in type signatures as well. Sharing analysis, performed by the compiler, is the key to many aspects of Pawns. It enables us to check that all effects are made obvious in the source code, effects can be encapsulated inside a pure interface and effects can be used safely in the presence of polymorphism.
机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。