Skip to content

Use '.' to separate scope from variable name instead of '_'. #280

Open
@dorchard

Description

At the moment, the renaming (Language.Fortran.Analysis.Renaming) generates names that use the scope and name and a freshid, but using _ to separate all of these. However since _ is a valid part of an identifier I think this is a little confusing when looking at outputs. Consider:

function area_of_circle(r) result(area)
  real, parameter :: pi = 3.14e0
  real, intent(in) :: r
  real :: area
  area = ((r * r) * pi)
end function area_of_circle

then we get things like


_area_of_circle_1                - Function
area_of_circle_area_2           Real 4 Variable
area_of_circle_pi_4             Real 4 Parameter
area_of_circle_r_3              Real 4 Variable

What about if instead we used .?, i.e.,

% fortran-src program.f90 --typecheck

.area_of_circle_1                - Function
area_of_circle.area_2           Real 4 Variable
area_of_circle.pi_4             Real 4 Parameter
area_of_circle.r_3              Real 4 Variable

Does that have any problems with generated names wanting to be used like actually variables anywhere (i.e., in generated code)? It doesn't appear so.

Metadata

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions