Skip to content

Function kind specified by optional input #91

Open
@jacobwilliams

Description

@jacobwilliams

I want to be able to define a function that behaves like, for example, the intrinsic SIZE function, where the kind of the output is specified by an optional input. Am I correct that this currently isn't possible?

Maybe using something similar to @cmacmackin's parameterized function syntax from #4, combined with a better way to specify the default value of optional arguments (see also #22):

function my_class_size(me, kind=INT32) result(s)
class(my_class) :: me
integer,intent(in),optional,kind :: kind  
integer(kind) :: s 
...
end function my_class_size

See also #78, and also the various issues about generic programming and templates.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Clause 15Standard Clause 15: Procedures

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions