Kartik Agaram
Foo
and Bar
can be automatically coerced in:
type Foo = A int * B boolean
type Bar = A int * B boolean
shalabh
01/16/2020, 5:52 AMKartik Agaram
signed
vs unsigned
in C shows that this path has correctness problems as well.)
So yeah, there are rarefied use cases where you want to distinguish between interface+relations and a materialized view. But it seems excessive to require that two-level framework all the time.
@Edward de Jong / Beads Project has units, if I recall correctly. Have you written up a description anywhere of Beads's type system?Doug Moen
01/16/2020, 6:38 PM@shalabh "We don't want to model types (which containerized the information, and overspecify the proximity of values), we want to model the information in some other normal form (kinda like 6NF in relational)."I think there are "functional" and "relational" styles of programming, which are appropriate in different contexts. In my project (Curv), there is currently no state. It is purely functional. You build up geometric shapes using function composition: applying shape operators to shape values. The functional style is focussed on values, which containerize information and force it to be hierarchical. But, this style works really well in Curv. @Kartik Agaram Integers & arithmetic are another example where functional style works well. The functional style, with its containerized, hierarchical data, seems to be bad for modelling "real world" data, with its non-hierarchical relationships, and seems to be bad for managing state in game programming. For that, you want "relational" programming, which is what I think is what Shalabh is talking about. I'm using this term loosely to describe Entity Component Systems, Datalog, etc.
Doug Moen
01/16/2020, 7:00 PMKonrad Hinsen
01/17/2020, 7:33 AMshalabh
01/17/2020, 7:43 AMcar.wheels
vs wheel.car
problem. In the information model there is only one relationship between the car and the wheels. (This goes back to the domain types vs machine types discussion we had at some point.) In something like RDF, or any graph model there is only one (obvious) way to model the car-wheel relationship: there's a car, there's a wheel, there's a 1:many relationship between car and wheels.
When using record types, you have to partition the information into two records - now you must decide where the link goes. This is what I mean by the 'relationship should be outside the entity' but it is inside in records. Sometimes I might want to lookup the car for a given wheel. Now I have a few options: Loop over all the cars and see if they contain this wheel, construct a reverse mapping using a new data structure Dict[Wheel, Car]
. If you do that and it's somewhat long lived, you now have to keep the data consistent. The point is your code is not written to fit the domain model but it is written to fit this type model that contains various projections of the domain model. Importantly these projections are manually constructed and maintained. Other concerns (such as optimization) might lead to decisions like lets keep both car.wheels
and wheel.car
because we need fast lookup in both directions.Don Abrams
01/17/2020, 8:31 AM