1. 2

    Suppose you used Dotty’s union types to implement a Maybe. Doesn’t this fall prey to the same hassle of having to (usually) change the callsite if you remove the ‘null’ type from the union?

    I say usually because I assume that Dotty’s pattern matching must be exhaustive and most people would pattern match on the result.

    1. 3

      You’ve got it backwards, and doubly so. First - tagged unions with explicit constructors are an imperfect way to implement union types, not the other way around. It seems that Dotty is an extension of Scala so naturally it has both (tagged unions being case classes, if I understand Scala correctly). Second - reducing the amount of acceptable parameters by removing the null option, what Hickey calls “strengthening the requirements” is an incompatible change. Function types are contravariant in their input, remember?

    1. 1

      I’m sure this is naive, but I’m unsure what the use-case is for Nim over Go. Maybe the optional garbage collection? Compilation to javascript, too, maybe.

      1. 2

        I guess I should be thankful that my circuit breaker just cuts off electricity when there is too much load so it is like a forced reboot at least once a month.

        The FBI recommends any owner of small office and home office routers reboot the devices to temporarily disrupt the malware and aid the potential identification of infected devices. Owners are advised to consider disabling remote management settings on devices and secure with strong passwords and encryption when enabled. Network devices should be upgraded to the latest available versions of firmware.

        I would like to learn more about this. I am pretty sure Verizon has a backdoor to my WiFi router FiOS-G1100. Does anyone else have this router? What do you see when you go to http://myfiosgateway.com/#/monitoring ? I see

        UI Version: v1.0.294 Firmware Version 02.00.01.08 Model Name: FiOS-G1100 Hardware Version: 1.03

        1. 2

          Access to your router is likely not publicly routed. I can’t access that web page (connection failed).

          1. 1

            Ah, I should have mentioned you need to be at home behind your FiOS F1100 router, log in and click on system monitoring on the top right corner.

            Here’s the router/modem in question: https://www.verizon.com/home/accessories/fios-quantum-gateway/

          2. 1

            Why do you think Verizon has a backdoor?

            1. 2

              They along with other ISP’s took tens to hundreds of millions to backdoor their networks for NSA. That was in leaks. You should assume they might backdoor anything else.

              1. 1

                Got a link to the specific leaks?

                1. 1

                  Forbes article.

              2. 2

                Once man’s backdoor is another man’s mass provisioning service.

                1. 1

                  Maybe I used an incorrect technical word. I meant to say I think they can remotely access and configure the modem / router.

                  1. 1

                    ISP’s backdooring home routers isn’t unknown, where here I use ‘backdooring’ to mean “ISP can log in and make changes even though most home users don’t know they can do this”. Some use it to push out router firmware updates (for their preferred models).

                1. 2

                  They are useful for making user-defined row ordering (like a todo list) that you can rearrange without having to renumber surrounding items.

                  Would you mind explaining how that works?

                  1. 4

                    Suppose I used integers to keep track of the order of todos:

                    create table todos (
                      prio bigserial unique,
                      what text not null
                    );
                    insert into todos (what) values ('A'), ('B'), ('C'), ('D');
                    

                    If I wanted to insert a new value E between A and B when ordering by prio, I’d have to do:

                    -- this action needs to happen transactionally
                    begin;
                    
                    -- move items ahead to make room
                    update todos
                    set prio = prio + 1
                    where prio > 1;
                    
                    -- add the new one
                    insert into todos values (2, 'E');
                    
                    -- don't forget to advance the sequence too
                    select nextval('todos_prio_seq');
                    
                    commit;
                    

                    Basically I have to move a bunch of items ahead to make room for E. Whereas if I number the rows with fractions I can find a place for E without moving any other items.

                    1. 2

                      If I understand you, then you could, e.g., set the priorities of A, …, D to be 1, 1/2, 1/3, 1/4, respectively. Then the priority of E could be (1 + 1/2) / 2 = 3/4. Generally, the priority of an item inserted between items x and y would be the average of their priorities. Super neat!

                      Edit: I now see your rational_intermediate function, and realize that my approach definitely wouldn’t scale. E.g., my method to find a priority between 3/4 and 1/2 would give a denominator of 8. In the pathological case, these denominators could quickly become too big to efficiently represent.

                      1. 3

                        Averages were my first attempt as well. Turns out clockmakers in the 1800s were pretty ingenious, though. :)

                  1. 3

                    Makes me think of 80000 Hours’ argument about earning to give. The essential takeaway is that you can greatly increase peoples’ happiness with an amount of money that is small by the standards of Google/FB/etc.

                    Moreover, there are charities that are extremely efficient with their money. See this quote from here:

                    GiveDirectly has done a randomised controlled trial of their program, which found significant reductions in hunger, stress and other negative outcomes. Most of the money is invested in assets, such as metal roofs and water equipment. There’s little evidence it’s “wasted” on alcohol or gambling. GiveDirectly’s trial adds to an already substantial literature on cash-transfers, showing significant benefits (though these are usually conditional rather than unconditional).

                    And, to add some emotion to it (from the same article):

                    If you donate 10% of your household income to GiveDirectly each year, that’s $4,300 per year over your career. That’s enough to double the income of 5 Kenyan families each year, benefiting hundreds of people in a major way over your life.

                    1. 3

                      I would hazard a guess that the issue with PL is that the traits that get a language adopted have very little to do with the language’s support for scalable, robust software.

                      Of course, it’s also worth mentioning that, at scale, language fundamentals are only a small part of what makes great vs. terrible software. If you use Haskell but do Agile bullshit (e.g. user stories) and hire commodity engineers, you’ll make shitty software. If you use Python or C++ (which aren’t great languages, but adequate) but hire excellent engineers, you’ll probably be fine. Community is a bigger factor than language fundamentals, and language fundamentals largely matter for the community they draw. However, in general, the reason people like me stand up for excellent but unpopular languages rather than adequate, popular ones is because these second-order effects matter. Great software can be written in any language, but there are very few languages in which even adequate software is the norm. Of course, most of the factors producing garbage software aren’t language-level issues…

                      For example, I’d bet that the reason Python took off in the mid-2000s was… literals for the map (dictionary) type. No, I’m not kidding. It’s not a very deep language-theoretic concern, but it’s something that a real-world programmer feels every day. In 2016, virtually every language has some approximation of this. Even C++ will let you pass curly-brace lists after C++11. But there was a time when very few languages had this “batteries included” attitude toward ease-of-use on something perceived as so simple. (You could argue that maps aren’t simple, due to differences between sorted tree vs. hash maps and the various issues around hashing, but I’m talking about perception.) Python had a great UX at a certain time, and that’s why it won even in domains to which it’s not supremely suited, such as data science.

                      In terms of PL, I don’t know that we’re “getting it wrong”. There’s nothing wrong with Python. Plenty of good work has been done in it. The quality of the programmers will always matter more than the traits of the language. Sure, I’d rather have static typing than not have it, but I’ve seen plenty of wrongness in software and I don’t consider dynamic typing intrinsically wrong.

                      1. 1

                        Great software can be written in any language, but there are very few languages in which even adequate software is the norm.

                        In your view, what are the languages that have the norm of adequate (or better) software?

                        1. 1

                          Haskell and Ocaml come to mind at the top of that list, and that could have more to do with their having a small community than with language fundamentals. Clojure is strong.

                        2. 1

                          Perl would like to have a discussion with you about literals. :-) IMO Perl has far better ergonomics than Python, barring exceptions.

                        1. 3

                          Learning Scheme and trying to get stuff done with scsh. If I like it, I plan on extending scsh to allow easy (easier?) interop with Bash.

                          1. 2

                            There was some recent discussion on the Racket mailing list about shells written in Racket. scsh was written a long time ago, isn’t really actively maintained, and people were looking at ways in which to leverage the Racket ecosystem. Would love this to happen, but also curious about your upcoming experiences with scsh, as well!

                            1. 1

                              This is very interesting. I occasionally try to make a go of a non-traditional language for writing shell-type programs, and I’ve looked at scsh in the past, but never made it my go-to. Keep us posted!