Closed tclune closed 2 months ago
I now realize the problem is likely broader than what I wrote above. Match should return false for the following pairs:
1
vs "1"
3.14
vs "3.14"
I also realize that my implementation of match has a bit of the opposite problem as it will presumably say that the following do not match: 1
vs +1
. So I need to convert each scalar to the right type and then compare values. Comparing strings just handles the usual cases.
Hi Tom (@tclune), I made some progress on this issue. The current status is per branch https://github.com/esmf-org/esmf/tree/feature/hconfig-extras. There is now a discussion about the additional Boolean values and the "Norway problem" under section https://earthsystemmodeling.org/docs/nightly/feature/hconfig-extras/ESMF_refdoc/node6.html#SECTION0601031200000000000000 (see section 48.3.12.8).
A few notes here:
HConfigCreate()
from content
did not preserve quotes in the string. Actually HConfig was doing everything right (at least the way I see it), but the yaml-cpp backend did not preserve the quotes for this case. This behavior was different from how yaml-cpp treats the same case (quotes around a string) when reading from file. So I "fixed" this inside of the yaml-cpp version we keep internal to ESMF.content
string). Either way now a quoted string is marked via tag:yaml.org,2002:str
.Excellent. Am looking forward to understanding the approach to the Norway problem given that my understanding is that hconfig keeps everything as strings internally …
From: Gerhard Theurich @.> Date: Monday, May 20, 2024 at 7:20 PM To: esmf-org/esmf @.> Cc: Clune, Thomas L. (GSFC-6101) @.>, Mention @.> Subject: [EXTERNAL] [BULK] Re: [esmf-org/esmf] Bug in ESMF_HConfigLayer - misdiagnosis of string as bool (Norway problem) (Issue #222) CAUTION: This email originated from outside of NASA. Please take care when clicking links or opening attachments. Use the "Report Message" button to report suspicious messages to the NASA SOC.
Hi Tom @.***https://github.com/tclune), I made some progress on this issue. The current status is per branch https://github.com/esmf-org/esmf/tree/feature/hconfig-extras. There is now a discussion about the additional Boolean values and the "Norway problem" under section https://earthsystemmodeling.org/docs/nightly/feature/hconfig-extras/ESMF_refdoc/node6.html#SECTION0601031200000000000000 (see section 48.3.12.8).
A few notes here:
— Reply to this email directly, view it on GitHubhttps://github.com/esmf-org/esmf/issues/222#issuecomment-2121378068, or unsubscribehttps://github.com/notifications/unsubscribe-auth/ABPP7YD4STLJOQWNZQTBXJLZDKAMHAVCNFSM6AAAAABCW5ZZXSVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDCMRRGM3TQMBWHA. You are receiving this because you were mentioned.Message ID: @.***>
No further user response. All of the recent HConfig code improvements have been merged into the develop
branch for the 8.7 release.
If HConfig is given a quoted string like
"no"
, it is still saying that this string is a boolean as if it was justno
. Probably not a major problem in user code, where the intended type is known. But in implementing MAPL_HConfigMatch() it indicates those two hconfigs match and I don't see a good way to disambiguate from outside.Not urgent, but ... needs to be fixed.