[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Lua as a "domain specific language"?
- From: PA <petite.abeille@...>
- Date: Thu, 9 Mar 2006 19:20:46 +0100
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":
create table orders (
cust_id references customer
constraint pk_orders (order_id)
Joinfrom: (myTable fieldNamed: 'ADMIN_ID') to: (userTable fieldNamed:
(manager :accessor employee-manager :db-kind :join :db-info
(:join-class employee :home-key managerid :foreign-key emplid :set
Music::CD->has_a(artist => 'Music::Artist');
Python's SQLObject 2:
other = Reference('Other', 'other_id')
class Project < ActiveRecord::Base
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 )
PA, Onnay Equitursay