Version 0.9.0 released
2012年09月23日 Andreas Rumpf
Summary
- Unsigned integers have been added.
- The integer type promotion rules changed.
- The template and macro system evolved.
- Closures have been implemented.
- Term rewriting macros have been implemented.
- First steps to unify expressions and statements have been taken.
- Symbol lookup rules in generics have become stricter to catch more errors.
Bugfixes
- Fixed a bug where the compiler would “optimize away” valid constant parts of a string concatenation.
- Fixed a bug concerning implicit type conversions in
casestatements. - Fixed a serious code generation bug that caused
algorithm.sortto produce segmentation faults. - Fixed ambiguity in recvLine which meant that receiving
\r\Lwas indistinguishable from disconnections. - Many more bugfixes, too many to list them all.
Library Additions
- Added the (already existing) module
htmlgento the documentation. - Added the (already existing) module
cookiesto the documentation. - Added
system.shallowthat can be used to speed up string and sequence assignments. - Added
system.evalthat can execute an anonymous block of code at compile time as if was a macro. - Added
system.staticExecandsystem.gorgefor compile-time execution of external programs. - Added
system.staticReadas a synonym forsystem.slurp. - Added
macros.emitthat can emit an arbitrary computed string as nimrod code during compilation. - Added
strutils.parseEnum. - Added
json.%constructor operator. - The stdlib can now be avoided to a point where C code generation for 16bit micro controllers is feasible.
- Added module
oids. - Added module
endians. - Added a new OpenGL wrapper that supports OpenGL up to version 4.2.
- Added a wrapper for
libsvm. - Added a wrapper for
mongodb. - Added
terminal.isatty. - Added an overload for
system.itemsthat can be used to iterate over the values of an enum. - Added
system.TIntegerandsystem.TNumbertype classes matching any of the corresponding types available in Nimrod. - Added
system.clampto limit a value within an interval[a, b]. - Added
strutils.continuesWith. - Added
system.getStackTrace. - Added
system.||for parallelforloop support. - The GC supports (soft) realtime systems via
GC_setMaxPauseandGC_stepprocs. - The sockets module now supports ssl through the OpenSSL library,
recvLineis now much more efficient thanks to the newly implemented sockets buffering. - The httpclient module now supports ssl/tls.
- Added
times.formatas well as many other utility functions for managing time. - Added
system.@for converting anopenarrayto aseq(it used to only support fixed length arrays). - Added
system.compileswhich can be used to check whether a type supports some operation. - Added
strutils.format,subexes.formatwhich use the newvarargstype. - Added module
fsmonitor.
Changes affecting backwards compatibility
- On Windows filenames and paths are supposed to be in UTF-8.
The
system,os,osprocandmemfilesmodules use the wide string versions of the WinAPI. Use the-d:useWinAnsiswitch to revert back to the old behaviour which uses the Ansi string versions. static,do,interfaceandmixinare now keywords.- Templates now participate in overloading resolution which can break code that
uses templates in subtle ways. Use the new
immediatepragma for templates to get a template of old behaviour. - There is now a proper distinction in the type system between
exprandPNimrodNodewhich unfortunately breaks the old macro system. pegs.@has been renamed topegs.!*andpegs.@@has been renamed topegs.!*\as@operators now have different precedence.- The type
proc(without any params or return type) is now considered a type class matching all proc types. Useproc ()to get the old meaning denoting a proc expecing no arguments and returning no value. - Deprecated
system.GC_setStrategy. re.findAllandpegs.findAlldon’t return captures anymore but matching substrings.- RTTI and thus the
marshallmodule don’t contain the proper field names of tuples anymore. This had to be changed as the old behaviour never produced consistent results. - Deprecated the
sslmodule. - Deprecated
nimrod prettyas it never worked good enough and has some inherent problems. - The integer promotion rules changed; the compiler is now less picky in some
situations and more picky in other situations: In particular implicit
conversions from
inttoint32are now forbidden. system.byteis now an alias foruint8; it used to be an alias toint8.bindexpressions in templates are not properly supported anymore. Use the declarativebindstatement instead.- The default calling convention for a procedural type is now
closure, for procs it remainsnimcall(which is compatible toclosure). Activate the warningImplicitClosureto make the compiler list the occurrences of proc types which are affected. - The Nimrod type system now distinguishes
openarrayfromvarargs. - Templates are now
hygienic. Use thedirtypragma to get the old behaviour. - Objects that have no ancestor are now implicitly
final. Use theinheritablepragma to introduce new object roots apart fromTObject. - Macros now receive parameters like templates do; use the
callsitebuiltin to gain access to the invocation AST. - Symbol lookup rules in generics have become stricter to catch more errors.
Compiler Additions
- Win64 is now an officially supported target.
- The Nimrod compiler works on BSD again, but has some issues
as
os.getAppFilenameandos.getAppDircannot work reliably on BSD. - The compiler can detect and evaluate calls that can be evaluated at compile
time for optimization purposes with the
--implicitStaticcommand line option or pragma. - The compiler now generates marker procs that the GC can use instead of RTTI. This speeds up the GC quite a bit.
- The compiler now includes a new advanced documentation generator
via the
doc2command. This new generator uses all of the semantic passes of the compiler and can thus generate documentation for symbols hiding in macros. - The compiler now supports the
dynlibpragma for variables. - The compiler now supports
bycopyandbyrefpragmas that affect how objects/tuples are passed. - The embedded profiler became a stack trace profiler and has been documented.
Language Additions
- Added explicit
staticsections for enforced compile time evaluation. - Added an alternative notation for lambdas with
do. addris now treated like a prefix operator syntactically.- Added
globalpragma that can be used to introduce new global variables from within procs. whenexpressions are now allowed just likeifexpressions.- The precedence for operators starting with
@is different now allowing for sigil-like operators. - Stand-alone
finallyandexceptblocks are now supported. - Macros and templates can now be invoked as pragmas.
- The apostrophe in type suffixes for numerical literals is now optional.
- Unsigned integer types have been added.
- The integer promotion rules changed.
- Nimrod now tracks proper intervals for
rangeover some built-in operators. - In parameter lists a semicolon instead of a comma can be used to improve
readability:
proc divmod(a, b: int; resA, resB: var int). - A semicolon can now be used to have multiple simple statements on a single
line:
inc i; inc j. bindsupports overloaded symbols and operators.- A
distincttype can now borrow from generic procs. - Added the pragmas
gensym,injectanddirtyfor hygiene in templates. - Comments can be continued with a backslash continuation character so that comment pieces don’t have to align on the same column.
- Enums can be annotated with
pureso that their field names do not pollute the current scope. - A proc body can consist of an expression that has a type. This is rewritten
to
result = expressionthen. - Term rewriting macros (see trmacros) have been implemented but are still in alpha.