天天看点

编程语言Red 0.5.4发布:新datatypes、异常处理和set操作

red是一种可以运行于多种平台的全栈语言,它的语法主要继承于rebol,同时在设计过程中借鉴了scala和lua的优点 。作为一门全栈语言,red既可以用于高层级的编程,如dsl(domain specific language),也可用于低层级的编程,如设备驱动。

red 0.5.4版本是一次重大的更新,带来了大量的新特性。接下来他将支持gui,也可能会支持dsl。

编程语言Red 0.5.4发布:新datatypes、异常处理和set操作

图为:red language architecture schema

<a target="_blank"></a>

red开始支持了一些新的datatype,包括:pair! datatype、percent! datatype、tuple! datatype、map! datatype等。

同时,它也支持了set操作,主要有:

union: returns the union of two data sets.

exclude: returns the first data set less the second data set.

intersect: returns the intersection of two data sets.

difference: returns all the values which differ from two data sets.

unique: returns the data set with duplicates removed.

而这些操作可以应用于这些datatypes:block!、string!、bitset!、typeset!。(注:会在下一个版本中支持 hash! datatype)

新的语句:as-pair、break、continue、extend。

新的动作:put。(注:put仅支持在map!中实现,其它的支持请静候未来版本)

新的函数:cause-error

其它更新:

exit/return are now defined as natives instead of volatile keywords.

do can accept error! values.

parse and load are now more stable when errors are raised from parsing rules.

load errors handling greatly improved (no console exit on syntax errors anymore).

value? now supports any type, except unset! as argument.

fixed bugs and little improvement of help output.

minor redbin speed and generated payload size improvement.

prin output in console fixed.

fixed red/system's #get directive not working in some cases.

system/words now defined as an object!.

compiler now supports system/words/ prefix to access global context words.

many fixes and improvements on vector! datatype, especially on math operations.

color definitions are now available.

vector! unit tests significantly extended.

an op! used without arguments in the interpreter now reports an error.

pick and poke now accept a logic! value as index.

added missing comparison operators for vector!.

paths evaluation errors in interpreter are now more accurate.

first memory frame allocation increased from 512kb to 1mb.

fixed memory corruptions caused by function with refinements in interpreter.

division by zero now properly caught for floats.

last but not least, 44 bugs reported on github's tracker fixed in this release!

这次发布标志着在master重新集成android分支的开始。另外,red团队称将在0.6.0中支持gui引擎和gui dsl,不过android back-end不在下个版本的计划中。此外,由于android的开发周期很慢和调试选项的限制,所以windows会成为gui的第一个支持平台,可 快速完成引擎和dsl。最后,在0.6.1中将会合并android gui back-end和toolchain。

原文发布时间为:2015-06-16

本文来自云栖社区合作伙伴“linux中国”

继续阅读