Shop OBEX P1 Docs P2 Docs Learn Events
A new model for universal objects/OBEX needed — Parallax Forums

A new model for universal objects/OBEX needed

Invent-O-DocInvent-O-Doc Posts: 768
edited 2010-09-01 18:13 in Propeller 1
Here is something that impairs our ability to develop using multiple languages: Each language C, PropBASIC, SPIN,etc requires its own set of libraries and objects unique to that language, resulting in incomplete libraries in some language and a lot of duplicative work.

Is there a way we can make things so that ANY language can use SPIN/PASM objects on the OBEX???? Or even compiled C objects?

If we had that capability, some of us can use higher level languages and still enjoy the benefits of the large object library in SPIN/PASM. This might be really critical for getting new users to the propeller.

I'm posting this as a thread because I really believe that something along these lines will increase accessibily and success of the prop, and also the Prop II which really will be better suited to richer language implementations.

This concept works well in Visual Studio and .NET. Any thoughts??

(and please hold off on straw man criticisms of .NET being bloated, etc. - we know that. I intend to introduce the concept of making the objects cross language compatible.)

Comments

  • HumanoidoHumanoido Posts: 5,770
    edited 2010-09-01 08:21
    Invent-O-Doc wrote: Is there a way we can make things so that ANY language can use SPIN/PASM objects on the OBEX???? Or even compiled C objects?

    Hi Invent-O-Doc, that would definitely be a wonderful goal to achieve. If you look at some of the other posts, you will find the deep thought necessary to convert one language to another (i.e. spin to pasm). Here, we are talking about converting SPin to other languages including C and its derivatives. Take a look at the spin to pasm example. It would be possible to convert some languages to other languages in a one on one basis. There is no universal translator in this regard. I have written a program in one language that wrote programs in another language so I know this can be accomplished. But such a project with Spin seeks out those who have studied the prop over the past 3 or more years.

    Humanoido
  • Invent-O-DocInvent-O-Doc Posts: 768
    edited 2010-09-01 08:39
    Hi Humanoido. I'm not so much wondering about converting languages as being able to make calls to objects written in SPIN/PASM from other objects and get values returned to the calling language.
  • Dave HeinDave Hein Posts: 6,347
    edited 2010-09-01 09:33
    The prop provides an "easy" way to mix objects of different languages. Each object would run in its own cog, and they would talk through mail boxes in hub RAM. The problem is that we don't have a standard way to do this.

    Some implementations use a rendezvous area. However, each implementation uses different assignments for the rendezvous locations. Maybe we need to define a standard way to allocate rendezvous locations, and a standard method for passing commands and parameters between cogs.
  • ErNaErNa Posts: 1,753
    edited 2010-09-01 10:52
    My task was to develop a program running different processes in parallel and establish uniform communication. Now, as the question is coming up again, maybe someone look to the answer, I found for my purposes. It is working quite well for Spin and ASM mixed. But when the forum moved, the formats where destroyed, so I have to reformat and then expand the explanation.

    http://forums.parallax.com/showthread.php?t=123630
  • Dave HeinDave Hein Posts: 6,347
    edited 2010-09-01 12:40
    Here's the code I used to perform remote file I/O function calls from one cog to another. It uses two longs in a rendezvous location. The locations are defined in rendezvous.spin. One long is used to pass a command, and the other passes a pointer to the parameter list. After the command is set in the rendezvous location, the caller waits for it to go to zero. It then retrieves a return value that overwrote the parameter list pointer.

    This example is used between two cogs that are both running Spin code. However, it can be applied to any mix of languages between the two cogs. A lock could be added to make it cog-safe.
  • Invent-O-DocInvent-O-Doc Posts: 768
    edited 2010-09-01 16:02
    Those are some good approaches. I guess it would also be possible for creators of other languages to include functionality to call SPIN objects/methods and PASM directly. Is this feasible?
  • RinksCustomsRinksCustoms Posts: 531
    edited 2010-09-01 18:13
    Those are some good approaches. I guess it would also be possible for creators of other languages to include functionality to call SPIN objects/methods and PASM directly. Is this feasible?
    Why not write just two "translator" objects per higher level language, one for spin and one for PASM.. I'm still confused as to why there are objects in the OBEX written exclusively in C. :confused: Would this be easier than rewriting the OBEX library multiple times, one time for each higher level language?
Sign In or Register to comment.