前言
微软科学家Mark Barron根据是自己发表的论文《Regularized Programming with the BOSQUE Language》,设计出全新的编程语言 Bosque,Bosque的灵感源于TypeScript语法、 ML、NodeJS/JavaScript的语义。
Bosque理论
Mark Barron指出上世纪 70 年代兴起的结构化程序设计和抽象数据类型使得开发者可以屏蔽掉底层硬件架构的特征,专注于编写功能代码,同时开发也变得更加不易出错。而作者在此基础上,提出了一种新的程序设计思想——Regularized Programming(规范化/正则程序设计),通过避免低级循环动作的迭代处理、用代数数据转换操作符丰富语言等设计,超越结构化程序设计。
Bosque特性
1、我们熟悉的循环机制在 Bosque 中它被取消了,不需要“for”、“while”、“do while”循环,取而代之的是引入了函子(仿函数,Functors)来取代:
//Functor (Bosque)
var a = List[Int]@{...};
//Pre: true
var b = a.map[Int](fn(x) => x*2);
//Post: List[Int]::eq(fn(x, y) => y == x*2, a, b)te
2、构建对象
意外复杂性(Accidental Complexity)
Bosque消除了主要的不确定复杂性来源。
该论文《Regularized Programming with the BOSQUE Language》基于一系列分析、运行时与编程器开发的经验与验证,以及针对开发人员的采访,确定了开发过程中会出现的 5 个主要不确定复杂性来源:
- 可变状态和框架/Mutable State and Frames;
- 循环、递归和不变量/Loops, Recursion, and Invariants;
- 不确定性为/Indeterminate Behaviors;
- 数据不变违规/Data Invariant Violations;
- 平等和别名/Equality and Aliasing
环境需求
Windows
- The LTS version of node.js for Windows (x64)
- Typescript (install with: npm i typescript -g)
构建&测试
npm install && npm run-script build && npm test
命令行执行
node bin/test/app_runner.js FILE.bsq
开发工具VSCode
This repository provides basic Visual Studio Code IDE support for the Bosque language (currently limited to syntax and brace highlighting). The installation requires manually copying the full bosque-language-tools/ folder into your user .vscode/extensions/ directory and restarting VSCode.
关于Bosque
论文
https://www.microsoft.com/en-us/research/uploads/prod/2019/04/beyond_structured_report_v2.pdf
源码
https://github.com/Microsoft/BosqueLanguage
关于我
大家好,我是Wooola,10年JAVA老兵,擅长微服务,分布式,并发,工作流。请大家多多关注我。