10 ms·
Lambda Cube
- kuwze 8y ago"Each dimension of the cube corresponds to a new way of making objects depend on other objects" Is it normal to refer to data structures as objects? Just to my knowledge most typed languages abhor the awesome potential of object-oriented programming, like the CLOS.
- betterunix2 8y agoIn this context I think it refers to mathematical objects, since the dependencies can be between either values or types in either direction (values to values, types to types, types to values, values to types). Also, lexical closures in a functional language are "classes" from the OO setting, so it is natural to implement classes if you want them; see e.g. OCaml. What you rarely see in the functional setting are common OO design patterns, because many of those patterns are unnecessary or awkward in functional languages.
- Jim_Heckler 8y agoCould you explain what you mean by closures being classes? My only familiarity is from Emacs/Common Lisp and Clojure.
- cstrahan 8y agoDefine a set of functions that close over their lexical environment, then treat the closed-over variables as internal/private state, and treat those functions as you would methods in OOP (reading/mutating the aforementioned variables).
- lispm 8y agoThat's basically the same level of OOP compared to how one can implement numbers and numeric operations as functions.
- betterunix2 8y agoClasses are a combination of member variables, methods, and method dispatch (which is important for inheritance). So let's emulate that combination with a closure in Lisp: (defun constructor (x y) (list (lambda (a) (+ x a)) (lambda (a) (* y a)))) This is essentially a "v-table" as you would have in C++. Inheritance would be exactly what you expect: replacing v-table methods in child class constructors. Lisp is untyped but if you wanted to do this in a typed language then a class type would just be the types of the methods that can be applied and what index in the v-table each method type has, similar to duck typing (except that the methods are "named" by v-table index). Note that members are private, and can only be accessed if the interface (v-table type) allows it, and that in a pure implementation you would have immutable objects so "setters" would have to recursively call the constructor.
- deleted 8y ago[deleted]
- kuwze 8y agoThank you, I never knew how ignorant I was about that.
- mruts 8y agoI think Scala does a good job of unifying OO and FP. And because of everything being first class, you get to eliminate all the ridiculeous design patterns and end up with a very nice FP system based upon objects and traits or typeclasses
- simiones 8y agoI don't think you meant to imply this, but for anyone else - please note that the reverse can also be said - closures from an FP setting are objects from an OO setting, and it is natural to implement closures if you want them; see e.g. C++ "functors". That is, objects and closures can both be implemented in terms of the other, if your language doesn't happen to offer both.
- chriswarbo 8y agoLots of discussion and links on this at http://wiki.c2.com/?ClosuresAndObjectsAreEquivalent http://wiki.c2.com/?ClosuresAndObjectsAreEquivalent
- afpx 8y ago“Mathematical Objects”: https://en.m.wikipedia.org/wiki/Mathematical_object https://en.m.wikipedia.org/wiki/Mathematical_object
- chriswarbo 8y agoI think this is the mathematical/logical distinction between "object level" and "meta level". The meta level is about lambda terms, involving things like variable names, abstractions, judgements, derivations, equivalences, reductions, substitutions, etc. The object level is what lambda terms are about, involving things like values, types, variable contents, etc.
- igravious 8y agoIt's type theory, so the `objects' in question are either systems of terms and/or types. See where it says: terms allowed to depend on types, corresponding to polymorphism. types depending on terms, corresponding to dependent types. types depending on types, corresponding to type operators. So I think they're using the word `objects' either loosely (as in, they could have said `things' but maybe that's too informal?) or they're using it as a shorthand for `type-theoretic objects', in which case they're talking about languages of a certain constrained expressive power: the language which features polymorphism, the language which features dependent types, the language which features type operator. `object' here refers neither to the objects of object-oriented programming nor to object in common lisp object system. edit: IANATT
- Hackbraten 8y agoSlightly disappointing. I wanted to learn about four simultaneous 24-hour days within a single rotation of the Earth.
- wolfgke 8y agoFor those who do not understand: > https://en.wikipedia.org/w/index.php?title=Time_Cube&oldid=885383984 https://en.wikipedia.org/w/index.php?title=Time_Cube&oldid=8... > https://ti.mecu.be/ https://ti.mecu.be/
- adamnemecek 8y agoReminds me a bit of the "Commutative diagram of harmonic wave" from wikipedia https://commons.wikimedia.org/wiki/File:Commutative_diagram_of_harmonic_wave_properties.svg https://commons.wikimedia.org/wiki/File:Commutative_diagram_...
- mFixman 8y agoLanguage theory and lambda calculus classes were some of my favourite in college. I wonder how many serious bugs would be averted if programming languages came with more complete type systems.
- wespiser_2018 8y agoYou might think this: but there is a major time and complexity cost to using more advanced type systems that sometimes doesn't pay off in simpler applications that must ship fast!
- dope99 8y agoCan you support when this trade off ought to go one way or the other with any objectivity?
- warent 8y agoBut the question is why "must" it ship fast? That seems to be a poor, irrational agreement we've made as a tech society for no better reason except because people are impatient.
- lacey 8y agoI don’t think the argument is centered around impatience. There is a (perhaps wrong) belief that being first to market greatly increases your chances of success if not outright dominance in an area. People are unconcerned with the possibility that if successful they will be left with a mess to clean up and a system that is hard to evolve. They believe those are easy problems to fix.
- wespiser_2018 8y agoYea, its at least my thinking that having a tech debt problem is better than a failed company that results from not moving fast enough with constrained funding to either find product market fit, or fully self actualize the product concept.
- kvb 8y agoSee also pure type systems https://en.wikipedia.org/wiki/Pure_type_system https://en.wikipedia.org/wiki/Pure_type_system
- kyberias 8y agoWhat would be a good text book about language theory, type systems etc.?
- mjh2539 8y agohttps://www.cis.upenn.edu/~bcpierce/tapl/ https://www.cis.upenn.edu/~bcpierce/tapl/
- riffraff 8y agosince TAPL has been mentioned already: Concepts, Techniques, and Models of Computer Programming[0] (CTM) is a great book on language theory. The whole book is basically taking a core minimal language (Oz) and extending it in various ways to obtain different paradigms (functional programming, declarative concurrency, message passing concurrency, imperative/stateful programming, OOP, shared state concurrency, constraint programming, logical programming etc). It's very fun and illuminating. It also includes a part on formalizing semantics, of which I recall nothing. [0] https://www.info.ucl.ac.be/~pvr/book.html https://www.info.ucl.ac.be/~pvr/book.html
- sideeffffect 8y agoI personally hope that I will eventually find the time to read Practical Foundations for Programming Languages by Robert Harper https://www.cs.cmu.edu/~rwh/pfpl/index.html https://www.cs.cmu.edu/~rwh/pfpl/index.html direct link to a preview of the 2nd edition: https://www.cs.cmu.edu/~rwh/pfpl/2nded.pdf https://www.cs.cmu.edu/~rwh/pfpl/2nded.pdf direct link to an unabridged version of the 1st edition: http://profs.sci.univr.it/~merro/files/harper.pdf http://profs.sci.univr.it/~merro/files/harper.pdf
- PyroLagus 8y agoSoftware Foundations seems to be really good. https://softwarefoundations.cis.upenn.edu/ https://softwarefoundations.cis.upenn.edu/ And it's free.
- DoofusOfDeath 8y agoCan anyone recommend an online course for learning about the lambda calculus and the introductory type theory? I've tried learning about them on my own using books, but I have trouble staying focused and motivated enough to get very far.
- batoure 8y agoWhy is it that when I look at equations it’s all just nonsense but send me a gist example and all the sudden it’s the music of the universe.
- dan-robertson 8y agoBecause the definitions (eg as seen in OP) describe how things may be synthesised but not what one might want to synthesise whereas a gist example just gives you something to stare at and decide if you can understand how it fits together. If all one has is the definitions one must build everything from scratch but with a preexisting example one can start at the top level and build an understanding down without needing to plan ahead through all the gory details. At first I wanted to finish this up dismissively by suggesting that maybe it’s just that only the easier things would end up in a gist but having thought about a tiny bit I think there’s a lot to gain from larger examples that won’t fit in half a column in a paper.