Releases: ngs-lang/ngs
Releases · ngs-lang/ngs
v0.2.16
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 returnsfalse
- Improve
decode()
implementation foraws
command - Improve
=~(Str, SubSeq, MatchContext)
- Fix MatchContext._path when matching elements in =~(Any, Arr, MatchContext)
- Fix
in(Int, NumRange)
which was causingfor i in 0 ...
to run once instead of not running
v0.2.15
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 withC_
) - 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
, notException
:NotImplemented
,ReadFail
,RequireFail
,MainFail
- Experimental syntax - allow many additional elements
x.HERE
andx::HERE
- Fix and improve documentation
- Improve
inspect()
- Add
regs
parameter toAWS2::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, useType(Any)
instead.x \ f
syntax is now deprecated, usex.f()
andx.{...}
instead.
Misc
- GCC 9 on macOS is not supported anymore - it's broken
v0.2.14
New features
- Parsing of
curl -i ...
command into {"code": Int, "message": Str, "headers": Hash, "headers_arr": Hash, "body": Str} - Add
decode(Str, p)
, wherep
is aPath
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 parameterv
:group(e:Eachable1, k:Fun, v:Fun=...)
.v
tells how to process values before adding to the resulting multi-value-map.- The
?
operator now takesAny
instead ofFun
as the right argument. - Fix
tr
exception when pattern is aHash
and it should match not at the top level. Argv
now acceptsRepeat
keys:{Repeat('--repeat'): my_arr}
- Support
my_arr[idx] = val
for negativeidx
es. 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 ofRepeat('--repeat')
attrs()
is deprecated, usemeta()
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 appropriatefound_none
orfound_more
is not specified.
v0.2.13
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 constructingPatternAction
- 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)
forT
being subtype ofArrLike
- Add
fork()
, higher level wrapper aroundc_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 childfork()
- 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 tolang-tests.ngs
,stdlib.ngs
, and all*.ngs
files inlib/autoload
Breaking changes
- Remove deprecated
nofail:
option write(f:File, s:Str)
now returnsf
Deprecated
- Deprecate
without(Eachable1, Any)
- Deprecate
without(Eachable2, Any)
v0.2.12-action
Setup NGS in Github Action support
v0.2.12
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 Cdefine
d 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 withTmpFile
TmpFile
now accepts optionalCleanupPolicy
argument (defaults toRemoveCleanupPolicy
)- When running
ngs -e ...
,ngs -p ...
, etc - allow using_
instead offetch()
. - 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 anymoreencode_json()
withpretty=true
can now handle larger inputs
Breaking changes
- Remove unused
defined
keyword
v0.2.11
New features
- Add
write(Str)
- write to stdout - Add
del(HashLike, Any)
- remove item fromHashLike
, similar todel(Hash, Any)
- Add
trim(Str)
- trim whitespace at the beginning and end of the string - Add
-ppj
command line switch - print "pretty" JSON. Requiresjq
program. - Add
assert(val, pattern, msg)
-val
must match thepattern
orAssertFail
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 withEachable1
(previouslyArr
) and has optional callback.reduce(Eachable1, Fun)
now does not assume that the givenEachable1
supportsIter()
encode_json()
now supportshints
optional prameter (of typeHash
).pretty
hint withtrue
value will "prettify" the output.partition(Eachable1, pattern)
now has default pattern (Bool.constructors
)store()
now supportshints
optional prameter (of typeHash
).pretty
hint withtrue
value will "prettify" the output.require()
now treats./something.ngs
as an absolute path (to fix later: treat as relative to the file)AnyOf
andAllOf
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 againstArr
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
v0.2.9
New features
- Homebrew formula and readme instructions (Thanks, @SeekingMeaning)
- Homebrew badge (Thanks, @organom)
main()
can now be defined as part ofNamespace
of the main file:ns { F main(...) ...}
- Add experimental
only(val, predicate, mapper)
- Add
realpath(Str)
- Use
NGS_PATH
environment variable forrequire()
.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 ifmain
is not defined in the main file, allowingngs -e 'require("my_module.ngs")
to run its ownmain()
filterk()
,rejectk()
,filterv()
,rejectv()
- the predicate is now optional and defaults toidentity
.- Got rid of
xxd
build time dependency - make
sys/poll.h
dependency optional
Breaking changes
- Remove deprecated
n()
switch
andcond
are now consistent with if, accepting{...}
code blocks for the LHS (switch {a=1; a+a} {...}
,cond { {a=b+c; a>0 } ... }
).