Comments (4)
Thanks for the explanation. I'm just thinking what I may need for the future, so I don't have an actual use case yet. I will create issue/PR for documentation if I meet and solve problems dealing with absent data in my program.
from toml-f.
The (optional) fourth argument in the getter interface for tables is the default value.
Usually you do not need to explicitly check for presence. The has_key
type bound procedure can be used, but I recommend the error handling recipe instead on ways to check directly using the getter interface.
from toml-f.
Thanks for the quick explanation. Sorry for my ignorance, but one more question, is the "error handling recipe" you mentioned referring to the stat
optional argument in the get_value interface?
I see snippets like this in the How-Tos/Reporting errors
call get_value(table, "timestep", config%timestep, 0.5, stat=stat, origin=origin)
if (stat /= 0) then
print '(a)', context%report("Cannot read timestep", &
& origin, "expected real value")
stop 1
end if
from toml-f.
I don't think there is an explicit recipe yet targeting this topic. The error reporting recipe does this touch a bit, also there are some mentions in the table handling recipe section.
If you have a specific use case it might be useful to add it to the recipes and describe how absent data is dealt with. However, the general design strategy of TOML Fortran's getter interface should allow to minimize the need to worry about the existence of keys or entries.
from toml-f.
Related Issues (20)
- Compatibility of datetime data type HOT 2
- Reliable display of colored output in docs
- Compatibility with stdlib
- Return allocation on deletion from table
- child is always associated in get_value even if requested section is missing HOT 2
- Support non-English scripts for bare keys
- Changes implemented in toml-f 0.3.1 compare with 0.2.4 results in FPM tests fail HOT 1
- Internal compiler error detected when building the project HOT 5
- No error stat when a table is missing HOT 2
- Release TOML Fortran version 0.4.0
- Continuously test fpm with latest TOML Fortran HOT 2
- Support null/none/nil value in parser
- Alternatives to ieee_value for creating exceptional values HOT 12
- Compiling with Cray Fortran 14 HOT 9
- cmake CMP0110 warning
- Infinite loop with """\"""
- compilation error with intel/2020 HOT 3
- Support \x escape code in strings
- Support optional seconds in datetime values
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from toml-f.