TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

Representing Type Lattices Compactly

87 pointsby tekknolagi2 months ago

8 comments

infogulch2 months ago
This seems similar to the way CUE type lattices work. <a href="https:&#x2F;&#x2F;cuelang.org&#x2F;docs&#x2F;concept&#x2F;the-logic-of-cue&#x2F;#the-value-lattice" rel="nofollow">https:&#x2F;&#x2F;cuelang.org&#x2F;docs&#x2F;concept&#x2F;the-logic-of-cue&#x2F;#the-value...</a>
noelwelsh2 months ago
No parametric polymorphism aka generic types?
评论 #43333046 未加载
评论 #43332274 未加载
评论 #43333878 未加载
cobertos2 months ago
You mention integer ranges as a specific type you hope gets handled. But how does something like that work? It feels somewhere between the general type and the specialization type? Would this just be a higher level in the integer section of the specialization lattice? Or would you want it out of the lattice structure completely? Because it would kinda conflict with integer unions, when thinking about it lattice-y<p>(Admittedly I&#x27;m in the same boat, I don&#x27;t know the math but stumbled upon implementing my own type system recently)
评论 #43340377 未加载
评论 #43342576 未加载
pizlonator2 months ago
Looks almost exactly like what JavaScriptCore calls SpeculatedType.
评论 #43336925 未加载
PhilipRoman2 months ago
wow I guess great minds really do think alike, I did almost the same exact thing a few years ago, but eventually gave up as my type hierarchy grew too complex.<p>You could probably represent a lot more complex relations with similar strategies by adding one or two cleanup instructions to union&#x2F;intersection operations, but whenever I&#x27;ve tried to do it, my head gets dizzy from all the possibilities. And so far I&#x27;ve been unable to find software that can assist in generating such functions.
评论 #43335373 未加载
mncharity2 months ago
OT, I&#x27;m <i>so very</i> looking forward to some language supporting a pushout (path independent) lattice of theories (types, operators, laws). So abstraction has math-like locality and composability and robustness.
IsTom2 months ago
This is also how Erlang&#x27;s Dialyzer works.
评论 #43337800 未加载
pjs_2 months ago
Come on man just do duck typing. You are killing me with this stuff.<p>It all reads so technical and long and mathematically academic but it’s just a bit mask.<p>I absolutely hate writing python now because I have to reason about a “list of list of errors” type defined by a teenager and they get mad at me if I don’t then define a new “list of list of errors, or none” type when I manipulate it. You guys are now employed by VSCode to make those hints look beautiful. VSCode is your boss now and your job is to make VSCode happy<p>I predict that in five years we will retvrn to duck typing in the same way that we are now retvrning to server side rendering and running on bare metal. Looking forward to the viral “you don’t need compound types” post on here. “Amazing - you can write code which does normal business tasks without learning or ever thinking about homotopy type theory”<p>Yes I get it if we are writing embedded code or navigation systems or graphics or whatever, please help yourself from the types bucket. Go ahead and define a dictionary of lists where one list can contain strings but all the other lists either contain 8-bit integers or None. But the academic cachet of insanely complex composable type systems bleeds through into a web server that renders a little more than “hello world” and it ruins my life
评论 #43334028 未加载
评论 #43340304 未加载
评论 #43336845 未加载
评论 #43334082 未加载
评论 #43334444 未加载