This repository has been archived by the owner on Dec 1, 2024. It is now read-only.
Releases: JesseCoretta/go-stackage
Releases · JesseCoretta/go-stackage
v1.0.4
v1.0.4
sort.Interface
qualification, allowing basic sort operations forStack
instances- Added
Stack.Swap(int, int)
andStack.Less(int, int) bool
methods - Added
Stack.SetLessFunc(...func(int, int) bool) Stack
method to allow sort closure submission by adopters - Included a package-default sorter based on slice string representation, if available
- Added
- Documentation updates
- Removed Experimental badge from README.md 🥳
- Removed unneeded (commented-out) code
v1.0.3
v1.0.3
v1.0.3 brings significant performance improvements. No new features are added.
The log
subsystem behavior is now less engaged. Users may still supply their own *log.Logger
, however no internal use of any log
system occurs by default now. Overzealous internal use resulted in significant performance degradation.
A (pprof
) performance analysis was done to guide this pull request. Certain inefficiencies were identified and corrected (largely those involving aforementioned log
use).
Code coverage remains 100%. Full test suite execution times dropped from 0.2s to 0.005s on average.
v1.0.1
v1.0.0
Changes
- Inaugural stable release, per PR #4
- Update
go.mod
toretract
all previous non-stable releases
Historical changelog
v0.0.3-alpha.1
- Added preliminary FIFO (First-In-First-Out, a.k.a.: queue) support option, which complements the default LIFO (Last-In-Last-Out, a.k.a.: stack) behavior observed through use of the
Stack.Pop
method- For those unfamiliar with these concepts:
- FIFO is akin to the line at the deli: first come, first serve. In technical terms, this means the first slice (#0) shall be removed when
Stack.Pop
is executed in this operating mode - LIFO is akin to a stack of plates in a box: last one in is at the top. In technical terms, this means the last slice (i.e.:
length -1
) shall be removed whenStack.Pop
is executed in this operating mode
- FIFO is akin to the line at the deli: first come, first serve. In technical terms, this means the first slice (#0) shall be removed when
- Users may execute
Stack.SetFIFO(true)
to invoke FIFO append/truncate behavior - Users should not change the scheme in effect once [de-]population has commenced during its lifespan
- For those unfamiliar with these concepts:
- Added
Stack.Reveal
method to recursively walk aStack
instance and disenvelop needlessly nested elements- Abstract example:
And[And[And[1x Condition]]]
Stack
-in-Condition
scenarios will be included in this operation- For the moment,
Not
stacks are exempt from this control due to their inverse nature
- Abstract example:
- Added
Stack.Defrag
method to recursively correct contiguity "errors" (i.e.: gaps)- The method will scan the receiver instance and implode, or "collapse", the slices such that no
nil
instances exist between non-nil
slices - When complete, the trailing
nil
sequence is truncated entirely (else the receiver length would have remained constant) - A genuine need for this method would likely be rare and quite unusual -- but not impossible
Stack
-in-Condition
scenarios will be included in this operation, as willStack
-in-Stack
scenarios
- The method will scan the receiver instance and implode, or "collapse", the slices such that no
- Decommissioned old
chan
-based event system in favor of basic*log.Logger
functionality- Standard
*log.Logger
incarnations (e.g.:stderr
,stdout
) are available globally or perCondition
/Stack
- Custom
*log.Logger
instances may be provided by the user - Default logging state is to discard all log events using
io.Discard
, as is recommended - Included convenient LogLevel bit identifiers, allowing numerous verbosity-level permutations
- Included ten (1) unnamed and reserved LogLevel bit identifiers for user customization
- Standard
- Implemented
Interface
interface- Useful in situations where reduced type-assertion for
Condition
andStack
instances (or any qualifying aliased counterparts) would be appreciated by the end-user (this sentiment would apply in particular to extremely complex, nested structures). - The
Interface
interface only offers functionality that is inherently read-only, and only extends a subset of similar such methods that are common to both of the above root types in both name and signature
- Useful in situations where reduced type-assertion for
- Added/enhanced
Len
method support forCondition
instances, the semantics of which are as follows:- If receiver is not initialized, or if no expression has been set, a length of zero (0) is returned
- If receiver contains an expression that is a
Stack
(or alias of same) instance, its ownLen()
semantics apply and may return any integer (even zero (0)) - A length of one (1) is returned as a fallback, representing the abstract length of a single
Condition
- Added
Addr
method for bothCondition
andStack
type instances- This performs a crude internal call to
fmt.Sprintf
using the%p
verb to print the memory address currently occupied by the underlying embedded instance - Mainly useful for unit tests, debugging or troubleshooting
- Users who do not label their objects may find this mildly useful in some scenarios
- This performs a crude internal call to
- Added
SetID
method functionality to allow the (very) basic randomized generation of twenty-four (24) alphanumeric characters for convenient automatic naming of objects; this is triggered by the input of_random
for an ID to setmath/rand
is used, as this is not a security-sensitive feature- Similarly,
_addr
will automatically invoke theAddr
method for the convenient naming of objects
- Added more traditional error handling support for
Stack
andCondition
types, without sacrificing the fluent method signature designStack
andCondition
types now extends theErr() error
method to allow the commonplaceif err != nil
-style checks for users who prefer that over the act of chaining fluent method calls that may obscure a particular problem's true source- Conversely, the
SetErr(err error) <fluent return type>
has been added to allow users to specify their own error conditions, when needed, or to unset an error instance already present within the receiver
- Misc. changes
- Documentation improvements, typo corrections
- Updated bullet-point documentation blocks to reflect the newer
pkgsite
syntax, thus avoiding the double-spaced lines between line-items that have plagued Gophers since the days of Godoc
- Misc. bug fixes
- Corrected issue with
Stack.Cap
not returning the correct user-facing integer value- This did not impact the actual capacity -- only the expected number of slices were permitted for addition; no more and no less than that
- The offset for the 'hidden' configuration slice was not reflected during interrogation procedures, thus a capacity of four (4) would return five (5) when
Stack.Cap
was executed
- Corrected issue with
Condition
type conversion attempts failed due to incorrect control type defined - Corrected inconsistent pointer usage for
Condition
method signatures (Init
is now the only*Condition
signature bearer, as it should be) - Corrected issue where
Condition.SetExpression
was setting the native type instance of an assertion value, as opposed to the actual assertion value. For example:- User Bob submits type-aliased
stackage.Stack
instance -- let's saymain.MyStack
-- to a newly assembledstackage.Condition
instance using itsSetExpression
method - The internal methods that evaluate the submitted assertion value will, at some point, check to see if the type instance is either a native
stackage.Stack
OR a type alias of same - In Bob's case, this check evaluted as true and the value was accepted
- Unfortunately, the value that was actually written was the return value of an internal "alias->stack" converter; this should have been shadowed, and not used, as the process merely should look to see IF the assertion value is a
stackage.Stack
, but not actually use the converted value - The solution was simply to use the originally submitted value, as-is, once it passed the requisite checks
- User Bob submits type-aliased
- Corrected needlessly-padded
Stack.Kind
return value- Padding was originally applied to this value for string representation requests which contained one (1) or more Boolean WORD-based logical sequences (e.g.:
value AND othervalue
) - WORD operators should always have padding; SYMBOL operators may, or may not, have padding
- Padding is now applied as expected, but is limited to operation within the
String()
methods, and no longer influences its component values directly outside of this scenario - Users and applications that were previously trimming the
Stack.Kind()
return value (e.g.:strings.TrimSpace(myStack.Kind())
) may cease doing so at their leisure
- Padding was originally applied to this value for string representation requests which contained one (1) or more Boolean WORD-based logical sequences (e.g.:
- Corrected issue with
v0.0.3-alpha.0
stack.go
,cfg.go
- Fix unreliable
Stack.Fold
behavior
- Fix unreliable
stack_test.go
- Update "folded" tests to match correct result
v0.0.2-alpha.9
stack.go
- Fix panic of bogus
Stack.Remove
call
- Fix panic of bogus
go.mod
- Retract
v0.0.2-alpha.4
throughv0.0.2-alpha.8
- Retract
v0.0.2-alpha.7
stack.go
- fix panic with
Stack.Reset
onnil
receiver instance
- fix panic with
v0.0.2-alpha.6
stack.go
- Change
Stack.JoinDelim
toStack.SetDelimiter
- Update
Stack.SetDelimiter
to allow arune
value in addition to astring
(rune
is then cast tostring
for preservation) - Implement
Stack.Delimiter
to return current (LIST) delimiter value as astring
- Relevant commentary
- Change
stack_test.go
- Add
Stack.SetDelimiter
andStack.Delimiter
unit tests
- Add
cfg.go
- Equivalent private function updates to that of
stack.go
above - Implement check within
nodeConfig.setListDelimiter
to bail out (silently) ifstackType
value is notlist
- Equivalent private function updates to that of
v0.0.2-alpha.5
stack.go
- Fix missing symbolic padding
stack_test.go
- Add unit test to identify missing padding
go.mod
- Retract
v0.0.2-alpha.4
- Retract
v0.0.2-alpha.4
go.mod
- Retract old releases
v0.0.2-alpha.3
cond.go
- Update FCF signature callers for
ValidityPolicy
,PresentationPolicy
- Add stringer for all number primitives when assigned through
Condition.SetExpression
orCond(...)
- Add value fallback to
string
primitive when assigned throughCondition.SetExpression
orCond(...)
- Update FCF signature callers for
cond_test.go
- Add "custom keyword" and "custom type" unit tests
stack.go
- Update FCF signature callers for
ValidityPolicy
,PresentationPolicy
- Update FCF signature callers for
fcf.go
- Update FCF signatures for
ValidityPolicy
,PresentationPolicy
closures
- Update FCF signatures for
v0.0.2-alpha.2
cond.go
- Implement
CanNest
,NoNesting
andIsNested
features forCondition
instances - Implement better incremental building for
Condition
instances
- Implement
cond_test.go
- Update unit tests
v0.0.2-alpha.1
cond.go
- Self-initialization routine for
Condition
instances when a nil instance is modified
- Self-initialization routine for
stack.go
- Commentary corrections
- Add
IsInit
method for simple initialization state check ofStack
instances - Add
CanNest
,NoNesting
andIsNested
methods for constraining (or assessing) the...
v0.0.3-alpha.1
Changes
v0.0.3-alpha.1
- Added preliminary FIFO (First-In-First-Out, a.k.a.: queue) support option, which complements the default LIFO (Last-In-Last-Out, a.k.a.: stack) behavior observed through use of the
Stack.Pop
method- For those unfamiliar with these concepts:
- FIFO is akin to the line at the deli: first come, first serve. In technical terms, this means the first slice (#0) shall be removed when
Stack.Pop
is executed in this operating mode - LIFO is akin to a stack of plates in a box: last one in is at the top. In technical terms, this means the last slice (i.e.:
length -1
) shall be removed whenStack.Pop
is executed in this operating mode
- FIFO is akin to the line at the deli: first come, first serve. In technical terms, this means the first slice (#0) shall be removed when
- Users may execute
Stack.SetFIFO(true)
to invoke FIFO append/truncate behavior - Users should not change the scheme in effect once [de-]population has commenced during its lifespan
- For those unfamiliar with these concepts:
- Added
Stack.Reveal
method to recursively walk aStack
instance and disenvelop needlessly nested elements- Abstract example:
And[And[And[1x Condition]]]
Stack
-in-Condition
scenarios will be included in this operation- For the moment,
Not
stacks are exempt from this control due to their inverse nature
- Abstract example:
- Added
Stack.Defrag
method to recursively correct contiguity "errors" (i.e.: gaps)- The method will scan the receiver instance and implode, or "collapse", the slices such that no
nil
instances exist between non-nil
slices - When complete, the trailing
nil
sequence is truncated entirely (else the receiver length would have remained constant) - A genuine need for this method would likely be rare and quite unusual -- but not impossible
Stack
-in-Condition
scenarios will be included in this operation, as willStack
-in-Stack
scenarios
- The method will scan the receiver instance and implode, or "collapse", the slices such that no
- Decommissioned old
chan
-based event system in favor of basic*log.Logger
functionality- Standard
*log.Logger
incarnations (e.g.:stderr
,stdout
) are available globally or perCondition
/Stack
- Custom
*log.Logger
instances may be provided by the user - Default logging state is to discard all log events using
io.Discard
, as is recommended - Included convenient LogLevel bit identifiers, allowing numerous verbosity-level permutations
- Included ten (1) unnamed and reserved LogLevel bit identifiers for user customization
- Standard
- Implemented
Interface
interface- Useful in situations where reduced type-assertion for
Condition
andStack
instances (or any qualifying aliased counterparts) would be appreciated by the end-user (this sentiment would apply in particular to extremely complex, nested structures). - The
Interface
interface only offers functionality that is inherently read-only, and only extends a subset of similar such methods that are common to both of the above root types in both name and signature
- Useful in situations where reduced type-assertion for
- Added/enhanced
Len
method support forCondition
instances, the semantics of which are as follows:- If receiver is not initialized, or if no expression has been set, a length of zero (0) is returned
- If receiver contains an expression that is a
Stack
(or alias of same) instance, its ownLen()
semantics apply and may return any integer (even zero (0)) - A length of one (1) is returned as a fallback, representing the abstract length of a single
Condition
- Added
Addr
method for bothCondition
andStack
type instances- This performs a crude internal call to
fmt.Sprintf
using the%p
verb to print the memory address currently occupied by the underlying embedded instance - Mainly useful for unit tests, debugging or troubleshooting
- Users who do not label their objects may find this mildly useful in some scenarios
- This performs a crude internal call to
- Added
SetID
method functionality to allow the (very) basic randomized generation of twenty-four (24) alphanumeric characters for convenient automatic naming of objects; this is triggered by the input of_random
for an ID to setmath/rand
is used, as this is not a security-sensitive feature- Similarly,
_addr
will automatically invoke theAddr
method for the convenient naming of objects
- Added more traditional error handling support for
Stack
andCondition
types, without sacrificing the fluent method signature designStack
andCondition
types now extends theErr() error
method to allow the commonplaceif err != nil
-style checks for users who prefer that over the act of chaining fluent method calls that may obscure a particular problem's true source- Conversely, the
SetErr(err error) <fluent return type>
has been added to allow users to specify their own error conditions, when needed, or to unset an error instance already present within the receiver
- Misc. changes
- Documentation improvements, typo corrections
- Updated bullet-point documentation blocks to reflect the newer
pkgsite
syntax, thus avoiding the double-spaced lines between line-items that have plagued Gophers since the days of Godoc
- Misc. bug fixes
- Corrected issue with
Stack.Cap
not returning the correct user-facing integer value- This did not impact the actual capacity -- only the expected number of slices were permitted for addition; no more and no less than that
- The offset for the 'hidden' configuration slice was not reflected during interrogation procedures, thus a capacity of four (4) would return five (5) when
Stack.Cap
was executed
- Corrected issue with
Condition
type conversion attempts failed due to incorrect control type defined - Corrected inconsistent pointer usage for
Condition
method signatures (Init
is now the only*Condition
signature bearer, as it should be) - Corrected issue where
Condition.SetExpression
was setting the native type instance of an assertion value, as opposed to the actual assertion value. For example:- User Bob submits type-aliased
stackage.Stack
instance -- let's saymain.MyStack
-- to a newly assembledstackage.Condition
instance using itsSetExpression
method - The internal methods that evaluate the submitted assertion value will, at some point, check to see if the type instance is either a native
stackage.Stack
OR a type alias of same - In Bob's case, this check evaluted as true and the value was accepted
- Unfortunately, the value that was actually written was the return value of an internal "alias->stack" converter; this should have been shadowed, and not used, as the process merely should look to see IF the assertion value is a
stackage.Stack
, but not actually use the converted value - The solution was simply to use the originally submitted value, as-is, once it passed the requisite checks
- User Bob submits type-aliased
- Corrected needlessly-padded
Stack.Kind
return value- Padding was originally applied to this value for string representation requests which contained one (1) or more Boolean WORD-based logical sequences (e.g.:
value AND othervalue
) - WORD operators should always have padding; SYMBOL operators may, or may not, have padding
- Padding is now applied as expected, but is limited to operation within the
String()
methods, and no longer influences its component values directly outside of this scenario - Users and applications that were previously trimming the
Stack.Kind()
return value (e.g.:strings.TrimSpace(myStack.Kind())
) may cease doing so at their leisure
- Padding was originally applied to this value for string representation requests which contained one (1) or more Boolean WORD-based logical sequences (e.g.:
- Corrected issue with
v0.0.3-alpha.0
stack.go
,cfg.go
- Fix unreliable
Stack.Fold
behavior
- Fix unreliable
stack_test.go
- Update "folded" tests to match correct result
Historical changelog
v0.0.2-alpha.9
stack.go
- Fix panic of bogus
Stack.Remove
call
- Fix panic of bogus
go.mod
- Retract
v0.0.2-alpha.4
throughv0.0.2-alpha.8
- Retract
v0.0.2-alpha.7
stack.go
- fix panic with
Stack.Reset
onnil
receiver instance
- fix panic with
v0.0.2-alpha.6
stack.go
- Change
Stack.JoinDelim
toStack.SetDelimiter
- Update
Stack.SetDelimiter
to allow arune
value in addition to astring
(rune
is then cast tostring
for preservation) - Implement
Stack.Delimiter
to return current (LIST) delimiter value as astring
- Relevant commentary
- Change
stack_test.go
- Add
Stack.SetDelimiter
andStack.Delimiter
unit tests
- Add
cfg.go
- Equivalent private function updates to that of
stack.go
above - Implement check within
nodeConfig.setListDelimiter
to bail out (silently) ifstackType
value is notlist
- Equivalent private function updates to that of
v0.0.2-alpha.5
stack.go
- Fix missing symbolic padding
stack_test.go
- Add unit test to identify missing padding
go.mod
- Retract
v0.0.2-alpha.4
- Retract
v0.0.2-alpha.4
go.mod
- Retract old releases
v0.0.2-alpha.3
cond.go
- Update FCF signature callers for
ValidityPolicy
,PresentationPolicy
- Add stringer for all number primitives when assigned through
Condition.SetExpression
orCond(...)
- Add value fallback to
string
primitive when assigned throughCondition.SetExpression
orCond(...)
- Update FCF signature callers for
cond_test.go
- Add "custom keyword" and "custom type" unit tests
stack.go
- Update FCF signature callers for
ValidityPolicy
,PresentationPolicy
- Update FCF signature callers for
fcf.go
- Update FCF signatures for
ValidityPolicy
,PresentationPolicy
closures
- Update FCF signatures for
v0.0.2-alpha.2
cond.go
- Implement
CanNest
,NoNesting
andIsNested
features forCondition
instances - Implement better incremental building for
Condition
instances
- Implement
cond_test.go
- Update unit tests
v0.0.2-alpha.1
cond.go
- Self-initialization routine for
Condition
instances when a nil instance is modified
- Self-initialization routine for
stack.go
- Commentary corrections
- Add
IsInit
method for simple initialization state check ofStack
instances - Add
CanNest
,NoNesting
andIsNested
methods for constraining (or assessing) the hierarchical nature of aStack
instance - Improved panic protection; all top-level (exported) functio...