Skip to content

Time for polymorphism? #405

Open
@jacobwilliams

Description

@jacobwilliams

Originally, when I was creating this code by updating the old FSON code, I made the data in json_value polymorphic. But, I had to get rid of that at the time because of some compiler bug (I think it was a memory leak in ifort). Currently, each json_value contains all possible types it can hold and we just allocate the one we need:

 real(RK),allocatable                 :: dbl_value  !! real data for this variable
 logical(LK),allocatable              :: log_value  !! logical data for this variable
 character(kind=CK,len=:),allocatable :: str_value  !! string data for this variable
                                                    !! (unescaped)
 integer(IK),allocatable              :: int_value  !! integer data for this variable

 integer(IK) :: var_type = json_unknown  !! variable type

I never liked this though. Maybe it's time to revisit this.

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions