Language design : How to type higher order functions parameters?

I’m trying to design a theoretical programming language and I’m facing a problem with high order functions. The language is strong-typed, so the way to define a standard function is like so :

function name ( type1 arg1 , type2, arg2, ... ) : return_type 

There’s also a way to define data structures like classes (that are types) :

class MyClass {     type1 attribute1;     type2 attribute2;     ... } 

Now, I would like to extend the function definition to higher-order so that parameters and return values can be classes (types), attributes or functions. For instance having the capability of defining a function that takes as parameter a class or a class member. Let’s take an exemple :

function sort ( List<something> data, ??? attribute_name , ??? sorting_function ) : List 

This function is supposed to take as first parameter as List of something-typed instances, as second parameter an attribute of the something class, and as third parameter a comparison function. And attribute_name and sorting_function have to be typed. But how ? What should be instead of the ??? ?

I consider an heresy to create a function, class, or attribute type, since they wouldn’t be at the same logic-level than data types. This would also imply to have type type, which is even more confusing.

I’m probably missing something in my language-design logic because I’m somehow trying to mix at the same logic-level data and language structure but I totally don’t know how to achieve what I want otherwise.

Edit :

To give more details, what matters to me is to have a true seperation between data and models. For instance what we can do in languages such as python or php like :

getattr(obj, attr_name) 


$  obj->$  attr_name 

doesn’t suit my logic since we use data-level (strings) to access attributes, which are structure-level.

In my sort function I gave as example (let’s forget the last parameter) we have :

function sort ( List<something> data, ??? attribute_name ) 

The type of attribute_name cannot be a string, since attributes are not data-level. There should be proper type that designate attributes (class members). But such a type is not a data-type. The real problematic is finding a way to distinguish data-types from strucutre/meta-types that correspond to the different langauge structures.