Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Can I do it with ObjC ?

32 views
Skip to first unread message

101

unread,
Oct 15, 1997, 3:00:00 AM10/15/97
to


We are working on an inet multiuser game. It were a server written in
C++ (or ObjC ?), and there were a Java client, that would show pictures,
play sounds and so on... (It were a MUD if you know what it is...)

But there are some problems:

- We have to be able to develop classes even if the server is running...
I mean I must be able to change a class without stopping the server.
It's because the world will be changing always as it's being
developed... We have an idea how to do it under C++, but it's a hack,
we have to make a global function table, sg like virtual functions in
C++, and change it if there's a new version. All the functions were in
DLL and they were linked in this special table. And every phisical
object should have a version number that determines the compatibility
with the new version of the class and if it's not compatible it should
be saved to disk and a new object should be created that reads in this
file and loads it's variables with the data that were saved by
the previous version... (My gash, hope you understood my English... :)

(There are dragons and magicians, and such things.... SEVERAL types
of weapons, these weapons can be used by monsters and players too, and
if I [a player] drop a weapon somewhere, log out, the server is shut
down maybe, and I log in again a few days later, and if noone removed
that weapon that must be there... and if that weapon class was
changed.... grrr I hope you can see what it's all about...)

- The other important thing we need is that we must be able to save
objects to disk and after a restart we must be able to reload these
objects. (For example there's a sword lying somwhere on the map and
if there's a shutdown we must save all the datas of this object
and after a restart we must be able to reload it and replace it on
the map where it was before the shutdown... And player stats should
also be saved and nearly every object...)

Currenly we have plans for these problems, and it's getting clean that
we can code it, too, but if it's done in a language (because it can be
done, if we can do it !) we should not waste our time with it...

We would use CodeWarrior under BeOS... (www.be.com, It's COOOOOL, have a
look at it if you don't know it already...)

So I would appreciate your response, because I just don't anything about
ObjC and one of my friend said that he read something like this when he
was reading about ObjC.

That's all
- 101.


David Stes

unread,
Oct 15, 1997, 3:00:00 AM10/15/97
to 101

101 wrote:
>
> We would use CodeWarrior under BeOS... (www.be.com,
> It's COOOOOL, have a
> look at it if you don't know it already...)
>
> So I would appreciate your response, because I just don't anything
> about ObjC and one of my friend said that he read something like
> this when he was reading about ObjC.

I suppose you could just try and see whether it's a useful tool.

There's no package yet for BeOS, on
http://www.can.nl/~stes/compiler.html, but since the sources have
been ported before to MWCPPC (Metrowerks PPC compiler), it should be
relatively easy to compile a version for mwcc on Beos too (same
class of C compiler, I suppose).

David.

Steve Dekorte

unread,
Oct 16, 1997, 3:00:00 AM10/16/97
to

101 <1...@goliat.eik.bme.hu> wrote:


> But there are some problems:

> - We have to be able to develop classes even if the server is running...
> I mean I must be able to change a class without stopping the server.
> It's because the world will be changing always as it's being
> developed... We have an idea how to do it under C++, but it's a hack,

You can do more stuff like this in Objective-C or Java, but you can't easily create
new classes at runtime with these. Smalltalk can handle that much more
easily, but you'll still have the problems related to changing classes belonging
to existing instances that all class-based languages have. A prototype-based
language is what you really need for complete flexibility. You might want to
check out Lua and Cecil.

http://zaphod.physik3.gwdg.de/~rainer/comp/lang/object-based.html

--
Steve Dekorte - OpenStep consultant - San Francisco

David Stes

unread,
Oct 16, 1997, 3:00:00 AM10/16/97
to

Steve Dekorte wrote:
>
> A prototype-based language is what you really need for
> complete flexibility.
>
> You might want to check out Lua and Cecil.

There's good ideas in something like Self etc., although that
I'm personally not convinced that the class based approach (
classes, instances etc.) is to be traded in for a prototype
based approach in all cases.

In any case, the distincive "characteristic" of Objective-C
is that it has a very direct model to integrate C code;

In Lua, to register a C function, and access it from
within Lua, you have to write a wrapper for the function
to export it towards Lua (with some sort of external
function interface), using functions like C2lua() and
lua_getparam() and the "struct lua2C".

In Objective-C, you simply have :

static
int foo(...) { }

- bar
{
foo();
}

This makes the Objective-C method |-bar| call the C function foo().

So it integrates very well with C.

David.

Bjorn Pettersen

unread,
Oct 16, 1997, 3:00:00 AM10/16/97
to

David Stes wrote:

> Steve Dekorte wrote:
> >
> > A prototype-based language is what you really need for
> > complete flexibility.
> >
> > You might want to check out Lua and Cecil.
>
> There's good ideas in something like Self etc., although that
> I'm personally not convinced that the class based approach (
> classes, instances etc.) is to be traded in for a prototype
> based approach in all cases.

