Skip to content

Releases: ngs-lang/ngs

v0.2.16

17 May 06:42
Compare
Choose a tag to compare

New features

  • Add Iter(SubSeq)
  • Add =~(Eachable1, Pfx, MatchContext)
  • Add DecodeHints
  • Add =~(DecodeHints, ProcessesPipeline, MatchContext)
  • Add AtPath pattern
  • Add experimental ResetPath pattern

Fixes and improvements

  • Add default =~(Any, Any, MatchContext) which returns false
  • Improve decode() implementation for aws command
  • Improve =~(Str, SubSeq, MatchContext)
  • Fix MatchContext._path when matching elements in =~(Any, Arr, MatchContext)
  • Fix in(Int, NumRange) which was causing for i in 0 ... to run once instead of not running

v0.2.15

18 Mar 11:57
Compare
Choose a tag to compare

New features

  • Add assert(Fun, Type, Str) for asserting that the code throws the given exception. The type must be subtype of Exception.
  • Add namespace net
  • Add networking c_sockaddr, c_sockaddr_un, c_sockaddr_in
  • Add networking functions: socket(), bind(), listen(), accept(), recvfrom(), send()
  • Add networking constants: SOCK_STREAM, SOCK_DGRAM, SOCK_RAW, MSG_OOB, MSG_PEEK, MSG_WAITALL (all prefixed with C_)
  • Add Not type and support in pattern matching
  • Add env: option to pass environment when running external programs
  • Add ensure(Int, NumRange)
  • Add last(Eachable1, Any), the counterpart of first()
  • Add skip(Iter, Any) - skip elements matching the pattern
  • Add skip(Iter, Int) - skip given number of elements
  • When a function is called from CLI, the output is now displayed using experimental echo_cli()
  • Add AWS2::regions(CommandsPipeline, Arr)
  • Add IfExists pattern for optionally present fields
  • Add before_first(Str, Str) - get the piece before first occurrence of the delimiter
  • Add after_last(Str, Str) - get the piece after the last occurrence of the delimiter

Fixes and improvements

  • Add UndefinedUpVar exception, thrown when accessing undefined "upvar"
  • Following types now inherit from Error, not Exception: NotImplemented, ReadFail, RequireFail, MainFail
  • Experimental syntax - allow many additional elements x.HERE and x::HERE
  • Fix and improve documentation
  • Improve inspect()
  • Add regs parameter to AWS2::regions(Fun)
  • $(log: ...) can now take Str to prefix the message
  • Improve retry() logging
  • Improve Time(Str)

Deprecated

  • is_subtype(Type, Type) is now deprecated, use <= operator, example: T1 <= T2. Solves #391.
  • typeof(Any) is now deprecated, use Type(Any) instead.
  • x \ f syntax is now deprecated, use x.f() and x.{...} instead.

Misc

  • GCC 9 on macOS is not supported anymore - it's broken

v0.2.14

16 Apr 13:05
Compare
Choose a tag to compare

New features

  • Parsing of curl -i ... command into {"code": Int, "message": Str, "headers": Hash, "headers_arr": Hash, "body": Str}
  • Add decode(Str, p), where p is a Path or its subtype.
  • Add assert(Path)
  • Add Bool(Real)
  • Add experimental native_ll_maybe_wrap
  • Add TmpDir
  • Add replace(File, Any, Any) for in-place replacement

Fixes and improvements

  • Fix #451 - decode(Bool) is not strict enough
  • group(Eachable1, Fun) now has additional parameter v: group(e:Eachable1, k:Fun, v:Fun=...). v tells how to process values before adding to the resulting multi-value-map.
  • The ? operator now takes Any instead of Fun as the right argument.
  • Fix tr exception when pattern is a Hash and it should match not at the top level.
  • Argv now accepts Repeat keys: {Repeat('--repeat'): my_arr}
  • Support my_arr[idx] = val for negative idxes.
  • c_pcre_exec now behaves correctly when too many captures are specified
  • Fix crash when accessing RegExp#options.
  • Improve GitHub build action
  • Add builds: Arch Linux, centos 7 and 8, fedora 34 and 35, Amazon Linux 2
  • Better exception message when redirecting to >${null}.
  • Website update & dark theme support
  • ($()) is now a valid syntax for the identifier $()

Deprecated

  • Argv - ['--repeat'] is deprecated in favor of Repeat('--repeat')
  • attrs() is deprecated, use meta() instead

Breaking changes

  • Str(Path) is now returning .path, not <Path path=...>
  • the_one() is now fixed and will throw exception instead of returning null when appropriate found_none or found_more is not specified.

v0.2.13

21 Nov 14:40
Compare
Choose a tag to compare

New features

  • Add Hash(Hash) (a no-op)
  • Add experimental PatternAction type for combining a pattern and an action to take when there is a match
  • Add experimental -> syntax for constructing PatternAction
  • Add experimental =~(x, PatternAction) which checks the pattern and conditionally runs the action
  • Add experimental MatchContext type
  • Add experimental Deep type for deep data structure matching
  • Add Hash(Eachable1) - Issue #436 - Add Hash(array_of_key_value_pairs)
  • Add exec() methods - Issue #459
  • partial() is now deprecated because it's not used
  • Add Lit type to convey literal value, devoid of any "magical" meaning
  • Add collector(Stats, Fun)
  • debug(Str, Fun) is now supported
  • Add ensure(Arr, T) for T being subtype of ArrLike
  • Add fork(), higher level wrapper around c_fork()
  • Add Str(ArrLike)

