Archived

This topic is now archived and is closed to further replies.

flangazor

Lisp as a scripting language

Recommended Posts

I think Lisp would make a very good scripting language. Richard Stallman does as well (hence: ilisp/elisp). Is there an easy way to pop a lisp environment into a C++ based app and circumvent having to use FFI? I ask here since I have tried CLisp and GCL and neither seem to have anything resembling an FFI for win32. CMUCL isn''t available for win32, etc etc and a search on comp.lang.lisp for FFI only returns more people are as confused as I. I would very much like to use lisp with qt, opengl, and/or general win32 programming. Cheers and beers, flan

Share this post


Link to post
Share on other sites
I''ve used Lisp with OpenGL and win32. Of course, my intent wasn''t to use Lisp as a scripting language (that''s severe underutiliztion). I was programming an app with Lisp.

To me, aspiring to use Lisp as a scripting language is not the right mindset. Bear with me, please. You use a scripting language when your language of choice for the scripting pretty much means all you can do is scripting.

But once you''ve made the choice to use Lisp as your ''scripting language'', you can make the paradigm leap and realize that the tool you have adopted will let you do more than simply script. You can now take that Lisp paradigm, and not just script events (or whatever), you can develop and build a framework (framework is a better word than script) which is comprised of the whole Lisp featureset, letting the Lisp element in your game actually become your partner, your game manager, your component which enables end-users to extend (not just game elements, but the framework featureset as well).

_______________________________

"To understand the horse you''ll find that you''re going to be working on yourself. The horse will give you the answers and he will question you to see if you are sure or not."
- Ray Hunt, in Think Harmony With Horses


ALU - SHRDLU - WORDNET - CYC - SWALE - AM - CD - J.M. - K.S. | LANL | CAA - BCHA - AQHA - APHA - R.H. - T.D. | 395 - SPS - GORDIE - SCMA - R.M. - G.R. - V.C. - C.F.

Share this post


Link to post
Share on other sites
The fact that most lisp distrobutions require a lisp runtim environment to be shipped with the image means that essentially, the lisp program is a script for the runtime environment.

Emacs and AutoCAD are very powerful and use lisp as a scripting language (a smaller version).

When you use opengl from lisp what package are you using? Corman Lisp? Franz Lisp? CMUCL (which doesn't have a win32 implementation)?

Hm, maybe third time's lucky...


[edited by - flangazor on May 13, 2003 11:24:59 AM]

Share this post


Link to post
Share on other sites
quote:
Original post by flangazor
The fact that most lisp distrobutions require a lisp runtim environment to be shipped with the image means that essentially, the lisp program is a script for the runtime environment.

I''m not sure what that means. `Script'' is one of those rather vague hand-waving terms that programmers throw around now and again, without ever really defining what they mean by it. Is a C++ program a `script'' for the C++ compiler?
quote:

OR I can write my own lisp interpreter/compiler! :-D

Your original question doesn''t make any sense. You want to embed Lisp in another application, but you want to avoid FFI. Why?

Share this post


Link to post
Share on other sites
I want to avoid FFI because I can''t seem to get it to work and I am frustrated by it. I don''t have web access at home so I can''t just download and play with every lisp implementation I come across. I found clisp and gcl and got them because they were free and didn''t have limited time use or limited stacks.

Therefore, I thought "Fine, I will just write this in C++ and fulfill greenspun''s 10th rule." I was intending to do that by writing a small runtime environment and then I could pass in s-expressions to it. It could then process the s-expressions and act upon them. This would essentially be a drawing api.

You are correct that "scripting" is a muddy term and I apologise for tossing around such a thing carelessly.

Share this post


Link to post
Share on other sites
quote:
Original post by neurokaotix
I thought that lisp can be compiled to a stand-alone executable

Yes, but if you want `eval'' to work, then you need the Lisp compiler to go along for the ride.

Share this post


Link to post
Share on other sites
I''m interested in embedding a lispish language in my game as well. The rendering and networking stuff will be in C++, but all the game logic, AI, user interface, etc, will be done in lisp. I looked around at some of the available implementations, but they were all lacking at least one of the qualities I wanted (chiefly, must be cross-platform, have C++ source code supplied, must be usable as an interpreter rather than a compiler, and a few other bits and pieces). I finally decided to bite the bullet and create my own. I figure I''ll learn a lot more this way, and I''ll end up with something I trust and understand much more than if I had simply plugged in someone elses implementation. It also means that there can be a lot of useful code shared between the lisp interpreter and the game engine itself, which should keep the code a bit simpler.

Share this post


Link to post
Share on other sites
quote:
Original post by Plasmadog
I looked around at some of the available implementations, but they were all lacking at least one of the qualities I wanted (chiefly, must be cross-platform, have C++ source code supplied, must be usable as an interpreter rather than a compiler, and a few other bits and pieces).

So what''s wrong with clisp?

Share this post


Link to post
Share on other sites
quote:
Original post by SabreMan
So what''s wrong with clisp?



That did appear to be a contender, but the source code is all in lisp. I really wanted an implementation in which the very fundamental stuff is written in C or C++, like Corman Lisp for example.

Share this post


Link to post
Share on other sites
quote:
Original post by Plasmadog
That did appear to be a contender, but the source code is all in lisp.

No it isn''t! The kernel (lisp.exe) is written in C, and the Lisp source layers functionality over that. It sounds like you don''t actually have the source distribution.

Share this post


Link to post
Share on other sites
For the record, I got Corman Lisp and played with it at lunch. It looks dandy and the featureset is quite nice.

The lisence says I can run programs from the console indefinitely, which is nice. I was getting used to that in GCL w/ emacs.

Share this post


Link to post
Share on other sites