Releases: ngs-lang/ngs
Releases · ngs-lang/ngs
v0.2.17
New features
- Add
each(Dir, Fun) - Add
filter(Dir, pattern) - Add
Iter(Set) - Add
partitionk(Eachable2, pattern) - Add
partitionv(Eachable2, pattern) - Add
fields() - Add experimental
retry_assert() - Add
Durationtype - Add experimental
finally(Block, Fun) - Add
Path + StrandStr + Path - Add
avg(Eachable1) - Add
Valuepseudo-type for converting values and functions into values - Add
when(val, pattern, new_val) - Add
code(ArrLike) - Add
code(Type) - Add
flat_map(Eachable1, Fun) - Add
COR- Chain of Responsibility - Add
assert(val, pattern, Exception) - Add
connect() - Add
apply(Eachable1, Fun)andapply(Eachable2, Fun) - Add experimental
ensure(x, pat, how) - Patterns
- Add
F f(x:PATTERN_HERE) ...named parameter pattern syntax (previouslyPATTERN_HEREhad to be a type) - Add
F f(PATTERN_HERE) ...unnamed parameter pattern syntax (can be a type) - Add
Transformedpattern - Add experimental
Capturepattern for capturing values - Add experimental
Branchpattern for multiple matches
- Add
- Add
$[...]syntax for running external programs without capturing output - Add
x::{ ... }syntax and::(x, f:Fun)method definition. Works liketap().
Fixes and improvements
- Fix
AtPathfor non-eachables - Improve
decode()for AWS CLI commands Setcomparison now ignores order- Fix
after_last(Str, Str) encode_json()- now supports{'pretty': 'best-effort'}hint- Various build improvements
- Fix edge case in
del(Hash, Any) echo(Table2::Table)now warns about hidden columns
Deprecated
- Deprecated
Deepin favor ofAtPath - Deprecated
~(Any, Type)in favor of=~(Any, Type) - Deprecated
only()in favor ifwhen()
Breaking changes
- Remove deprecated
Pred - Remove deprecated
~(Any, Any)adapter for=~ - Remove deprecated
~(Any, Type) - Remove unused
get(MatchSuccess) - Remove unused
get(MatchFailure)
Additionally, work on UI was done but there is not much to show yet.
v0.2.16
New features
- Add
Iter(SubSeq) - Add
=~(Eachable1, Pfx, MatchContext) - Add
DecodeHints - Add
=~(DecodeHints, ProcessesPipeline, MatchContext) - Add
AtPathpattern - Add experimental
ResetPathpattern
Fixes and improvements
- Add default
=~(Any, Any, MatchContext)which returnsfalse - Improve
decode()implementation forawscommand - 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
Nottype 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
IfExistspattern 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
UndefinedUpVarexception, thrown when accessing undefined "upvar" - Following types now inherit from
Error, notException:NotImplemented,ReadFail,RequireFail,MainFail - Experimental syntax - allow many additional elements
x.HEREandx::HERE - Fix and improve documentation
- Improve
inspect() - Add
regsparameter 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 \ fsyntax 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), wherepis aPathor 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=...).vtells how to process values before adding to the resulting multi-value-map.- The
?operator now takesAnyinstead ofFunas the right argument. - Fix
trexception when pattern is aHashand it should match not at the top level. Argvnow acceptsRepeatkeys:{Repeat('--repeat'): my_arr}- Support
my_arr[idx] = valfor negativeidxes. c_pcre_execnow 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_noneorfound_moreis not specified.
v0.2.13
New features
- Add
Hash(Hash)(a no-op) - Add experimental
PatternActiontype 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
MatchContexttype - Add experimental
Deeptype 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
Littype to convey literal value, devoid of any "magical" meaning - Add
collector(Stats, Fun) debug(Str, Fun)is now supported- Add
ensure(Arr, T)forTbeing 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
ENVas default value for a parameter. - Reorganize stdlib to eleminate multiple
inherit()calls - Remove unused
most_by_cb() - Booleans now compare correctly when used as
Hashkeys exit_hooknow removes hooks in childfork()- It is now possible to redirect to File without using
.path-f=TmpFile(); $(echo a > $f)- Issue #490 test.ngsin the root folder now accepts optional file names; defaults tolang-tests.ngs,stdlib.ngs, and all*.ngsfiles 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_DEFSnamespace for Cdefined constants (currently only with_SC_NPROCESSORS_ONLNbut will add more later, issue #113) - Add
c_sysconf(),sysconf() - Add
CleanupPolicy,KeepCleanupPolicy,RemoveCleanupPolicy,KeepOnErrorCleanupPolicyto be used withTmpFile TmpFilenow accepts optionalCleanupPolicyargument (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 TmpFileis not expirimental anymoreencode_json()withpretty=truecan now handle larger inputs
Breaking changes
- Remove unused
definedkeyword
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
-ppjcommand line switch - print "pretty" JSON. Requiresjqprogram. - Add
assert(val, pattern, msg)-valmust match thepatternorAssertFailwill be thrown. - Add
Repeattype - 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
Predmachinery replaced with=~and!~match/non-match operators for simplification. - Some
guardclauses 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 givenEachable1supportsIter()encode_json()now supportshintsoptional prameter (of typeHash).prettyhint withtruevalue will "prettify" the output.partition(Eachable1, pattern)now has default pattern (Bool.constructors)store()now supportshintsoptional prameter (of typeHash).prettyhint withtruevalue will "prettify" the output.require()now treats./something.ngsas an absolute path (to fix later: treat as relative to the file)AnyOfandAllOfare no more experimental.- Increase fork-till-exec memory allocation from 1M to 10M (to avoid crashes)
Str(Set)now works properly.- Improve
exit_hookrobustness. - Fix exception handling when calling
map()with invalid arity callback.
Breaking changes
=~match againstArrnow 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 ofNamespaceof the main file:ns { F main(...) ...}- Add experimental
only(val, predicate, mapper) - Add
realpath(Str) - Use
NGS_PATHenvironment variable forrequire().NGS_DIRis deprecated.
Fixes and improvements
- Github actions instead of Travis (Thanks, @organom)
$(log ...)now logs i/o redirections- Remove unused
ValueWrappertype - Bootstrapping -
MY_NAMESPACE::mainworks even ifmainis 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
xxdbuild time dependency - make
sys/poll.hdependency optional
Breaking changes
- Remove deprecated
n() switchandcondare now consistent with if, accepting{...}code blocks for the LHS (switch {a=1; a+a} {...},cond { {a=b+c; a>0 } ... }).