Fixes and improvements

  • inspect() fix for partially applied functions: ngs -pi 'X*2' does not fail anymore.
  • =~(x, Hash) now supports patterns for keys
  • Documentation generation now handles well ENV as default value for a parameter.
  • Reorganize stdlib to eleminate multiple inherit() calls
  • Remove unused most_by_cb()
  • Booleans now compare correctly when used as Hash keys
  • exit_hook now removes hooks in child fork()
  • It is now possible to redirect to File without using .path - f=TmpFile(); $(echo a > $f) - Issue #490
  • test.ngs in the root folder now accepts optional file names; defaults to lang-tests.ngs, stdlib.ngs, and all *.ngs files in lib/autoload

Breaking changes

  • Remove deprecated nofail: option
  • write(f:File, s:Str) now returns f

Deprecated

  • Deprecate without(Eachable1, Any)
  • Deprecate without(Eachable2, Any)

v0.2.12-action

15 Sep 14:08
44a9d3f
Compare
Choose a tag to compare

Setup NGS in Github Action support

v0.2.12

04 Jun 08:58
Compare
Choose a tag to compare

New features

  • Add replace(Str, RegExp, Str)
  • Add Bool(UserDefinedMethod)
  • Add c_pow(Real, Real), pow(Real, Real), pow(Int, Int)
  • Add decode() for JSON Web Token (JWT)
  • Add echo(File, Str)
  • Add echo(File, Lines)
  • Add C_DEFS namespace for C defined constants (currently only with _SC_NPROCESSORS_ONLN but will add more later, issue #113)
  • Add c_sysconf(), sysconf()
  • Add CleanupPolicy, KeepCleanupPolicy, RemoveCleanupPolicy, KeepOnErrorCleanupPolicy to be used with TmpFile
  • TmpFile now accepts optional CleanupPolicy argument (defaults to RemoveCleanupPolicy)
  • When running ngs -e ..., ngs -p ..., etc - allow using _ instead of fetch().
  • Add "curl" installer.

Fixes and improvements

  • Fix Str(File) - now display correct type name for subtypes
  • Make decode_base64() more roubst
  • pmap(Eachable1, Fun) now limits number of threads (issue #113)
  • Add documentation for MaybeFile
  • TmpFile is not expirimental anymore
  • encode_json() with pretty=true can now handle larger inputs

Breaking changes

  • Remove unused defined keyword

v0.2.11

14 Mar 11:09
Compare
Choose a tag to compare

New features

  • Add write(Str) - write to stdout
  • Add del(HashLike, Any) - remove item from HashLike, similar to del(Hash, Any)
  • Add trim(Str) - trim whitespace at the beginning and end of the string
  • Add -ppj command line switch - print "pretty" JSON. Requires jq program.
  • Add assert(val, pattern, msg) - val must match the pattern or AssertFail will be thrown.
  • Add Repeat type - Signifies repetition of a pattern (or something else), to be used in patterns (and maybe somewhere else).
  • Add group(Eachable1, Str) - group by field
  • Add uniq(Eachable1, Str) - uniq by field
  • Add duplicates(Eachable1, field_or_callback) - find duplicates

Fixes and improvements

  • Introduced =~ and !~ matching operators.
  • The Pred machinery replaced with =~ and !~ match/non-match operators for simplification.
  • Some guard clauses are now using =~ and as a result are more concise.
  • inspect() now shows attributes (including documentation) of methods and types.
  • uniq() now works with Eachable1 (previously Arr) and has optional callback.
  • reduce(Eachable1, Fun) now does not assume that the given Eachable1 supports Iter()
  • encode_json() now supports hints optional prameter (of type Hash). pretty hint with true value will "prettify" the output.
  • partition(Eachable1, pattern) now has default pattern (Bool.constructors)
  • store() now supports hints optional prameter (of type Hash). pretty hint with true value will "prettify" the output.
  • require() now treats ./something.ngs as an absolute path (to fix later: treat as relative to the file)
  • AnyOf and AllOf are no more experimental.
  • Increase fork-till-exec memory allocation from 1M to 10M (to avoid crashes)
  • Str(Set) now works properly.
  • Improve exit_hook robustness.
  • Fix exception handling when calling map() with invalid arity callback.

Breaking changes

  • =~ match against Arr now matches element-wise. Previously only one-element-array was supported as the second argument and it had to match all elements of the first argument.

v0.2.10

01 Jan 09:32
Compare
Choose a tag to compare
  • Snap packaging
  • Improvements in CI/CD
  • Documentation fixes and improvements

Detailed list of changes is in CHANGELOG.md

v0.2.9

04 Oct 08:49
Compare
Choose a tag to compare

New features

  • Homebrew formula and readme instructions (Thanks, @SeekingMeaning)
  • Homebrew badge (Thanks, @organom)
  • main() can now be defined as part of Namespace of the main file: ns { F main(...) ...}
  • Add experimental only(val, predicate, mapper)
  • Add realpath(Str)
  • Use NGS_PATH environment variable for require(). NGS_DIR is deprecated.

Fixes and improvements

  • Github actions instead of Travis (Thanks, @organom)
  • $(log ...) now logs i/o redirections
  • Remove unused ValueWrapper type
  • Bootstrapping - MY_NAMESPACE::main works even if main is not defined in the main file, allowing ngs -e 'require("my_module.ngs") to run its own main()
  • filterk(), rejectk(), filterv(), rejectv() - the predicate is now optional and defaults to identity.
  • Got rid of xxd build time dependency
  • make sys/poll.h dependency optional

Breaking changes

  • Remove deprecated n()
  • switch and cond are now consistent with if, accepting {...} code blocks for the LHS (switch {a=1; a+a} {...}, cond { {a=b+c; a>0 } ... }).

v0.2.8

26 Jul 17:38
Compare
Choose a tag to compare

Notable changes:

  • Add NamedInstances type (aka enums)
  • Add experimental AllOf()

Detailed list of changes is in CHANGELOG.md