lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]

Leave off with such terms as "hillbilly cousin," all right?

Mark F. Morss
Principal Analyst, Market Risk
American Electric Power

   >                                                  To 
             Sent by:                  Lua list                            
             lua-bounces@bazar         <>       
                                       Lua as a "domain specific           
             03/09/2006 01:20          language"?                          
             Please respond to                                             
                 Lua list                                                  


The preface to "Programming in Lua" states that "many people regard Lua
not as a language, but as a kit for building domain-specific
languages". Fair enough, but what does that mean in practice? What
usage of Lua qualifies as "domain specific language"? Does anyone have
a concrete example of using Lua for such purpose?

Suspending disbelieve for an instant, one could imagine the DSL realm
as something like "data definition language" or perhaps its hillbilly
cousin: object-relational mapping.

Bellow are a couple of syntactical example broadly dealing with the
same issue of "data definition" and/or "mapping":

Oracle's SQL:

create table orders (
   order_id number,
   order_dt date,
   cust_id  references customer
   constraint pk_orders (order_id)

Smalltalk's GLORP:

Joinfrom: (myTable fieldNamed: 'ADMIN_ID') to: (userTable fieldNamed:

Lisp's CLSQL:

(manager :accessor employee-manager :db-kind :join :db-info
(:join-class employee :home-key managerid :foreign-key emplid :set

Perl's Class::DBI:

Music::CD->has_a(artist => 'Music::Artist');

Python's SQLObject 2:

class Foo(SQLObject):
     other = Reference('Other', 'other_id')

Ruby's RoR:

class Project < ActiveRecord::Base
     belongs_to              :portfolio
     has_one                 :project_manager
     has_many                :milestones
     has_and_belongs_to_many :categories

Is any of the above an illustration of "domain specific language"?

What would be a "domain specific language" way to convey such
information in Lua?

Does this qualify as "data manipulation language"?

local aStatement = function()
         From( Employee )
         Where( Eq( name, "Vladimir" ), Eq( city, "Moskva" ) )
         Order( By( name ) )

Could this be a "data definition language"?

local aModel = function()
     Is( Employee, hr.v_employee )
     Has( name, string )
     HasOne( manager, Manager )
     HasMany( colleagues, Employee )

Confused :/


PA, Onnay Equitursay