1. 5

    What a coincidence, just yesterday I came across ATS again and figured it would be a good time to learn it. Anybody crazy enough to join me?

    1. 3

      I’m procrastinating learning ATS right now. Btw, how’s your followup to part 1 of “Reading Ur/Web signatures”?

      1. 1

        Yeah, about that… I kind of sketched out the ToC and then left it there to rot. I should finish that first, maybe refreshing my thoughts on it will help me with learning ATS, too.

      2. 1

        I saw the youtube video - while ATS strikes me as extremely interersting, I struggle to see a use professional use case for it. Would you mind to elaborate your motivation behind it, except, of course, intellectual cusiosity? I am already licking my wounds from my excursion into the jungles of Haskell, where Monads, Functors and other monsters bit me…

        1. 6

          In my case I used it for writing network services. I used linear types and proofs to help ensure program correctness and no memory leaks without a GC. Similar to what you’d use Rust for now, but with the ability to do proofs and dependent types.

          1. 3

            Hello,

            thanks for listing your project.

            Similar to what you’d use Rust for now,

            Could you give a comparison between ATS and Rust? My understanding is that Rust’s ecosystem and UI/tooling is way more developed, while ATS seems to give more freedom on how programs can be written. Or does Rust replace ATS in all function and form?

            1. 5

              Rust is definitely more developed and user friendly. Rust doesn’t replace ATS in that ATS has a more advanced type system. Things you need to do in unsafe Rust, like pointer arithmetic and dereferencing, can be done in safe ATS. ATS feels more low level - at the level of C but with an ML feel. ATS compiles to C so you can use any C compiler to use on another platform. Embedding C and calling C is easy. There are very few libraries though. I’ve written more about ATS here: https://bluishcoder.co.nz/tags/ats/

              1. 2

                Do you think ATS is used anywhere in industry? Drivers would be my first guess -

                That is quite an impressive post record. Thanks!

          2. 5

            A “professional use case” isn’t exactly what I’m after by learning it, but if you were to turn a blind eye to ergonomics and other stuff that supposedly could be fixed, I don’t think it’s such a hard sell. C with a great type system + all the nice ML features sounds like the best thing after sliced bread to me, and if I get to learn more about proofs and linear types in the process all the better. And even if I never get to use it I can still steal its ideas for the language I’ll never get around to implement.

            1. 2

              There’s a C compiler mathematically proven not to change program semantics when doing optimizations—CompCert. It’s the dependently typed language/proof assistant (Coq) that made that possible.

              I guess one problem with dependent types isn’t that they are inherently hard, but that they are not in the “mass consciousness”. Simple algebraic types and pattern matching are slowly getting into it, even though languages like Swift shy away from calling them what they are.

              At one point in hisroty, the concept of variables was revolutionary, but now it’s completely intuitive to everyone. Dependent types probably will be too.

            2. 1

              Good luck. I dismissed learning ATS after watching this video:

              https://www.youtube.com/watch?v=zt0OQb1DBko

              1. 5

                It’s not as hard as its reputation. Especially if you start with the ML side of things and slowly add dependent types and proofs as you get more familiar.

                1. 3

                  I’m watching that right now. My confidence comes from having already learnt Ur/Web, which is similar (derived from SML, bad ergonomics, arcane type system, lots of syntax, small community, sparse documentation, etc.) though a bit less threatening than ATS.

                  1. 2

                    Man, I loved that talk - one of my top 3 from that year’s strange loop.

                1. 3

                  Enkiv2, a critic of not just the modern web, but the early web, too, responded with an article titled Avoiding the gravity well of webbiness in gopher.

                  I recall this Gopher document. It’s a Gopher menu composed entirely of i item types, sans one entry. What an abuse, I thought. The first time I saw Bitreich’s system for displaying git files as a Gopher menu composed almost entirely of i item types, I was bewildered and that bewilderment gave way to disgust.

                  My Gopher hole entirely lacks i item types and I found it wasn’t particularly hard to get what I wanted without them, with just a little thought. I was surprised to find my general approach surprising to some; all I do is, for those articles that need other documents, use a menu to represent the document where the actual article is one entry and the accompanying files are others. An example can be found in my 2019-02-12 article which has many accompanying images.

                  With regards to the rest of this article, I generally don’t like the idea of any aspect of the WWW making its way into Gopher, which is one reason I avoid using Gopher URLs in general, along with not supporting Gopher selectors of robots.txt or caps.txt, the latter being particularly bad because (I believe) it was created for use with Gopher and is merely a ’‘name=value’’ format, with comments, that has no resemblance to anything in Gopher whatsoever.

                  With regards to @arp242 and his comment about monospaced text, I have two solutions: For those articles that warrant having several available formats, simply provide those; I may eventually have TeX versions of several of my articles, as an example; and secondly would be that solution which involves a client simply reflowing the text in an appropriate way, since lines of text are generally amicable to such things unless they depend on monospaced text for diagrams or whatnot.

                  I could continue with this, but I suppose my general point has been made well enough.

                  1. 2

                    Where can one find your 2019-02-12 article?

                    Edit: Found the details in your profile.

                    1. 3

                      gopher://verisimilitudes.net:70/1/2019-02-12

                    2. 2

                      The caps.txt file exists as a way to programmatically define a way to navigate through a gopher site based upon gopher selectors. Technically, they’re opaque identifiers with no meaning except to the gopher server. Most gopher servers use paths as a selector, but not all (mine for example—if you end up here it’s hard to say what the “parent” directory would be). I have no idea how useful it is.

                    1. 10

                      My conclusion, based on reviewing evidence from numerous large software projects using C and C++, is that we need to be migrating our industry to memory safe by default languages (such as Rust and Swift).

                      I totally support this. C(++) is awesome for being so bare bones when working with low level stuff. But I feel software projects not needing such functionality could greatly benefit from safe languages.

                      1. 15

                        Could you elaborate on what you consider low-level stuff, where Rust, Ada, or other safe languages are not an option? You can compile Rust to STM32 microcontrollers with 20KB RAM and 64KB flash (with no_std), Rust has SIMD intrinsics for various platforms, etc.

                        To me, the major reason to go for C or C++ are ecosystems in which they are traditionally strong. gcc targets a lot of platform. Many embedded toolchains are only available for C or C++. The best traditional GUI libraries are in C or C++ (e.g. Qt). And (obviously) a gazillion lines of existing code are in C or C++, from open source unix kernels to deeply proprietary systems that will be used and maintained for decades to come.

                        Even though it may not be the (only) goal of the C++ standards committee, I see Modern C++ as a band-aid for maintaining C++-based systems that will be around for a long time, than a serious contender for modern, safe languages.

                        1. 1

                          Of course, ‘low level’ is very vague. I meant projects in which you want to use raw pointers and want to calculate with them, want to use CPU registers, want to have control over the produced asm, projects for very constrained platforms or obscure architectures, and so on. I do not necessarily mean other languages aren’t an option. I’m sure languages like Rust could replace a lot of C(++) code bases, even for these ‘low level’ things. In fact, I’d totally go for replacing such projects with a Rust variant if possible. But at the same time I can understand why some might choose to go with C(++).

                          1. 9

                            As far as I can tell as soon as your code is complex enough to make you want to move from C to C++ then you should probably reach for something safer. It’s hard to keep both the complexities of the invariants you need to manually ensure in your head while solving complex software problems.

                            1. 4

                              ATS is an option here. It allows type safe use of low level pointers, including addiction, dereferencing, etc.

                          2. 2

                            C and C++ are completely different languages at completely different ends of a lot of spectrums. C is certainly bare bones, but C++ is not. What do you mean by ‘C(++)’?

                          1. 6

                            Oz/Mozart is pretty cool. Last time I looked at it I thought it was mostly a teaching language. Have there been large scale applications built with it recently?

                            1. 5

                              I don’t think so. As far as I understand it’s intended as a teaching language.

                              I was blown away when following along with the edX course [1] and the textbook [2],which demonstrates you can have all different programming paradigms in the same language, depending on which primitives you add. That clarified quite a few things about PL fundamentals for me.

                              [1] https://courses.edx.org/courses/LouvainX/Louv1.1x/3T2014/course/ and https://courses.edx.org/courses/LouvainX/Louv1.2x/4T2014/course/

                              [2] https://mitpress.mit.edu/books/concepts-techniques-and-models-computer-programming

                              1. 4

                                I ran a web service for a while written in Mozart/Oz, using the Roads web framework. It worked pretty well but I hit some scaling issues with the runtime - I hit limits with incoming sockets due to use of ‘select’ in the runtime vs epoll/kqueue/etc. I still use Mozart/Oz occasionally. I’ve been working on porting the runtime of the 1.3.x version to 64 bit in this branch so I can continue using it.

                              1. 17

                                We already live in a post-scarcity world and arguments structured around retiring early admit it without actually admitting it. The future is here, it’s just not evenly distributed. Better to address the distribution problem than worry about retiring at 30.

                                1. 8

                                  Sounds like an argument for effective altruism / earning to give, a path I don’t see much talked about in the finance / FI communities. Definately a path that’s been on my mind lately. One account I’ve been reading on this is jefftk who contributed much of his income while working at a tech bigCo: https://www.jefftk.com/giving

                                  (personally just starting to think about this stuff - found myself reading both ‘winners take all’ and ‘doing good better’ recently (which have some contradictions between each other) and finding it a bit nuts how hard picking donation funds is - even coolearth as a carbon offsetting fund recommended by ‘doing good better’ a few years ago has been criticized https://forum.effectivealtruism.org/posts/RnmZ62kuuC8XzeTBq/why-we-have-over-rated-cool-earth )

                                  1. 4

                                    One thing I forgot to mention is that the framing of the existing model feels off to me and I don’t think that pursuing money in an effort to better distribute it as an individual is a viable path because it still emphasizes the pursuit of money.

                                    I think somewhere along the way people forgot that money is only a proxy for “value” and in pursuit of the proxy metric we devalued all the things that were actually valuable. When optimizing a proxy it is easy to forget what the proxy was initially measuring/approximating.

                                    I call this the green paper token fallacy.

                                    1. 2

                                      Yep, wasn’t trying to evangelize EA as the path, just an option that could make sense for some. For full disclosure I have not been effective altruist, am trying to sort out my worldview / goals / finances and it’s been on my mind more. Thinking aloud a sci-fi story ‘The guy who worked for money’ https://www.shareable.net/blog/the-guy-who-worked-for-money which compares money as a proxy versus a social credit score as proxy comes to mind.

                                    2. 2

                                      So, I think that’s the pragmatist’s view. I understood @davidk01 ’s comment to be a much more philosophical, long view take.

                                      If I’m reading him right, he’s suggesting that the entire capitalist framework we live under is basically over, but various entities just haven’t caught up with that yet, and we should solve the larger problem of how to distribute wealth equitably rather than striving to enrich ourselves.

                                      I’d love for him to be right, but I suspect, at least in the near term, he’s not. And if he’s wrong, yes, earning to give is definitely the more virtuous path.

                                      1. 3

                                        Yeah, agree it’s an optimistic long view to hope for (James Burke from ye olde Connections show had a nice lighthearted on post-scarcity https://www.bbc.co.uk/programmes/b09jvfc4 ). I’ll leave a similar comment I left on HN recently:

                                        I’ve been fascinated by this plot of ‘social thresholds achieved’ at the cost of ‘biophysical boundaries transgressed’ - https://goodlife.leeds.ac.uk . I find it a more level-headed analysis to frame arguments around what resource usage it takes to be a ‘happy’ country, rather than just aggregating various happiness metrics alone. “No country in the world currently meets the basic needs of its citizens at a globally sustainable level of resource use.” (summary article: https://theconversation.com/is-it-possible-for-everyone-to-live-a-good-life-within-our-planets-limits-91421 ) (via HN discussion on world happiness report: https://news.ycombinator.com/item?id=19615776 )

                                        1. 1

                                          What’s interesting to me is that adjectives like “just” get thrown around much more than “happy” which says something about what people see as important.

                                          1. 1

                                            You mean when people optimize they choose fairness vs some other metric? Or do you mean something else?

                                            1. 2

                                              I mean that when people talk about enacting fairly major changes to society, I often hear them talk about the injustice of the currently lopsided capitalist system of wealth distribution, rather than the overall happiness of the average citizen.

                                    3. 2

                                      That’s an incredibly altruistic attitude. Admirable.

                                      As for me, I’ve been slugging it out in the trenches now for 30 years. I’d be more than willing to put time and effort into solving the redistribution problem if I had any confidence at all that it would actually be effective.

                                      Humans are lazy and greedy. I have yet to learn of a vision for a post scarcity world that actually takes those very basic human traits into account.

                                      1. 6

                                        every adjective that exists for humans is a trait that humans have. otherwise the words wouldn’t exist. humans are also industrious, smart, caring, compassionate, and creative.

                                        you don’t think social democratic and socialist proposals account for greed and sloth?

                                        1. 1

                                          you don’t think social democratic and socialist proposals account for greed and sloth?

                                          I don’t, but then the set of democratic socialist proposals I’ve been exposed to in detail is fairly small. I’d love to see you cite a concrete counter-example. I’m always open to having my mind changed in the face of compelling evidence!

                                          1. 1

                                            take the green new deal for example. does that proposal fail to account for human greed or laziness? did FDR’s new deal?

                                            perhaps the difference is that these proposals view greed and laziness as things to be overcome, while you view them as hard limits which cannot be overcome?

                                            1. 1

                                              The green new deal is a perfect example. I have yet to be able to put my finger on precisely what the green new deal IS except “Yay renewable energy! Yay income equality! Yay good health care, affordable housing, and clean air for all!”

                                              I love the enthusiasm and I am 100% behind the ideals, but I don’t see a plan for implementation here.

                                              If you can give me a cite that lays out a concrete plan, I’d love to see it.

                                              1. 1

                                                it doesn’t sound like your misgivings have to do with greed or laziness, so i sense that we’re going off on a slight tangent. but i love discussing the GND anyway.

                                                are you aware of the green new deal FAQ? this should get you beyond “Yay renewable energy! Yay income equality! Yay good health care, affordable housing, and clean air for all!” it includes concrete proposals such as a government jobs program to put people to work developing alternative energy infrastructure. is this too abstract? or maybe you take issue with the current lack of detail?

                                                1. 1

                                                  The FAQ did in fact help. It lays out the idea that this will be a huge investment in infrastructure. It’s still way shorter on details than I’d like, but at LEAST it addresses “How will we pay for this?” rather than crowing about our glorious worker’s paradise future with no clear plan to get there.

                                                  I’ll keep my eye on this and hope to see it evolve further. This is indeed something I could get behind.

                                                  A thing I wonder about though is, the ‘guaranteed jobs for all!’ clause. The new deal did this through efforts like the WPA, which were disbanded when the great depression ended. How will this address the fact that joblessness is going to be an increasing problem with greater automation?

                                                  1. 2

                                                    i think a government jobs program is a way to address loss of jobs due to automation. green new deal jobs wouldn’t go away unless we decide they should. maybe we should be asking “will the green new deal harness the bounty provided by greater automation.” i certainly hope so, as that’s one of the things that could make the 10 year time frame feasible.

                                                    i don’t think it’s a comprehensive solution though; something like UBI or general sharing of goods regardless of one’s ability to make a wage may be necessary in the long term.

                                        2. 2

                                          This is true but part of it I think is believing the people part will work out because plenty of people come to the realization about post-scarcity and money. I guess the effort is diffuse and not as organized as it could be. I try to remind myself and others that at the end of the day we really have everything we need and want and that money is made up.

                                        3. 2

                                          We most assuredly do not live in a post scarcity world. What we live in is a world where we, and our parents, have been spending the inheritance of our grand children to produce baubles no one needs [0]. It is an easy mistake to make when one lives in the richest city in the richest state, in the richest country in the world.

                                          The past is littered with promises of an boundless future, today’s millenarian cults are no different. Be they the Easter Islands destroying their trees and falling into centuries of cannibalism, or South African tribes slaughtering their cattle expecting the ancestors would give them better herds.

                                          That we replaced God with the microchip and heaven with post scarcity is not much of an improvement.

                                          What the future looks like is Cuba, in the best of circumstances. [1]

                                          [0] https://www.bbc.com/news/magazine-33133712

                                          [1] Unless we nationalize the economy in the hopes of figuring out hot fusion before climate change makes industrial society impossible between 2050-2100.

                                          1. 2

                                            Be they the Easter Islands destroying their trees and falling into centuries of cannibalism

                                            Not to dispute your main point but I feel the need to stand up for my Polynesian whānau. The “destroying their trees and falling into centuries of cannibalism” story (popularised by Jared Diamond) has been debunked [0][1][2]. They’ve been many more studies and articles about it since.

                                            1. 1

                                              So are you the one that grew up in post-communist Armenia or me? Check your assumptions at the door when engaging in online forums. The world is a big place with a lot of people who did not grow up in a boundless world and still concluded that we have plenty to go around.

                                              1. 1

                                                1). Identity politics has nothing to do with the ecological footprint of industrial society.

                                                2). Ad ad hominem attacks are content free.

                                                3). Лесно е да говориш за предположения когато мислиш че всичи други са Американци.

                                          1. 11

                                            Seaside was the first framework I saw that really delivered on this design well (though WebObjects notably came really close without actually using closures). Factor also has a continuation based web server that meshes well with plain REST, making it really easy to use the memory-heavy continuation model for admin and other lightly trafficked pages.

                                            1. 8

                                              My Factor articles PDF has a chapter on building continuation based HTTP responders from scratch. The text of that chapter is here. I used to use continuation based servers a lot in the past. It was one of the first things that interested me in Factor when I found out it had continuations.

                                              1. 2

                                                I remember Avi Bryant speaking about IOWA at RubyConf in 2002 (IOWA had just that year been to Smalltalk to become Seaside). We were wowed at the idea that you could write a web application in a linear, procedural style, rather than the discontinuous, event-driven style we were used to.

                                                I’m not sure where Avi got the idea to use call/cc for a web framework, but it was so intuitive, I’m convinced the Ruby web development world would look completely different today, if Ruby had had an efficient implementation of continuations at the time.

                                              1. 2

                                                This has really inspired me. I never knew that basic web engines were that simple to implement (600 lines of Haskell) !!

                                                1. 3

                                                  Writing web browsers used to be one of the programming tasks to try in new languages. That’s why you saw implementations in Java, TCL, Self, etc. Sadly the web became much more complicated and browsers got out of reach of being a medium sized programming exercise. Gopher is still a fun exercise though!

                                                  1. 2

                                                    Well, these 600 lines are mostly the high-level logic and layout code.

                                                    To be completely honest, one also would need to count the lines of code in its dependencies of non-trivial complexity (e.g. SDL + Haskell bindings for SDL, http-client which drags the whole OpenSSL in, etc).

                                                    1. 4

                                                      Agreed. I’m very up on the idea of getting more languages to run on the BEAM. I miss static types and, frankly, I wish that Rust could compile down to run on the BEAM!

                                                      1. 5

                                                        Yeah, I love Elixir to death, but sometimes I find myself wishing for a real type system. Some folks swear by Dialyzer, but it feels a bit like a cludgy piece of typing duct tape.

                                                        1. 12

                                                          The dynamically-typed nature of Erlang and Elixir and BEAM comes from a design requirement: that the systems built in Erlang can be upgraded at runtime. Strong typing gets quite a bit more complicated when you need to be able to have multiple versions of a type coexist at runtime.

                                                          Side note, this took me a while to absorb when beginning to write Elixir. My instinct was to use structs instead of generic maps for GenServer state, since better-defined types are better, right? But that imposes hard requirements on hot upgrades that wouldn’t have been there if I’d used untyped maps from the start; removing fields from a struct breaks upgrades. This knowledge was somewhere between “esoteric” and “esoteric to Ruby assholes who just showed up, well-known to wonks”. The Erlang Way is a lot more than “let it crash”. :)

                                                          1. 3

                                                            The dynamically-typed nature of Erlang and Elixir and BEAM comes from a design requirement: that the systems built in Erlang can be upgraded at runtime. Strong typing gets quite a bit more complicated when you need to be able to have multiple versions of a type coexist at runtime

                                                            Yeah, I really wish there was more type system research going into figuring out how to use them effectively in upgradable, always-on systems, where you might have heterogeneous versions across a cluster. I actually think static types could be super helpful here, but as far as I’m aware there doesn’t seem to be much work put into it.

                                                            1. 4

                                                              It’s very difficult. It’s not like nobody tried — https://homepages.inf.ed.ac.uk/wadler/papers/erlang/erlang.pdf

                                                              And when people talk about “I wish there was a type system” they probably don’t realise that Erlang is very different animal (that can do things other animals have no concepts for). Just bolting on types is not an option (if you want to know what happens if you do so, look at CloudHaskell — you have to have a exact binary for every node in the entire cluster, or else).

                                                              1. 1

                                                                Just bolting on types is not an option (if you want to know what happens if you do so, look at CloudHaskell — you have to have a exact binary for every node in the entire cluster, or else).

                                                                That’s what I mean. I see Cloud Haskell as interesting, but really not the distributed type system I want. It would be super cool to see more new ideas here (or rediscovery of old ones, if they’re around). Eg. you may need some kind of runtime verification step to ensure that a deployment is valid based on the current state of the world. Perhaps some stuff from databases and consensus would help here. Doing that efficiently could be… interesting. But that’s why research is important!

                                                              2. 3

                                                                I think protocol buffers (and similar systems like Thrift / Avro) are pretty close to the state of the art (in terms of many large and widely deployed systems using them). When you write distributed systems using those technologies, you’re really using the protobuf type system and not the C++ / Java / Python type system. [1] It works well but it’s not perfect of course.

                                                                I also would make a big distinction between distributed systems where you own both sides of the wire (e.g. Google’s), and distributed systems that have competing parties involved (e.g. HTTP, e-mail, IRC, DNS, etc.). The latter case is all untyped because there is a “meta problem” of agreeing on which type system to use, let alone the types :) This problem is REALLY hard, and I think it’s more of a social/technological issue than one that can be addressed by research.

                                                                [1] This is a tangent, but I think it’s also useful to think of many programs as using the SQL type system. ORMs are a kludge to bridge SQL’s type system with that of many other languages. When the two type systems conflict, the SQL one is right, because it controls “reality” – what’s stored on disk.

                                                                1. 2

                                                                  I think protocol buffers ⟨…⟩ are pretty close to the state of the art

                                                                  Seriously? PB, where you can’t even distinguish between (int)-1 and (uint)2 is state of the art?

                                                                2. 2

                                                                  Alice ML is a typed programming language designed to enable open extensions of systems. Objects can be serialized/deserialized and retain their types and it’s possible to dynamically load new code.

                                                                3. 2

                                                                  The Erlang Way is a lot more than “let it crash”. :)

                                                                  I am so with you on this one, and I’ve got so much to learn!

                                                                  1. 6

                                                                    You might find ferd’s intro helpful. For historical perspective with some depth, you might like Armstrong’s thesis from 2003 that describes everything in deep detail.

                                                                  2. 2

                                                                    Yup, this is related to the point I was making about protobufs and static “maybe” vs. dynamic maps here. In non-trivial distributed systems, the presence of fields in message has to be be checked at RUNTIME, not compile-time (if there’s a type system at all).

                                                                    https://lobste.rs/s/zdvg9y/maybe_not_rich_hickey#c_povjwe

                                                                    I think of protobufs/thrift as trying to “extend your type system over the network”. It works pretty well, but it’s also significantly different from a type system you would design when you “own the world”. Type systems inherently want a global view of your program and that conflicts with the nature of distributed systems.

                                                                    edit: this followup comment was more precise: https://lobste.rs/s/zdvg9y/maybe_not_rich_hickey#c_jc0hxo

                                                                  3. 2

                                                                    So this is really interesting. I read the paper on success typing and it seems pretty cool. It still, however, doesn’t guarantee soundness. Then on the other hand, neither does TypeScript, so it’s hard for me to make up my mind about what I want.

                                                                  4. 4

                                                                    That would be cool. There’s at least Rustler.

                                                                    1. 4

                                                                      Static types per se — that’s easy. But think about the distributed system with different versions of VMs. Think about live upgrades.

                                                                  1. 2

                                                                    Is “Gopher Hole” the term the gopher community uses for a Gopher server? Or is it a gateway to a Gopher server from the WWW?

                                                                    1. 3

                                                                      “gopherhole” and “gopherspace” are gopher’s counterparts of web’s “website”.

                                                                      1. 1

                                                                        Ah, that makes sense, thanks!

                                                                    1. 6

                                                                      I’m a fan of Ur/Web and would like to see more articles on it. I used it for a couple of production systems and it was great. I still use it for personal projects that use a web UI. The application executable can be compiled statically with musl libc enabling it to run on almost any Linux system. Very useful.

                                                                      1. 4

                                                                        I used to use Corman Lisp a lot years ago. I wrote some utilities for the Creature series of games using it. It’s a great little lisp, very cool to see it’s still around.

                                                                        1. 3

                                                                          a blog post or series of posts i’d love to see is the incremental migration of part of an ocaml project to F*, analogous to e.g. rewriting bits of a ruby program in C for speed, or a C program in rust for safety and ergonomics.

                                                                          1. 4

                                                                            Such an example would be nice. There’s an example of calling F* from OCaml in the repository, an example of safe printf in their blog, a crypto library written in F* and compiled to C called HACL* (see project everest for more). I don’t know of anything incremental like you want though. F* modules are converted to OCaml modules so I don’t think it should be too difficult. Sounds like a good learning project to create such a post.

                                                                            1. 1

                                                                              Hi, curious as to why you’d find that interesting.

                                                                              1. 3

                                                                                as an industry and hobbyist (as opposed to academic) programmer, i find it hard to think of anywhere i’d have a better experience writing code in F* rather than in just plain ocaml. and indeed, there are lots of things that (as far as i can see) i cannot do in F* - i could not find gtk bindings, e.g..

                                                                                one potentially great use case, though, is “okay, it’s certainly more ergonomic to write your project in ocaml, and you’ll have better library support, but for this particular subtask F* will catch a large variety of corner cases/ make your side effects easier to reason about/ clean up your error handling code/ etc.”. a real world example of extracting some ocaml code to an F* library would be extremely interesting.

                                                                                1. 1

                                                                                  See if F* can do code extraction. Coq can extract code to ocaml and others (scheme and haskell I think)

                                                                                  1. 1

                                                                                    it can; it compiles down to either ocaml or f# code, which is why i felt it would be a good candidate for this sort of library extraction.

                                                                                    1. 1

                                                                                      Oh silly me I thought you were asking about f* to ml

                                                                              1. 13

                                                                                I was always sad that everyone seemed to do their best to ignore and work around prototype-based programming in JS. Instead a million different libraries were written to add pseudo class-based inheritance.

                                                                                For example, people always said “don’t modify the root objects!” That was one of the great powers of prototype-based programming: you could modify the root objects, like String and Array and give them new methods that suddenly everyone could use. Dynamic inheritance hierarchies, one-off domains of objects with a barely-distinct prototype object to delegate to… That was all frowned upon by “good style”, meaning a very powerful feature was left by the wayside.

                                                                                The new operator in JS was also really elegant in what it did, but people always worked around it to make it something that it wasn’t.

                                                                                (new executes a creation function but makes the this operator return the newly-created object…the creation function is free to return a different object, the new object, or anything else.)

                                                                                Self was the first prototype-based programming language, but the most beautiful one (IMHO) was Io. I remember playing with Io when it first came out (like 15 or 16 years ago) in a hotel room on a business trip and ending up staying up all night after it had “clicked” for me and just exploring the language.

                                                                                1. 5

                                                                                  I agree with you that it’s a shame more people don’t take time to understand how prototypes work in JS. I have mixed feelings on altering the native object prototypes (like Array, String, etc), mostly because I’ve seen it cause real issues in the past (particularly with Prototype.js back around 2007). In isolation, it’s not a big deal, but when libraries start doing it, it can lead to collisions and unexpected behaviors. That’s the main reason I recommend people stay away from modifying them.

                                                                                  JS is a really fun language when you get to know it, the problem is that people just don’t want to get to know it. It’s not exactly like what they already know and love, so it just sucks.

                                                                                  1. 2

                                                                                    I have mixed feelings on altering the native object prototypes (like Array, String, etc), mostly because I’ve seen it cause real issues in the past

                                                                                    True, but it’s such a powerful feature! Namespacing is a problem in a lot of languages; it could be worked around by prefixing or whatever. I wonder what a “real” namespace mechanism would look like when combined with prototype-based programming.

                                                                                    JS is a really fun language when you get to know it,

                                                                                    Again, true, but some of the rough edges people complain about really are pretty rough. (sort sorting by string representation, objects being treated as dictionaries, but with keys based off of toString, the various weak typing for comparisons, etc…)

                                                                                    It’s been a while since I’ve used JavaScript heavily (ES 3 was the last version I would claim to know well), so I don’t know how much has changed. Stuff with futures and promises and async stuff is all unknown to me (I only know what I’ve picked up from reading other people talk about it).

                                                                                    1. 3

                                                                                      Use Symbol objects for your method names and you can have fully separated namespaces for methods to your heart’s content. :)

                                                                                      1. 3

                                                                                        “Any sufficiently complicated C or Fortran [or JavaScript] program contains an ad-hoc, informally-specified, bug-ridden, slow implementation of half of Common Lisp.”

                                                                                        1. 3

                                                                                          Wait it said bug ridden. Let’s see if we can respin it:

                                                                                          “Any sufficiently-complicated, fast, Common Lisp program contains ah-hoc, informally-specified, bug-ridden extensions to Jitawa Lisp.”

                                                                                        2. 1

                                                                                          Symbols are primitives, not objects, though. Nitpicking aside, I’ve implemented a library for generic programming based on the approach of extending builtin prototypes with symbol properties: https://github.com/slikts/symbola

                                                                                        3. 3

                                                                                          I have mixed feelings on altering the native object prototypes (like Array, String, etc), mostly because I’ve seen it cause real issues in the past

                                                                                          True, but it’s such a powerful feature! Namespacing is a problem in a lot of languages; it could be worked around by prefixing or whatever. I wonder what a “real” namespace mechanism would look like when combined with prototype-based programming.

                                                                                          More programming languages should implement something like Ruby’s refinements (scope-limited monkey patching): http://www.virtuouscode.com/2015/05/20/so-whats-the-deal-with-ruby-refinements-anyway/

                                                                                      2. 2

                                                                                        Self and Io are two languages I really like to play around with. I wrote a post a while back comparing prototype programing style between them.

                                                                                      1. 3

                                                                                        Frontier was a really neat environment, but I don’t think this article goes nearly far enough in emphasizing how important outlines were to the system.

                                                                                        The database presented as an outline. Your scripts presented as an outline, and the content that lived in the persistent DB/CMS was… An outline!

                                                                                        If you’re like me and think in outlines, this was INCREDIBLY powerful.

                                                                                        IMO it’s this kind of “turtles all the way down” conceptual consistency that fascinates people about LISP machines and more recently programming language-centric unikernels.

                                                                                        I find the idea very appealing. It’ll be interesting to see if the author ever progresses beyond “thinking” and actually implements something :)

                                                                                        (Pot, kettle, black - I never implemented anything with Frontier but played with it and was enamored with it for YEARS :)

                                                                                        1. 2

                                                                                          I didn’t use Frontier, but did use Radio Userland which was the same base if I recall correctly. The outliners and persistence was great. It’s very smalltalk-y in feel but with outliners for code and data organisation. Using the Self programming language a bit later reminded me of it somewhat since they use outliners for displaying object data - but not for the code itself.

                                                                                          1. 1

                                                                                            Yes! Radio Userland was, ISTR Frontier bundled with a bunch of packages for making it act like a CMS/blogging engine/web server etc.

                                                                                            I think they even started referring to Frontier as the “kernel”.

                                                                                        1. 4

                                                                                          Oh the days when the web was simpler and implementing basic web browsers was one of the programming language exercises people did. Sadly not so much anymore. Nice to see a Common Lisp version!

                                                                                          1. 1

                                                                                            So Clouldfare wants to help decentralisation by… making it more centralised?

                                                                                            1. 2

                                                                                              if they are adding ipfs nodes, who cares? you can always run your own gateway if you don’t like it.

                                                                                              1. 2

                                                                                                Does more nodes help IPFS, or is it more nodes that pin content that is more useful? The pull model, where data sits at origin unless pinned, seems like originators of the data would always have the problem of how to distribute it so as not to face the “thundering herd” of initial requesters.

                                                                                                1. 2

                                                                                                  As far as I know the protocol doesn’t actively push blocks around, the various nodes have to request and pull them. That only happens if a client requests the block to the node. The protocol also doesn’t provide incentive for the nodes to keep the data around. I don’t know what is the default retention logic on the actual nodes.

                                                                                                  In practice what this translates to is that there isn’t much guarantee for data to stay around. Typically a client will want to get the data over HTTP and only address a single gateway (like the CloudFlare one) so the only copies would be in the serving node (your laptop / server) and that single gateway. If your laptop disappears, CloudFlare will probably flush it’s cache at some point and your page will have disappeared entirely.

                                                                                                  Hopefully in the future the browsers will be talking IPFS directly and store local copies. That way the network would become much more resilient to data loss.

                                                                                                  1. 1

                                                                                                    a nice system might be a provider where you pay upfront the lifetime price of hosting something with storage costs extrapolated into the future.

                                                                                                    1. 1

                                                                                                      Files should probably devalue over time or maybe be maintained financially by people who want to access them. Eternity is a long time for a single payment.

                                                                                                      I believe that the IPFS authors realized the issue with the protocol and that https://filecoin.io/ is one of the answer that they could come up with.

                                                                                              2. 2

                                                                                                I guess it does make sense. If the Internet does shift to become more decentralized, Cloudflare would want a piece of that pie as well. Worst case nobody uses this service and they close it eventually, and best case they just future-proofed their business.

                                                                                                I also think that having them run an IPFS node is pretty helpful. If there’s a way to translate a website addressed proxied by Cloudflare into a file hash, it would help decentralization.

                                                                                              1. 5

                                                                                                I write mostly about my explorations of different programming languages https://bluishcoder.co.nz

                                                                                                1. 9

                                                                                                  I’m not as involved as I used to be, but I’m still on the core team, so feel free to ask me questions if you’ve got any.

                                                                                                  1. 3

                                                                                                    Would you recommend Factor for production use given that it seems to be reaching a sort of plateau in support and community?

                                                                                                    It’s a beautiful language, by the way. Thank you for your work.

                                                                                                    1. 5

                                                                                                      I have Factor running in production. Although I don’t really maintain the web app much - it just ticks along - Factor runs tinyvid.tv and has for the past few years. I originally wrote it to test HTML 5 video implementations in browsers back when I worked on the Firefox implementation of video.

                                                                                                      1. 5

                                                                                                        As always, it depends on what you’re doing—I’d definitely be nervous if you told me you were shoving Factor into an automobile, for example—but Factor the VM and Factor the language are both quite stable and reliable. On top of doublec’s comment, the main Factor website runs Factor (and its code is distributed as part of Factor itself for your perusal), and it’s been quite stable. (We do occasionally have to log in and kick either Factor or nginx, but it’s more common that the box needs to be rebooted for kernel updates.) I likewise ran most of my own stuff on Factor for a very long time, including some…maybe not mission-critical, but mission-important internal tooling at Fog Creek. And finally, we know others in the community who are building real-world things with Factor, including a backup/mirroring tool which I believe is being written for commercial sale.

                                                                                                        The two main pain-points I tend to hit when using Factor in prod are that I need a vocabulary no one has written, or that I need to take an existing vocabulary in a new direction and have to fix/extend it myself. Examples are our previous lack of libsodium bindings (since added by another contributor) and our ORM lacking foreign key support (not a huge deal, just annoying). Both of these classes of issues are increasingly rare, but if you live in a world where everything’s just a dependency away, you’ll need to be ready for a bit of a change.

                                                                                                        You can take a look at our current vocab list if you’re curious whether either of the above issues would impact anything in particular you have in mind.

                                                                                                      2. 1

                                                                                                        What would you say is Factor’s best application domain, the kind of problem it solves best? I met Slava many years ago when he was presenting early versions of Factor to a local Lisp UG, and am curious to see where the language fits now, both in theory and practice.

                                                                                                        1. 4

                                                                                                          My non-breezy answer is “anything you enjoy using it for.” There are vocabularies for all kinds of things, ranging from 3D sound to web servers to building GUIs to command-line scripts to encryption libraries to dozens of other things. Most of those were written because people were trying to do something that needed a library, so they wrote one. I think the breadth of subjects covered speaks well to the flexibility of the language.

                                                                                                          That all said, there are two main areas where I think Factor really excels. The first is when I’m not really sure how to approach something. Factor’s interactive development environment is right up there with Smalltalk and the better Common Lisps, so it’s absolutely wonderful for exploring systems, poking around, and iterating on various approaches until you find one that actually seems to fit the problem domain. In that capacity, I frequently use it for reverse-engineering/working with binary data streams, exploring web APIs, playing with new data structures/exploring what high-level design seems likely to yield good real-world performance, and so on.

                                                                                                          The second area I think Factor excels is DSLs. Factor’s syntax is almost ridiculously flexible, to the point that we’ve chatted on and off about making the syntax extension points a bit more uniform. (I believe this branch is the current experimental dive in that direction.) But that flexibility means that you can trivially extend the language to handle whatever you need to. Two silly/extreme examples of that would be Smalltalk and our deprecated alternative Lisp syntax (both done as libraries!), but two real examples would be regular expressions, which are done as just a normal library, despite having full syntax support, or strongly typed Factor, which again is done at the library level, not the language level. I have some code lying around somewhere where I needed to draft up an elaborate state machine, and I quickly realized the best path forward was to write a little DSL so I could just describe the state machine directly. So that’s exactly what I did. Lisps can do that, but few other languages can.

                                                                                                        2. 1

                                                                                                          Were native threads added in this release, or are there plans to? And did anything ever come to fruition with the tree shaker that Slava was working on way back when?

                                                                                                          Major props on the release. It’s really nice to see the language survive Slava disappearing into Google.

                                                                                                          1. 5

                                                                                                            The threads are still green threads, if that’s what you’re asking, but we’ve got a really solid IPC story (around mailboxes, pattern matching, Erlang-style message passing, etc.), so it’s not a big deal to fire up a VM per meaningful parallel task and kick objects back and forth when you genuinely need to.

                                                                                                            In terms of future directions, I don’t know we’ve got anything concrete. What I’d like to do is to make sure the VM is reentrant, allow launching multiple VMs in the same address space, and then make the IPC style more efficient. That’d make it a lot easier to keep multithreaded code safe while allowing real use of multiple cores. But that’s just an idea right now; we’ve not done anything concrete that direction, as far as I know.

                                                                                                            1. 1

                                                                                                              Really off-topic, but isn’t Slava at Apple?

                                                                                                              1. 1

                                                                                                                He is now. Works on Swift.

                                                                                                            2. 1

                                                                                                              Where does the core factor team typically communicate these days? #concatenative on freenode seems kinda dead these days. Is there a mailing list, or on the yahoo group?

                                                                                                            1. 3

                                                                                                              Ok, new vision: like Smalltalk and LISP debugging with support for single-threaded, multicore, and distributed applications. Different modes for different situations. Can run locally or remotely on a server. If distributed, on multiple servers in the cloud of your choosing. Just brainstorming here. We do want the baseline for 2018 at least as good as 1970’s-1980’s platforms, though.

                                                                                                              1. 3

                                                                                                                Something like debugging in Inferno (and probably Plan 9). Mount the remote CPU and debug. Unfortunately Limbo didn’t have the power of Smalltalk with regards to “programming in a soup of live objects” feel.