Re: Stackless?

Ian McCullough <[email protected]> Mon, 17 Feb 2014 14:34:46 -0500
Newsgroups gmane.comp.python.pyobjc.devel
Message-ID <CADa4atWK9jFbx+vtyFGm79pcUFKUDiurQaEH0Rv1Lg=0N-6dKQ@mail.gmail.com>
Yeah, I'm not delusional enough to think that the whole NS* world would
magically be pickle-able, but it seemed within the realm of possibility
that I could implement pickling for the small subset of classes that
comprised my model. It still does seem like a reasonable proposition, but
I'm seeing enough squirrelly behavior between the stackless interpreter and
pyobjc right off the bat, that I'm sort of hesitant to press onward.  The
first thing was the fact that PyHeapTypeObject is the same as PyTypeObject
in stackless, so I had to go through and remove all the places that
accessed the ht_type of PyHeapTypeObject. A straightforward change, to be
sure, but then I started seeing lots of weirdness at run time (lots of
null-ptr dereferences around the python <-> pyobjc boundaries that made no
sense). I might have been willing to bite off the task of maintaining a
vendor branch of pyobjc for running with stackless python, but I don't want
to end up maintaining a vendor branch of stackless as well, so...

As far as serializing execution state, the classic native approach would be
to break the code down into a state machine, and then serialize the state
machine. For non-trivial code (you know, anything with loops or
subroutines, etc), breaking it down into a state machine becomes tedious.
Not using python also eliminates the scripty-ness/dynamism of using python.
By using python to implement the logic and flow, it becomes that much
easier to experiment with minor variations in the logic, etc.

Oh well... I might bang on it a little more to see what I can see, but I
assume that if someone on this list were up and running with pyobjc and
stackless they would have posted by now...

Thanks,
Ian


On Sun, Feb 16, 2014 at 3:57 PM, Diez B. Roggisch <[email protected]> wrote:

> I thought it was something along these lines.
>
> I guess all you can do is to set up your "host" application in a way that
> it can restore the save-game state from scratch, regardless of what that
> state currently is.
>
> But hoping that the whole NS*-world is persistable is bound to be
> disappointing :)
>
> Diez
>
> On Feb 16, 2014, at 9:28 PM, Ian McCullough <[email protected]> wrote:
>
> The idea is to have a native Objective-C app, which hosts a stackless
> python interpreter in-process. The main feature of interest to me is the
> ability of stackless python to serialize a tasklet and deserialize and
> resume it later. Think of it as a "save game" mechanism, where the game
> logic is implemented in python -- you can save your game by serializing the
> state of the tasklet, and restore it later.
>
> The usage of pyobjc was intended to keep from having to keep a python-side
> model and a native-side model in sync.
>
> FWIW, I actually managed to get pyobjc to compile against stackless with
> some slight modifications, but I'm seeing some real weird behavior at
> runtime, so I'm not holding out much hope.
>
> Ian
>
>
>
> On Sun, Feb 16, 2014 at 3:17 PM, Diez B. Roggisch <[email protected]> wrote:
>
>> As long as objective C isn't stackless, I doubt there is much use to it.
>> What's your purpose?
>>
>> Diez
>>
>> On Feb 14, 2014, at 10:01 PM, Ian McCullough <[email protected]> wrote:
>>
>> >
>> > Is it possible to build PyObjC for use with Stackless python?  My
>> attempts are pointing to "No" but I figured I'd ask.
>> > Thanks,Ian
>> >
>> >
>> ------------------------------------------------------------------------------
>> > Android apps run on BlackBerry 10
>> > Introducing the new BlackBerry 10.2.1 Runtime for Android apps.
>> > Now with support for Jelly Bean, Bluetooth, Mapview and more.
>> > Get your Android app in front of a whole new audience.  Start now.
>> >
>> http://pubads.g.doubleclick.net/gampad/clk?id=124407151&iu=/4140/ostg.clktrk_______________________________________________
>> > Pyobjc-dev mailing list
>> > [email protected]
>> > https://lists.sourceforge.net/lists/listinfo/pyobjc-dev
>>
>>
>
> ------------------------------------------------------------------------------
> Android apps run on BlackBerry 10
> Introducing the new BlackBerry 10.2.1 Runtime for Android apps.
> Now with support for Jelly Bean, Bluetooth, Mapview and more.
> Get your Android app in front of a whole new audience.  Start now.
>
> http://pubads.g.doubleclick.net/gampad/clk?id=124407151&iu=/4140/ostg.clktrk_______________________________________________
> Pyobjc-dev mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/pyobjc-dev
>
>
>

------------------------------------------------------------------------------
Managing the Performance of Cloud-Based Applications
Take advantage of what the Cloud has to offer - Avoid Common Pitfalls.
Read the Whitepaper.
http://pubads.g.doubleclick.net/gampad/clk?id=121054471&iu=/4140/ostg.clktrk

_______________________________________________
Pyobjc-dev mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/pyobjc-dev