re-loading code

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

re-loading code

Stefan Schmiedl
Greetings,

I'm looking into writing another webapp with gst/iliad.

Given that I keep my code in one file per class, and that I define
a namespace for my package via package.xml, what is the best way
to reload the code for a single class so that I don't have to
walk the "gst-remote --kill ; gst-package ; gst-remote --server"
path so often?

As an example consider the following workflow

  gst iliad/scripts/PackageBuilder.st -a package.st > package.xml
  gst-package -t ~/.st package.xml
  echo "PackageLoader fileInPackage: 'Iliad'; fileInPackage: 'App'. ObjectMemory snapshot: 'iliad.im'" | gst
  gst-remote --server --port $PRIVATE_PORT -I iliad.im 2>&1 | tee iliad.log &
  vi MyWidget.st
  ???

How do I get the updated MyWidget code into the running iliad.im
so that the next invocation actually uses the new code?

I just can't see it.

Time for a walk, obviously,
s.

Reply | Threaded
Open this post in threaded view
|

Re: re-loading code

ZuLuuuuuu
Probably the best solution would be to use VisualGST, then you would also be able to debug your application easily.

I guess some users write shell scripts to make it easier the process you wrote.

You may also use Iliad Application Launcher:

http://forum.world.st/Iliad-Application-Launcher-td2399303.html

But this restarts the whole application so everything is reinitialized.

If you have 1 specific class file to reload then i don't know if something like

gst-remote -e "FileStream fileIn: 'MyClass.st'"

would work?
Canol Gökel
Reply | Threaded
Open this post in threaded view
|

Re: [Help-smalltalk] re-loading code

Stefan Schmiedl
In reply to this post by Stefan Schmiedl
On Sat, 22 Jan 2011 16:52:16 +0100
Stefan Schmiedl <[hidden email]> wrote:

> On Sat, 22 Jan 2011 16:15:27 +0100
> Holger Hans Peter Freyther <[hidden email]> wrote:
>
> > On 01/22/2011 03:55 PM, Stefan Schmiedl wrote:
> > > Greetings,
> >
> > > How do I get the updated MyWidget code into the running iliad.im
> > > so that the next invocation actually uses the new code?
> >
> > In general i think this is something where GNU Smalltalk could be a lot
> > better.
>
> I hope that it's just a matter of finding the correct sequence of message
> sends and then encapsulating them into something short :-)

Looks like it.

> > What I tend to do is to either:
> > a)
> >     $ Smalltalk removeFeature: #MyMod. PackageLoader fileInPackage: #MyMod
>
> What happens to instances of classes defined in package MyMod during
> removeFeature? Are they kept around and migrated somehow to the new structure
> when that is loading?

Yep, they are! I had the "usual" counter counting to 6, then I changed
the ++ and -- methods to perform the calculations for the Collatz sequence
(n -> n/2 on --, n -> 3n+1 on ++) and ran:

gst-remote --eval "Smalltalk removeFeature: #App. PackageLoader fileInPackage: 'App'"

and, big cheer, -- led me to 3, then ++ gave me a 10.

Grinning insanely,
s.