If you want a completely dynamic oo system I would probably choose a scripting language like
Python... (has graphics, no real types, is a small language, and integrates well with C, and works
on most platforms).

Check out http://www.python.org/ for details.

Bjorn

Steve Dekorte

unread,
Oct 17, 1997, 3:00:00 AM10/17/97
to

David Stes <st...@mundivia.es> wrote:
> I would (quite appropriately to comp.lang.objective-c !)
> choose Objective-C to implement the inet game server that the
> original posting was discussing.

So how do you dynamically create and change classes at runtime in Objective-C?
Ok, so how in Objective-C do you add/remove/modify methods/classes/ivars at runtime?

Objective-C is great, but it simply was not designed for these things.
(any more than C++ was designed for writing things like GUI apps)

David Stes

unread,
Oct 17, 1997, 3:00:00 AM10/17/97
to

Steve Dekorte wrote:
>
> Objective-C is great, but it simply was not designed for these things.
> (any more than C++ was designed for writing things like GUI apps)

C++ certainly has libraries to develop GUI's.

Bjorn Pettersen also pointed out that Python has graphics.
So both seem a good choice for implementing graphics.

How would he do graphics on BeOS in Objective-C?

David.

Marco Scheurer

unread,
Oct 17, 1997, 3:00:00 AM10/17/97
to

On 10/16/97, Steve Dekorte wrote:
>101 <1...@goliat.eik.bme.hu> wrote:
>
>
>> But there are some problems:
>
>> - We have to be able to develop classes even if the server is
running...
>> I mean I must be able to change a class without stopping the
server.
>> It's because the world will be changing always as it's being
>> developed... We have an idea how to do it under C++, but it's a
hack,
>
> You can do more stuff like this in Objective-C or Java,
> but you can't easily create new classes at runtime with these.
> Smalltalk can handle that much more easily,

Using dynamically loaded code (for instance with OPENSTEP bundles), it
is possible (and easy) to add classes at runtime in Objective-C.
Granted, it is not as flexible as with other languages already
mentionned in this thread.

I would use LISP or CLOS.

--
Marco Scheurer
Sen:te

(remove "dot mil" from my address)


Kristian Koehntopp

unread,
Oct 17, 1997, 3:00:00 AM10/17/97
to

David Stes <st...@mundivia.es> writes:
>can be - trivially - used in Objective-C ... Maybe libwww
>still contains Objective-C (don't know).

It doesn't. The Code to the Cern Web Server does no longer
contain ObjC, but the C code in both projects still lokks
ObjC-ish.

Kristian
--
"Then came the churches, then cames the schools, | Kristian Koehntopp
then came the lawyers, then came the rules, | Wassilystrasse 30
then came the trucks with their load | 24113 Kiel
and the dirty old track was the Telegraph Road..." | +49 431 688897

Bjorn Pettersen

unread,
Oct 17, 1997, 3:00:00 AM10/17/97
to

David Stes wrote:

> Bjorn Pettersen wrote:


> >
> > > Steve Dekorte wrote:
> > >
> > > > You might want to check out Lua and Cecil.
> >

> > I would probably choose a scripting language like
> > Python ...
>

> Python's of course cool, but it's an interpreted
> scripting language, which puts it in a different category
> than Objective-C ...

Very true :-) I've had a NeXT since '92, and I have even written part of a compiler in Obj-C, so I
do love the language. It seems to me that Python is very good for rapid prototyping, however, and it
is a lot easier to translate Python code to Obj-C than to C++.

