tags:

views:

1242

answers:

8

What's better for DSL: TCL or Lisp? What can you say about Java(C#)-TCL binding versus Lisp(Scheme)? What DSL tool is applicable for .Net development? (excepting Microsoft DSL tools)

+3  A: 

It really depends on who will use the DSL. If you are expecting non-IT domain experts then something simple and straightforward like TCL would be recommended. Explaining the joys of LISP to a non IT graduate would be a serious problem as would debugging a large LISP program written by someone who hasnt grokked LISP.

Equally expaining to someone that b = a + 1 is written B = INCR(A) isnt such a good idea either.

I would recommend Python, you can embed the domain specific code in one or two specialist classes. You have a language where non-IT users can code simple readable programs, and, where there are no limits on what an IT specialist can code.

James Anderson
You are not forced to use lispy syntax in your DSL just because you implement it in Lisp. For an example, look at the extended `loop` syntax in Common Lisp, which is a very un-lispy DSL for looping.
Svante
I don't think that Python has good meta-programming abilities. And I would rather accelerate development process than help non-IT domain experts.
macropas
The pure Tcl syntax in the example you gave would be "set B [incr a]". And, believe it or not, it's possible to write a DSL in Tcl that would allow something like "b = a+1".
Bryan Oakley
Bryan -- your right it is "set B [incr a]".Forgive me I havent done TCL since the last centuary.
James Anderson
That should be "set b [expr $a + 1]" assuming you don't want to change the value stored in the variable "a"
Joseph Bui
A: 

Even Lisp seems to have some weird commands like CDR (if you're not coming from a non LIST oriented language) TCL has some "weird" stuff to. You have to consider which syntax fits to your brain most.

e.g. if you have no problem with a very sparse syntax and assigning variables with set, that take TCL, ich you want a richer, very powerfull syntax with lots of metaprogramming power and you don't mind to put everything in round braces and always begin with the operator like (+ 2 3) (and not 2 + 3) than you should choose LISP.

sir_lichtkind
Again, you do not have to use lispy syntax in your DSL.
Svante
+8  A: 

If you want easy access to the JVM, you can use Clojure.

Please note that you can design the DSL any way you want, you are not forced to let any "lispy" syntax shine through. My favourite example is in the Common Lisp standard: the extended LOOP syntax is as unlispy as it gets, and it is, in fact, a DSL for looping, implemented in a macro.

Svante
If we want "unlispy" - we should work with reader macros?
macropas
+3  A: 

I would go with Scheme :)

Like said, you do not have to present the DSL as lispy code.

Here is an example of how I wrote a LINQ 'DSL' for R6RS Scheme. (but you should know that! just saw your nick now ;P)

Also here is a 2nd incarnation.

Looking at the examples at the bottom, shows that pretty much except for expressions (that have to be Scheme), the input is almost identical to LINQ in C#.

leppie
I admire your great work (IronScheme), but it seems to me that Common Lisp macros more easy than Scheme's ;) And IronScheme is not complete project now (beta). I'm afraid to use it in my work (but I watch its advance!)
macropas
OK, I wont recommend IronScheme yet for commercial usage, but hopefully in a few months time :)
leppie
The link to the LINQ DSL has slightly changed (can't edit the post):https://ironscheme.svn.codeplex.com/svn/IronScheme/IronScheme.Console/ironscheme/linq.ss
ThomasH
Thanks thomas :)
leppie
None of the links above are working (Not even Thomas').
missingfaktor
@Rahuλ G: Fixed links
leppie
@leppie: Thanks.
missingfaktor
+4  A: 

For a DSL on .Net, Boo is a really great place to start. The guys behind Unity3D are using it for their "JavaScript" script language, I think even Second Life are creating their LindonScript2.0 or something with it, and I think this guy Ayende (Google for him) is coming out with a book about it these times...

Thomas Hansen
+6  A: 

If it's a choice between TCL and LISP I'd go for TCL every time. Partly because I'm familiar with TCL and partly because it is easy to both extend TCL with your own commands and to embed it in other software.

For JAVA interaction you have jacl and tclblend. http://tcljava.sourceforge.net/ is a good staring point for these packages or http://www.tcl.tk/ for all things TCLish.

Jackson
I'v found interesting TCL for .Net - http://eagle.to.
macropas
+1  A: 

I'd choose TCL over Lisp anyday if a broader target for your application is in question. People will more likely want to process their thoughts instead of lists. :) (Thank you Lisp, for giving me a perspective of functional programming but I don't think we should see each other anymore, oh and btw, it's not you, it's me ;))

In addition to that, I must add, unless you've a good reason (ie. like being lightweight or having very specific DSL needs) Python or Javascript should be the extension language in today's world IMHO.

ps. as this is about .NET IronPython is the Python version you'd better like.

utku_karatas
+1  A: 

Check out Martin Fowler's Blog. It is what got me started with DSLs. Fluent Interfaces is sorta a DSL.

Ayende from RhinoMocks fame does have a book coming out

Here is one of my External DSL examples I wrote for C#. And here is something I wrote in Lisp.

No experience with TCL or JAVA for writing DSLs.