2 ms·
I have nothing super finished, this is for fun (until I get time or funding!). But I bet is far more reusable than normal code in most cases. The reason is th
by mamcx 3y ago
I have nothing super finished, this is for fun (until I get time or funding!).
But I bet is far more reusable than normal code in most cases.
The reason is that the relational/array model has more values: https://www.infoq.com/presentations/Value-Values/ https://www.infoq.com/presentations/Value-Values/, and combined with structural types and the power of relational operators you can eliminate a lot of cases where macros or generics come.
One major feature of a "values" language is that is naturally introspectable. Not just values, but types, and metadata. So this is NOT crazy:
mod People:
data Person:
name: Str
age: Int
data Customer: Person //not subtyping but `SELECT * Person INTO Customer`
active: Bool
end
mod Auth:
data User: People.Person //not subtyping but `SELECT * People.Person INTO Customer`
password: Password
active: Bool
data UserSafe: User ? deselect password // SELECT People.Person.*, active INTO UserSafe
end
fn print(p: Person ... ) // Accept anything that is `SELECT name, age FROM ?`, but critically, not remove the other fields, are just invisible here. This means you don't make type conversions in unnecessary cases
fn print_type_no_person(mod:Mod): String
let types = mod ?select as_data(this) != Some(Person...) // Anything is a relation, anything query
types ? union | into(String) //SELECT t1 UNION t2... + reduce()