Personally I think everyone should prototype in an interactive language... anyone know the status of
the gnu c interpreter?

Bjorn


Kristian Koehntopp

unread,
Oct 18, 1997, 3:00:00 AM10/18/97
to

101 <1...@goliat.eik.bme.hu> writes:
> We are working on an inet multiuser game. It were a server written in
>C++ (or ObjC ?), and there were a Java client, that would show pictures,
>play sounds and so on... (It were a MUD if you know what it is...)

Many MUDs are written in LPC. A derivative of LPC ist pike,
formerly called ulpc (Micro LPC), which is a very fast object
oriented language with a great potential for dynamism and
dynamic code loading. Binding mechanisms are more similar to
ObjC than to C++.

The Roxen Web Server is (or at least was) completely written in
pike/ulpc with a few language extensions compiled as primitives
and linked to the ulpc interpreter itself. See www.roxen.com for
documentation on the Web Server product (there is (or at least
was) a free version of Roxen available as well).

http://www.roxen.com/documentation/pike_tutorial/tutorial.html

for an overview and

The history of Pike

In the beginning, there was Zork. Then a bunch of people decided
to make multi-player adventure games. One of those people was
Lars Pensjö at the Chalmers university in Gothenburg, Sweden.
For his game he needed a simple, memory-efficient language, and
thus LPC (Lars Pensjö C) was born. About a year later I started
playing one of these games and found that the language was the
most easy-to-use language I had ever encountered. I liked the
language so much that I started improving it and before long I
had made my own LPC dialect called LPC4. LPC4 was still geared
towards writing adventure games, but was quite useful for
writing other things with as well. A major problem with LPC4 was
the copyright. Since it was based on Lars Pensjö's code, it came
with a license that did not allow it to be used for commercial
gain. So, in 1994 I started writing µLPC, which was a new but
similar LPC interpreter. I got financial backing from Signum
Support AB for writing µLPC. Signum is a company dedicated to
supporting GNU and GPL software and they wanted to create more
GPL software.

When µLPC became usable, InformationsVävarna AB started using it
for their web-server. Before then, Roxen (then called Spinner)
was non-commercial and written in LPC4. Then in 1996 I started
working for InformationsVävarna developing µLPC for them. We
also changed the name of µLPC to Pike to get a more commercially
viable name.

A comparison with other languages

Python

Python is probably the language that is most like Pike. Pike
is faster and has better object orientation. It also has a
syntax similar to C++, which makes it more familiar for
people who know C++. Python on the other hand, has a lot more
libraries available.

C++

Pike's syntax is almost the same as for C++. A huge
difference is that Pike is interpreted. This makes the code
slower, but reduces compile times to almost nothing. For
those few applications which require the speed of C or C++,
it is often easier to write a Pike extension than to write
the whole thing in C or C++.

Lisp and Scheme

Internally Pike has a lot in common with Lisp and Scheme.
They are both stack based, byte-compiled, interpreted
languages. Pike is also a 'one-cell' language, just like
Scheme.

Pascal

Pike has nothing in common with Pascal.

Tcl/Tk

Pike is similar to Tcl/Tk in intent and they both have good
string handling. Pike has better data types and is much
faster however. On the other hand Tcl/Tk has X windows
system support.

What is Pike

Pike is:
A programming language
Object oriented
Interpreted
Fast
Dynamic
High-level
similar to C++
easy to extend
(a fish)

Pike has:
Garbage collection
Advanced string functions
5 years of development behind it
Advanced data types such as asociative arrays
Support for bignums
Builtin socket support

-- Fredrik Hübinette

See also:

The Pike Homepage
http://pike.idonex.se/


Kristian
--
Kristian Koehntopp, Wassilystrasse 30, 24113 Kiel, +49 431 688897
"Spricht nicht der HERR: "Du sollst Dir kein Bildnis machen" und
verdammet alle GUI's fuer und fuer?"
-- m.l...@hit.sb.sub.de (Martin Lange) in de.talk.bizarre

