Provide abstract base class for a string object #333
Closed
+3,702
−1
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This patch implements an abstract base class (ABC) for an extendible string class (not to be confused with the non-extendible string type). The implementation also shows the full insanity of object oriented string handling in Fortran required to just support the intrinsic functionality and sheds some light on the current state of compilers implementing class inheritance.
Goals of this PR
string_type
Design strategy
string_type
as return value rather than returning polymorphic string objectsstdlib_string_class
defines and exports overloaded interfaces for the ABC, which should be reexported in implementations to provide intrinsic functionality (still requires explicit import)string_class
can be created by assignment from character values, string types or string objectsAdditional resources
I prepared the
stdlib_string_class
module in awvwgk/stdlib_string as fpm project. The specs are available at https://awvwgk.github.io/stdlib_string. The projects also includes a version of ftlString and StringiFor based on thestring_class
proposed here.