PDC 2008 Experience: Day 2: "Oslo" the language
What is "M"?
- "M" is a language for definig domain specific models and textual domain specific languages (DSLs)
- M domain models define schema and query over structured data
- Values, Constraints, and Views
- Natural project to SQL
- M DSLs define projections from Unicode text to structured data
- Rule based transformations
- Grammar driven text editor integrations.
What "M" is not
- An object-oriented language
- No polymorphism, virtual dispath
- "Is-a" determined based on structural subtyping, not stipulation
- A data access technology
- M domain models compile down to T-SQL
- Tool chain supports course-grained loading/unloading of schemes and values - not an OLTP solution
- A replacement for T-SQL
- Far less expansive feature set
- Tool chain supports linking/invoking T-SQL
How it works
| Model.M | M.EXE | Model.mx | MX.EXE | SQL |
| Model | Compiler | Image File | Domain Model Loader | |
Sample Model
contact.mx
1: module Contacts
2: {
3: People
4: {
5: { Name = "SEVDNUG", Age = 23 },
6: { Name = "Joseph Guadagno", Age= 21 }
7: }
8: }
1: module Contacts
2: {
3: People:
4: {
5: Name: Text where value.Count <=28;
6: Age : Integer32;
7: }* where identity Name;
8:
9: People
10: {
11: Joseph = { Name = "Joseph Guadagno", Age = 38},
12: Deidre = { Name = "Deidre Guadagno", Age = 38},
13: }
14:
15: type Marriage
16: {
17: SpouseA : People;
18: SpouseB : People;
19: }
20: Marriages : Marriage*;
21:
22: Marriages {
23: { SpouseA = People.Joseph, SpouseB = People.Deidre }
24: }
25:
26: PeopleNamed(n : Text)
27: {
28: // People where value.Name == n
29: People.Name(n)
30: }
31: }
People: defines the types
People created the data
type Marriage defines a relationship
Marriages applies the relationships
PeopleNamed A function to print the names
Command line to compile it
1: mx /i:contacts.mx /d:window /c /f
Domain Modeling Constructs
- Extents declare storage fro values
- Types constrain values in a given context
- Explicit identity enabled references
- Functions name parameterizes expressions.
The M Framework
- M is implemented as M DSL
- Parser exposed using M DSL machinery
- Type flow exposed as framework component
- SDK ships with an evaluator (MrEPL) that builds on both.
Where are we?
- "M" is a textual moding language for defining domain models and textual DSLs in Oslo
- "M" domain models based on values, views and constraints
- "M" domain models have a natural projection to SQL