Niels Möller

unread,
Oct 18, 1997, 3:00:00 AM10/18/97
to

kr...@koehntopp.de (Kristian Koehntopp) writes:

> Many MUDs are written in LPC. A derivative of LPC ist pike,
> formerly called ulpc (Micro LPC), which is a very fast object
> oriented language with a great potential for dynamism and
> dynamic code loading. Binding mechanisms are more similar to
> ObjC than to C++.
>
> The Roxen Web Server is (or at least was) completely written in
> pike/ulpc with a few language extensions compiled as primitives
> and linked to the ulpc interpreter itself. See www.roxen.com for
> documentation on the Web Server product (there is (or at least
> was) a free version of Roxen available as well).

Roxen i still written in Pike. The base version is GPL:ed, while a few
modules aimed at really demanding web-sites are being developed for
release under a more restrictive license. Yes, I work for Idonex, the
makers of Roxen and Pike.

From time to time, I advocate that Objective-C features, like
protocols, be incorporated into Pike. There are also a few other
interesting things done; for example Per Hedbor and David Kågedal have
been coding an implementation of distributed objects for Pike, which
seems to work quite well, offering proxy objects and functions, proper
exception handling, etc.

When speaking of games, Fredrik Hübbinette, the author of Pike, is
coding a MUD in Pike, together with his wife. Another game is Stellar
Crisis mkII, a strategy game on the www.

Best regards,
/Niels Möller

Christian Sunesson

unread,
Oct 18, 1997, 3:00:00 AM10/18/97
to

On 17 Oct 97 08:35:03 GMT, Marco Scheurer wrote.

> > You can do more stuff like this in Objective-C or Java,
> > but you can't easily create new classes at runtime with these.
> > Smalltalk can handle that much more easily,
>
> Using dynamically loaded code (for instance with OPENSTEP bundles), it
> is possible (and easy) to add classes at runtime in Objective-C.
> Granted, it is not as flexible as with other languages already
> mentionned in this thread.

I really want this made possible in gnu objc runtime!!!!

--
### christian...@abc.se ###

Steve Dekorte

unread,
Oct 19, 1997, 3:00:00 AM10/19/97
to

Marco Scheurer <ma...@sente.ch.mil> wrote:
> On 10/16/97, Steve Dekorte wrote:
> Using dynamically loaded code (for instance with OPENSTEP bundles), it
> is possible (and easy) to add classes at runtime in Objective-C.
> Granted, it is not as flexible as with other languages already
> mentionned in this thread.

So you're suggesting the running code spit out more code which gets
(hopefully) compiled in a background process and dynamically linked?
This is not elegant or easy compared with doing this in Smalltalk.

> I would use LISP or CLOS.

Or Scheme, of course it would run about 5x or more times slower
than Lua or Smalltalk.

John C. Randolph

unread,
Oct 19, 1997, 3:00:00 AM10/19/97
to

In <626iet$306$1...@owl.slip.net> Steve Dekorte wrote:
-> David Stes <st...@mundivia.es> wrote:
-> > I would (quite appropriately to comp.lang.objective-c !)
-> > choose Objective-C to implement the inet game server that the
-> > original posting was discussing.
->
-> So how do you dynamically create and change classes at runtime in
-> Objective-C?

The same way that IB does it. You use the functions objc_addClass(),
class_poseAs(), class_addMethods(), and/or class_removeMethods(). It's all
there, we just don't use these facilities most of the time because bundles
generally suffice for what we need to do.

-> Ok, so how in Objective-C do you add/remove/modify methods/classes/ivars
-> at runtime?

Methods and classes, you do using the functions I mentioned. Ivars, you can
use a few tricks. One trick I use now, is just to use an instance of
NSMutableDictionary as the entire storage of an instance.

-> Objective-C is great, but it simply was not designed for these things.

It's not quite as convenient to do these things in Obj-C as say, Python or
Perl 5, but it's certainly doable.

-jcr

--
John C. Randolph (408) 358-6732 NeXT mail preferred.
Chief Technology Officer, WARPnet Incorporated.
@"Hey, %s! You're a NAZI, and you can't spell!"


James T. Romano

unread,
Oct 19, 1997, 3:00:00 AM10/19/97
to 101

Hello,
As an Ex-NeXTStep programmer (Objective-C), you could do exactly what
you are describing. It looks like you'll probably run into some memory
problems. As for keeping objects persistant on disk, well I know that
NeXTStep, err, Openstep does have this, but as for plain old
Objective-C, well I think you'll have to write your own persistance
mechanism. You could do it. Good luck

101 wrote:
>
> We are working on an inet multiuser game. It were a server written in
> C++ (or ObjC ?), and there were a Java client, that would show pictures,
> play sounds and so on... (It were a MUD if you know what it is...)
>

> But there are some problems:
>
> - We have to be able to develop classes even if the server is running...
> I mean I must be able to change a class without stopping the server.
> It's because the world will be changing always as it's being
> developed... We have an idea how to do it under C++, but it's a hack,

> we have to make a global function table, sg like virtual functions in
> C++, and change it if there's a new version. All the functions were in
> DLL and they were linked in this special table. And every phisical
> object should have a version number that determines the compatibility
> with the new version of the class and if it's not compatible it should
> be saved to disk and a new object should be created that reads in this
> file and loads it's variables with the data that were saved by
> the previous version... (My gash, hope you understood my English... :)
>
> (There are dragons and magicians, and such things.... SEVERAL types
> of weapons, these weapons can be used by monsters and players too, and
> if I [a player] drop a weapon somewhere, log out, the server is shut
> down maybe, and I log in again a few days later, and if noone removed
> that weapon that must be there... and if that weapon class was
> changed.... grrr I hope you can see what it's all about...)
>
> - The other important thing we need is that we must be able to save
> objects to disk and after a restart we must be able to reload these
> objects. (For example there's a sword lying somwhere on the map and
> if there's a shutdown we must save all the datas of this object
> and after a restart we must be able to reload it and replace it on
> the map where it was before the shutdown... And player stats should
> also be saved and nearly every object...)
>
> Currenly we have plans for these problems, and it's getting clean that
> we can code it, too, but if it's done in a language (because it can be
> done, if we can do it !) we should not waste our time with it...
>

> We would use CodeWarrior under BeOS... (www.be.com, It's COOOOOL, have a
> look at it if you don't know it already...)
>
> So I would appreciate your response, because I just don't anything about
> ObjC and one of my friend said that he read something like this when he
> was reading about ObjC.
>

Faried Nawaz

unread,
Oct 19, 1997, 3:00:00 AM10/19/97
to

Steve Dekorte <dek...@slip.net> writes:

Or Scheme, of course it would run about 5x or more times slower
than Lua or Smalltalk.

Where do you get this figure from?


faried.
--
WAR IS PEACE FREEDOM IS SLAVERY BACKSPACE IS DELETE

Steve Dekorte

unread,
Oct 19, 1997, 3:00:00 AM10/19/97
to

David Stes <st...@mundivia.es> wrote:

> Steve Dekorte wrote:
> >
> > Objective-C is great, but it simply was not designed for these things.
> > (any more than C++ was designed for writing things like GUI apps)

> C++ certainly has libraries to develop GUI's.

> Bjorn Pettersen also pointed out that Python has graphics.
> So both seem a good choice for implementing graphics.

> How would he do graphics on BeOS in Objective-C?

Sorry, I thought we we're talking about a server.
(the place where the dynamic issues the orginal post brought
up would be relevant)

Steve Dekorte

unread,
Oct 20, 1997, 3:00:00 AM10/20/97
to

John C. Randolph <jcr.r...@this.phrase.idiom.com> wrote:
> In <626iet$306$1...@owl.slip.net> Steve Dekorte wrote:
> -> Ok, so how in Objective-C do you add/remove/modify methods/classes/ivars
> -> at runtime?

> Methods and classes, you do using the functions I mentioned. Ivars, you can
> use a few tricks. One trick I use now, is just to use an instance of
> NSMutableDictionary as the entire storage of an instance.

So how do existing instances deal with their classes ivars being added and removed?
How do I change a method in one instance without changing it in others?

I've used the tricks you mentioned. I've written a psuedo-prototype-based
lanuage in Objective-C and it's ugly and slow when compared to true prototype
based languages.

101

unread,
Oct 20, 1997, 3:00:00 AM10/20/97
to Steve Dekorte

We ARE talking about a server...

- 101.

PS: I hate these terminals... (IBM 3179G if it says something :)

Marco Scheurer

unread,
Oct 20, 1997, 3:00:00 AM10/20/97
to

On 10/19/97, Steve Dekorte wrote:
>Marco Scheurer <ma...@sente.ch.mil> wrote:
>> On 10/16/97, Steve Dekorte wrote:
>> Using dynamically loaded code (for instance with OPENSTEP bundles),
it
>> is possible (and easy) to add classes at runtime in Objective-C.
>> Granted, it is not as flexible as with other languages already
>> mentionned in this thread.
>
>So you're suggesting the running code spit out more code which gets
>(hopefully) compiled in a background process and dynamically linked?

No, only that you can add (separatelly developed and compiled) code to
a running application.

>This is not elegant or easy compared with doing this in Smalltalk.
>

Agreed.

>> I would use LISP or CLOS.
>

>Or Scheme, of course it would run about 5x or more times slower
>than Lua or Smalltalk.

Maybe, maybe not. This is the kind of arguments we (still) sometime
see in C++ vs Objective C (or vs Smalltalk) threads, and if you push
the argument further, you'll have to use C or assembly. I would still
choose LISP if it cuts on development time (giving me time to optimize
where needed).

If I'm not mistaken, Mario 64, on the Ninento is largely programmed in
LISP, uses a framework called N-World. There was a paper in Object
Magazine in May about this.

Anders Jackson

unread,
Oct 21, 1997, 3:00:00 AM10/21/97
to

>>>>> "Steve" == Steve Dekorte <dek...@slip.net> writes:

Steve> Marco Scheurer <ma...@sente.ch.mil> wrote:
>> On 10/16/97, Steve Dekorte wrote: Using dynamically loaded code
>> (for instance with OPENSTEP bundles), it is possible (and easy)
>> to add classes at runtime in Objective-C. Granted, it is not as
>> flexible as with other languages already mentionned in this
>> thread.

Steve> So you're suggesting the running code spit out more code
Steve> which gets (hopefully) compiled in a background process and
Steve> dynamically linked? This is not elegant or easy compared
Steve> with doing this in Smalltalk.

>> I would use LISP or CLOS.

Steve> Or Scheme, of course it would run about 5x or more times
Steve> slower than Lua or Smalltalk.

And to add one language more, try Erlang. It's modular functional
language. It has much from Prolog (no unification) and has
nondestructive variables. It has support for distribution in the
language. At Uppsala University, CSD, we did a large project with
Erlang and Prolog. We did planing with constraint Prolog (SICStus) and
did distribution and grafics in Erlang. The hole system (servers, the
lot!) was able to migrate between machines without the users noticed
it (the industry people that was there and look didn't even understand
that, I think). It's constructed by Ericson (the tele company) and
has support for upgrading the softwar without the system beeing taken
down. You need that in telephon switches.

Anders Jackson


Steve Dekorte

unread,
Oct 22, 1997, 3:00:00 AM10/22/97
to

James T. Romano <jro...@gain-ny.com> wrote:
> Hello,
> As an Ex-NeXTStep programmer (Objective-C), you could do exactly what
> you are describing. It looks like you'll probably run into some memory
> problems. As for keeping objects persistant on disk, well I know that
> NeXTStep, err, Openstep does have this, but as for plain old
> Objective-C, well I think you'll have to write your own persistance
> mechanism. You could do it. Good luck

Disk persistance in Objective-C is easy, in your objects implement:

- writeToFile:aFile
{
[ivar1 writeToFile:aFile];
[ivar2 writeToFile:aFile];
...
}

- readFromFile
{
[ivar1 readFromFile:aFile];
...
}

and in your List class:

- writeToFile:aFile
{
int n, count = [self count];
[aFile writeIntValue:count];
for ( n = 0; n < count; n++ )
{
id object = [self objectAt:n];
[aFile writeString:StringForClass([self class])]; // or whatever that function was named
[object writeToFile:aFile];
}
return self;
}

- readFromFile:aFile
{
int n, count = [aFile nextIntValue];
for ( n = 0; n < count; n++ )
{
in theClass = ClassForString([aFile nextString]);
id newObject = [[theClass alloc] init];
[newObject readFromFile:aFile];
[self addObject:newObject];
}
return self;

Steve Dekorte

unread,
Oct 22, 1997, 3:00:00 AM10/22/97
to

Faried Nawaz <f...@LISP-READER.Hungry.COM> wrote:
> Steve Dekorte <dek...@slip.net> writes:

> Or Scheme, of course it would run about 5x or more times slower
> than Lua or Smalltalk.

> Where do you get this figure from?

A friend compared the same calcuation done in Lau and Scheme
and found Lau was around 5x faster. The Smalltalk figure is
by inference.

Steve Dekorte

unread,
Oct 22, 1997, 3:00:00 AM10/22/97
to

Marco Scheurer <ma...@sente.ch.mil> wrote:
> >Or Scheme, of course it would run about 5x or more times slower
> >than Lua or Smalltalk.

> Maybe, maybe not. This is the kind of arguments we (still) sometime

> see in C++ vs Objective C (or vs Smalltalk) threads, and if you push
> the argument further, you'll have to use C or assembly. I would still
> choose LISP if it cuts on development time (giving me time to optimize
> where needed).

Development time compared to what? Smalltalk?

> [N64 game using LISP example]

If you compare Scheme and Lua for the things you'd want in a game
console scripting language, I think Lua will come out ahead.
It's more smaller, portable, uses less memory, and is faster.

David Stes

unread,
Oct 23, 1997, 3:00:00 AM10/23/97
to

John C. Randolph wrote:
>
> -> Ok, so how in Objective-C do you add/remove/modify
> -> methods/classes/ivars
> -> at runtime?
>
> It's all there, we just don't use these facilities most of the time.

I agree (with Randolph), the runtime (because of the use of a
centralized messenger supports it).

In fact, maybe if there would be a higher level interface
for adding methods, it would be used.

A top-level interface could be : + addMethodsOf:aSubclass.
This would add all methods of a subclass to some superclass.

A category would then just be a subclass, that has a +initialize
like this :

@implementation MyCategory : MyObject {}
+ initialize { [[self superclass] addMethodsOf:self]; }
- foo { ... }
@end

because +initialize (or +load in GNU parlance) is executed
when the code is loaded in, or at start-up time, this would then
automatically add all methods to a different class, so that
instances of MyObject also respond to -foo (implemented in
the "category").

David.

The Crystal Spire

unread,
Oct 26, 1997, 2:00:00 AM10/26/97
to

> Using dynamically loaded code (for instance with OPENSTEP bundles), it
> is possible (and easy) to add classes at runtime in Objective-C.
> Granted, it is not as flexible as with other languages already
> mentionned in this thread.
>
> I would use LISP or CLOS.

This is actually what I am doing. Writing the main core of my
multi-player game in ObjC. And then the scripting language for adding
things dynamically will be done in CLOS.


Steve/Setz[er]@EFnet


_ _
_/( <~\ /~> )\_
.~ ~-. /^-~~-^\ .-~ ~.
.-~ ~-._ : /~\/~\ : _.-~ ~-.
.-~ Steve Mertz ~~--.__: \0/\0/ ;__,--~~ ~-.
/ cry...@xeo.net ./\. ^^ ./\. \
. www.xeo.net/crystal | ( )( ) | .
-~~--. _.---._ /~ U`'U ~\ _.---._ .--~~-
~-. .--~ ~~-| |-~~ ~--. .-~
~ | : : |_ ~
`\,' : : `./' ~~--._
.(<___.' `,___>),--.___~~-.
~ (((( ~--~ )))) _.~ _)
~~~ ~~~/`.--~ _.--~
\,~~~~~

0 new messages