-
Notifications
You must be signed in to change notification settings - Fork 39
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Hocon improvement. #218
Hocon improvement. #218
Conversation
- GetString(), GetStringList(), GetInt(), and GetDouble() throws on failure instead of returning a default value (Major change in Akka.NET). - Add TryGet[DataType]() functions to all getters to eliminate as much Exception throwing as possible to improve performance. - Remove as much wrapping functions as possible to improve performance. - Fix Config.Equal infinite loop bug.
Love that idea. |
…iled to merge the fallbacks correctly.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These changes look fantastic. Big improvements here.
ReferenceEquals(oldA, a).Should().BeTrue(); | ||
oldAContent.Should().Equals(a); | ||
} | ||
|
||
[Fact] | ||
public void WithFallback_ShouldMergeSubstitutionProperly() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, this is the reproduction case you were talking about. Good, glad we have it.
public Config Config { | ||
get | ||
{ | ||
if (_config == null && !string.IsNullOrWhiteSpace(Hocon.Content)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good optimization
@@ -54,22 +54,38 @@ public HoconRoot(HoconValue value, IEnumerable<HoconSubstitution> substitutions) | |||
/// </summary> | |||
public IEnumerable<HoconSubstitution> Substitutions { get; private set; } | |||
|
|||
protected virtual HoconValue GetNode(HoconPath path, bool throwIfNotFound = false) | |||
protected virtual bool TryGetNode(string path, out HoconValue result) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice addition
{ | ||
return WrapWithValueException(path.ToString(), () => |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These designs, using the Try
methods instead of WrapWithValueException
, are a major improvement.
Still related to akkadotnet/akka.net#4128
IEquitable<Config>
interface implementation toConfig
classGetString()
,GetStringList()
,GetInt()
, andGetDouble()
throws on failure instead of returning a default value (Major change in Akka.NET).TryGet[DataType]()
functions to all getters to eliminate as much Exception throwing as possible to improve performance.