Skip to content

does get operation really need non constant object? #668

Closed
@idkiller

Description

@idkiller

jerry_api_get_object_native_handle
jerry_api_get_array_index_value
jerry_api_get_object_field_value
jerry_api_get_object_field_value_sz

these functions are get operation but functions need non constant object pointer.
I think constant pointer is better if it can.

for example:

  auto cb = [] (const jerry_api_object_t *function_obj_p,
                const jerry_api_value_t *this_p,
                jerry_api_value_t *ret_val_p,
                const jerry_api_value_t args_p[],
                const jerry_api_length_t args_count) -> bool 
  {                                                                             
    uintptr_t p;
    bool err = !jerry_api_get_object_native_handle(const_cast<jerry_api_object_t*>(function_obj_p), &p);
    // use p
  };
  jerry_api_object_t *jfunc = jerry_api_create_external_function(cb);

In many case, user need native handle when call there external function,
but object pointer from external function pointer is constant pointer. so user must casting it to non constant object.

What do you think about it?

Metadata

Metadata

Assignees

No one assigned

    Labels

    apiRelated to the public API

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions