🎉 Celebrating 25 Years of GameDev.net! 🎉

Not many can claim 25 years on the Internet! Join us in celebrating this milestone. Learn more about our history, and thank you for being a part of our community!

Lisp as a scripting language

Started by
14 comments, last by flangazor 21 years, 1 month ago
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
Advertisement
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.
_______________________________
"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. | CAA - BCHA - AQHA - APHA - R.H. - T.D. | 395 - SPS - GORDIE - SCMA - R.M. - G.R. - V.C. - C.F.
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]
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?
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.
I thought that lisp can be compiled to a stand-alone executable, is this false? Do you need runtime files?

James Simmons
MindEngine Development
http://medev.sourceforge.net
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.
That''s weak.

James Simmons
MindEngine Development
http://medev.sourceforge.net
(loop (print (eval (read))))

"I code, therefore I exist"
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.
You are not the one beautiful and unique snowflake who, unlike the rest of us, doesn't have to go through the tedious and difficult process of science in order to establish the truth. You're as foolable as anyone else. And since you have taken no precautions to avoid fooling yourself, the self-evident fact that countless millions of humans before you have also fooled themselves leads me to the parsimonious belief that you have too.--Daniel Rutter

This topic is closed to new replies.

Advertisement