Oslo : “M” + “Quadrant” + Repository.
The first Milestone we did not have a language. Having a box and line design experience is an important enabler. Having a complementary textual experience is equally important. M is how we achieve the latter. M was the savor of Oslo. Design experience was not enough.
“If I don’t have text, I do not care about box and arrows” Don Box.
M is a language for defining domain models and textual DSLs. M domain models define schema and query over structured data (Values, Contraints, Views, natural projectio to SQL). M DSLs define projection from Unicode text to structured data : Rule based transformation + Grammar-driven text editor integration.
The M Language : use MSchema to build Domain Models, and MGrammar to transform and MGraph to get the abstract data model.
M is not an object oriented language. M is a language for data. It is about transforming and abstracting data. M uses structural typing (“Is a ...”)
M is not a data access technology. M domain models compile down to TSQL and execute in the database.
M is not a replacement for T-SQL. M leverages T-SQL.
M is to T-SQL as C is to Assemble.
Process: Write ModelA.m, ModelB.m, ModelC.m, Compile them m.exe, generate a ModelABC.mx, load through MX.exe then store to SQL Server.
m Model.m /p:image
mx /i:Model.mx /d:DB /c /f
sqlcmd –d DB, select * from MODULE.TYPE
In the model, you can constraints the cardinality People : { …}*; or #2..6; you can constraints with a where clause Name : Text where value.Count <= 28;
In the model, you can get references. Here, we need Identity. People : { }* where identity Name;
You can define label values : People { Robin { Name = “…”, Age = 24}
You can define relationships : type Marriage {SpouseA : People; SpouseB : People; } Marriages : Marriage*; Marriages { SpouseA = Robin, SpouseB = Chris.
You can create a query : PeopleNamed(n : Text) { from p in People where p.Name == n select p; } or could write People.Name(n)
The M Framework
M is itself implemented as M DSL, SDK ships with an evaluator (MrEPL) that builds on both.