Skip to content

Convenience types and methods #58

Open

Description

@IngwiePhoenix

Hey.

When working with objects in a C++ function, it turns out that its quite hard to avoid boilerplate code.

I would like to make a few suggestions:

  • Offer wrapper types to access values in objects/arrays. Example: OS::Object obj = os->toObj(...); std::string str = obj["foo"];
  • Offer convenience methods to convert arrays into lists: OS::List ls = os->toList(...); std::string str = ls[0];

I am mainly asking, since I am trying to write a converter between (VarObject)[https://github.com/eJimLee/VarObject] and an OS Object.

I just can't seem to find a "good" way of doing it. So having a method provided by the internals would be very nice. Do you think this could be implemented?

Kind regards, Ingwie.

Activity

  1. unitpoint commented on Sep 17, 2014

    @unitpoint
    Owner

    Programmer have to write own utility functions to convert data between ObjectScript and C++. Note that ObjectScript supports any ObjectScript's value type as key of object property.

    Any ObjectScript object has id (see getValueId, pushValuebyId, retainValueById, releaseValueById). Numbers, booleans and null have no id because they are not controlled by garbage collector.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions