172 points · by tempodox · 5y ago · 62 comments
But then I was able to re-start Thompson's "Type Theory and Functional Programming" and it was clear that I started to understand a lot of it.
If you enjoy the nostalgia of older books like me, then pick up an original copy of "Intuitionistic Type Theory" edited by Per Martin-Löf.
> What's the relationship between programming language theory and type theory?
I'd say programming language theory is more broad than type theory, for instance topics such as compilation techniques and runtime systems are more distant from type theory (though you might prove some type-theoretic thing like type preservation).
There's also a range of type theory books because it's a field that spans pure logic to programming languages, so you can find books like Type Theory and Functional Programming by Thompson that elaborate things like dependent types early on.
The usual recommendation seems to be "Types and Programming Languages" by Benjamin C. Pierce.
Maybe a better way to describe the notation is "off-putting"?
Like many kinds of formal notation it almost requires a class in a university to have it explained. The same is true of other fields dense in notation where you need to learn the conventions as much as the basics.
At least BNF grammars are legible
Inference rules just transform the traditional format of
(A && B) -> C
into A B
---
C
This format allows you to stack rules on top of each other when writing out the derivation of some term, without running out of page space.when you click you never give a damn about notation but before you do it's such a drag
it's like monads
It shows that is important to take soundness of type-systems serious. I like what they did with Scala: they boiled down the language into the fundamental parts and built a language from it that has a sound type-system (machine-checked). This has now finally become Scala 3.
Here are some more details: https://www.scala-lang.org/blog/2016/02/03/essence-of-scala....
While Scala 3 filled a soundness hole, it opened a practical crater (and no, path dependent types are not a viable substitute).
Too bad, many nice improvements overall.
Does it show that? I see it more like a set of examples demonstrating there's no such thing as "a sound type system".
[1]: <https://en.wikipedia.org/wiki/Counterexamples_in_Topology>
Which also means you'd be able to add new semantical type behavior specific to a project, not just specific to a language.
What we're doing right now it's highly redundant, it's basically two languages in one. One describes the static constraints, and another the runtime ones. There's no need for that.
For me it is pure black on both Firefox and Chrome
See also https://github.com/adobe-fonts/source-code-pro/issues/250
What problem domain is so complex that it cannot at least be modeled in SQL (or Excel)? What language does not provide sufficient abstractions for tables, columns, relations & basic data types? Why would you want to take a clean domain model that the business agrees upon and then start perverting it with things like polymorphism? Performance is often something thrown around as an excuse to de-normalize schemas, but typically when I ask someone to actually measure it we find that LINQ/SQL/etc is more than fast enough to get the job done for all practical intents & purposes.
That said:
> What language does not provide sufficient abstractions for tables, columns, relations & basic data types?
A key part of the SQL data model is the primary key. I'd really love to see a programming language make PKs or something like them a first-class construct. So if we're looking for something neat to add to PLs that would actually help with business modeling, maybe we could start there?
This certainly seems like an excellent place to start. Every single one of my domain types starts like:
public class MySpecialType
{
public Guid Id { get; set; } = Guid.NewGuid();
//...
}
Having some notion of a first class identity that I could leverage without having to explicitly add a public Id property would be worth looking at.But, what about the relational aspect? Identity is trivial to solve IMO. How do we canonicalize this idea of relations between types? The way I do this today is:
public class MyRelatedType
{
public Guid Id { get; set; } = Guid.NewGuid();
public Guid? MySpecialTypeId { get; set; }
//...
}
And then I just tie it all together with LINQ statements as appropriate.Is there a better way to express this idea with some shiny new language constructs? I feel like I am running out of physical lines of code to golf with here.
The only thing I can think of that is more concise than my above code examples would be SQL.