1. 5

    I love this, and am strongly reminded of Gary Larson’s dog bark translator cartoon. (All the dogs end up yelling “Hey!”)

    1. 12

      This is mad genius Tom7, who’s also done -

      He’s playful and smart and awesome! Dry humor and puns.

      1. 1

        Not to forget learnfun&playful, the NES-playing AI that uses values in memory going up as an objective function: https://youtu.be/Q-WgQcnessA (the Gradius bit is extremely cool)

      1. 4

        This… doesn’t read as optimistic as the subtitle initially makes it sound. I hadn’t known about Scala 3/Dotty, but making all users execute a migration to stay on the supported path sounds like a very great way to make those users contemplate a rewrite.

        1. 7

          I imagine you have no plans for a debugger and breakpoints? In other words, no step on snek?

          1. 4

            Although there is no plan for interactive debugging, there is a small place where sneklang is better than normal python: Coverage.

            In [1]: import sneklang
            In [9]: source = """ 
            ...: a = True 
            ...: b = a or "not truthy" 
            ...: """
            
            In [11]: coverage = sneklang.snek_test_coverage(source)
            
            In [13]: print(sneklang.ascii_format_coverage(coverage, source))
            Missing Str on line: 3 col: 9
            b = a or "not truthy"
            ---------^
            87% coverage
            

            There is something very import demonstrated here.

            In normal python coverage, logical operators are not counted as separate branches. But above, you can see the boolean shortcut is measured, and you are alerted that all possible conditions have not been tested.

            In normal python boolean shortcuts would have to be rewritten to their equivalent if statements to get proper coverage measurement.

          1. 3

            …and surely the author imagines being one of those load-bearing internet people. If I didn’t know better, I’d say I admire ESR’s ability to self-promote into being considered relevant.

            1. 2

              When combined with the Error::downcast* family of methods this can enable safe casting of a type to the wrong type, causing security issues such as out of bounds reads/writes/etc.

              “safe casting” means “in code not using unsafe”, right? The problem is that the cast isn’t actually safe?

              1. 11

                Yes. It’s because the downcast methods on dyn Error rely on type_id to be correct in order to implement safe casting. For example, here is how downcast_ref is implemented (which in turn relies on is, which in turn relies on type_id).

                Normally, type_id is implemented for you automatically. But such default methods can be overridden by the user, which ultimately can lead to UB without invoking unsafe anywhere. Here’s an example: https://play.rust-lang.org/?version=stable&mode=debug&edition=2018&gist=0a7cc24ed6a5ba741aae9fdf5917f2dc

                1. 2

                  If I understand correctly, yes. The key methods in play here are the Any type’s downcast_ref (and the other downcast methods) and the is method - downcast uses is (which in turn uses type_id to check if a cast is possible.

                1. 6

                  I know several tools I use daily that violate at least one of these rules, and they always upset me, every single time:

                  • Slack autocompleting people whose last name happens to contain the string “evan” somewhere, instead of autocompleting the person with the username “evan”
                  • github’s emoji picker popping up whenever I type the final : in a reverse smiley (dismissable only by hitting ESC, which closes e.g. the code review outcome pop-up, or by wild mouse clicking in the input pane; hitting return to insert a newline will pick a random emoji).
                  • the chrome navbar which seems to get less useful the closer my input gets to the result I want.
                  1. 4

                    the chrome navbar which seems to get less useful the closer my input gets to the result I want.

                    iphone safari is really awful with this. I type a few letters, see the exact suggestion I want flash by, but have typed too many letters and now it’s gone. Literally have to use backspace to delete input to get a better match.

                  1. 4

                    Author here - this was a fever dream of mine and now it’s real. I’d be interested if anyone finds this useful, in the meantime I’ll find it somewhat funny (:

                    1. 2

                      It’s a clever way to get around Go’s lack of real data abstraction. Would be interesting to see if this technique could apply to other “generics” problems as well. Like, you could build a generic red-black tree by making the payload be buffer indexes to the real data (as this does). Seems inefficient, but should probably be benchmarked and things.

                      1. 1

                        Your comment about inefficiency is absolutely spot on - in the ring buffer, we use one additional (usually unnecessary) integer to represent the capacity of the buffer’s slice, because there is no good way to link the two. What’s more, o.Ring has no way to validate that the capacity is right, other than by believing the user.

                        So the programmer has to make the trade-off: do they care more about type safety, or about enforced array bounds (:

                        1. 2

                          Ring could accept a mutual interface that has Cap() int64 and Size() int64 since there’s an expectation of array/slice here. This would likely work in other data structures, too, where the structure is providing indices to arrays.

                          Thinking about the RBTree angle… deletes would be a nightmare. Probably have to reserve this for things where it’s OK to delete using tombstones and rebuild the structure entirely to garbage collect.

                          I guess I still feel like there is more to explore with this idea. I wish I had a good problem to solve that needed some sort of “secondary index” that I could write in this model.

                          1. 1

                            Thanks for the suggestion with Cap() - I stumbled over sort.Interface and decided to use its Len() method; that allows people to re-use any sort interfaces they already have lying around.

                            As for other things that this could be useful in - I think linked structures might be difficult. Ring-buffers work really well for this approach because managing the buffer is so incredibly easy (no resizing, you can 100% rely on the accounting data structure). Any other technique that is used in embedded systems should be a really good time to implement, though.

                            One other thing that I find interesting about the “accountant” type approach that o takes: The inspiration for this came from discussions about one workaround for trees in rust’s ownership model, where an easy circumvention strategy is to use integer indexes (that are Copy) to retrieve the actual data elements (https://fullyfaithful.eu/bounds-check-elision-rust/ was the post). Turns out that technique is good for go, also!

                    1. 2

                      That’s pretty cool, I love a good worst-of-class attempt (: But I feel like it’s cheating to keep going once you have produced the correctly-sorted output, and if I’m understanding the explanation right, both solutions do that.

                      1. 5

                        If I understand correctly, it produces all permutations, sorts the permutations lexicographically, and selects the first, which is the most (and therefore fully) sorted one. So it’s not cheating quite in the way you state, because even once it generates the solution, it hasn’t decided it’s the solution.

                        You could, of course, optimize it by checking if each permutation is sorted as it is generated, and returning as soon as one is. This would still be disasterously slow, but not to the same degree. It would be O(n!) worst case, I suppose, unless I’m missing something.

                      1. 2

                        And a thousand beginner C programming tutorials cried out in anguish.

                        1. 61

                          IIUC, this isn’t referring to the default filename of “a.out”, but an ancient Linux executable file format by that name. To put it in perspective, the transition from a.out to ELF was a recent development when I started playing with Linux in 1996.

                          1. 6

                            I believe the 2.1 dev kernel configuration menu way back when said “let’s kill this beast” about a.out support. I was so sure it had been removed already!

                            1. 5

                              Thanks for the clarification!

                          1. 5

                            That’s great, will you also make a data serialization format based on it, like JSON for ecmascript?

                            1. 2

                              That’s actually not a bad idea! I’ll think about it~

                            1. 5

                              Really not cool how casually we’re throwing around white supremacist language these days.

                              1. 2

                                I suspect it’s a nod/reference to the (in)famous subreddit.

                                Doesn’t make it better, but hey that’s hackers for you.

                                1. 1

                                  Until today, I’ve always thought of the term ‘master race’ as a synonim and analogy for: “a heavy competition”, thus being some sort of metaphor, but I’m a non-native english speaker, with no specialization on philology whatsoever, so I hadn’t thought about its use in supremacy ideologies.

                                2. -1

                                  …or islamic supremacy, or hindu supremacy, or black supremacy, or some fictional entity’s supremacy.

                                  Stop using that silly ‘white’ word, it is just as racist as the ‘black’ or ‘yellow’ or any other colour. Stop focusing on race or fenotype or nose size, start looking at people as individuals first, members of a group second - not the other way around.

                                  1. 6

                                    “Master race” as a term is very much in the white supremacist tradition.

                                    Nazism held racial theories based upon a belief in the existence of an Aryan master race that was superior to all other races.

                                    https://en.wikipedia.org/wiki/Nazism#Ideology

                                1. 3

                                  This was a hilarious read & a pretty elegantly camouflaged tutorial to trie data structures and processing them in Haskell. You should make this into a conference talk (:

                                  1. 2

                                    Thank you for the encouraging words! And thanks for the suggestion, I do plan on doing so :)

                                  1. 0

                                    Thanks for the “spam” and “off-topic” downvotes, keep them coming.

                                    1. 2

                                      Interestingly enough, the article is neither spam nor off-topic – it indeed deals with both AI and philosophy. It might not be very good(*), but I believe the standard practice on Lobsters is to simply avoid upvoting posts like that.

                                      Strange are the ways of crustaceans.

                                      For what it’s worth, I do find the lack of apostrophes in the Lobsters title mildly infuriating. :)

                                      (*) - I actually found it quite interesting, but I’m no expert on any of the topics in the article.

                                    1. 9

                                      This has a problem that may not be immediately obvious: As soon as one of your passwords gets breached you have a public hash of your master password in public that can be attacked via brute force. So one brute forced password leads to access to all of your accounts.

                                      Thus unless your master password is extremely secure (impractical to be bruteforced) this whole concept is very risky.

                                      I wouldn’t recommend such a scheme.

                                      1. 4

                                        I think more problematically even, this scheme also prevents users from effectively changing their passwords on websites where databases get breached & passwords exfiltrated.

                                        To change that password, you have to change the “master” password (or, more realistically, have 2 master passwords) and remember that again.

                                        It doesn’t seem very effective for keeping people safe in the real world.

                                        1. 2

                                          Not true, each password has a “version” which I believe does something like tack on a version number to the scrypt input. A more robust way to do it would be to iterate a random salt input, or to use a one-way hash function on a KDF chain (similar to key ratcheting).

                                          1. 3

                                            The user would now have to remember a version for each website then instead, doesn’t sound very practical. Unless you store it but then the premise of this kinda flies out the window.

                                            1. 1

                                              No, the app remembers it. JS localStorage or similar. Not sure how the other version (ios, etc) handle it.

                                              1. 4

                                                Yes, but as mentioned; this throws out the part that the app doesn’t store anything.

                                                1. 2

                                                  Compute secure passwords without storing them [passwords] anywhere

                                                  You still have to store the web sites configuration somewhere (Password length, required character, version, etc).

                                                  1. 3

                                                    I don’t think in that case you win anything significant over storing the password itself. Using a password database, you can also use custom passwords (ie when you import old passwords or are given passwords) and with a strong vault password it should have equivalent security.

                                            2. 1

                                              So I guess you end up tacking a number to the end of your password and get to remember that, per site. I guess that’s not too bad, but I still wouldn’t call it great.

                                          2. 1

                                            One would have to know that such a scheme is being used to begin to attempt attacking it though which is likely never the case for general website passwords.

                                            1. 3

                                              Unless you see every “required” character in the first characters of a password, until they fix that bug (unless I’m wrong that it works like that, I only read it quickly).

                                              Any password solution which get less robust the more popular it is, is a bad one.

                                          1. 6

                                            This is wonderful, I’m blown away.

                                            Even from a roleplaying perspective, this is a hilarious playthrough: they picked a tourist character who started hallucinating (to have easier access to a RNG reroll) - before that, they ran into a bunch of walls, so it’s basically a extremely drugged person in a hawaii shirt stumbling through the dungeon, oneshotting a bunch of monsters and taking the powerful amulet.

                                            1. 2

                                              I’m sure that climate control system had the best music and sound effects of its time.

                                              1. 2

                                                Maybe you could briefly describe your language learning method? I’m always interested to hear that. 🙂

                                                1. 3

                                                  This is a pretty good summary of the method he mentioned: https://tim.blog/2014/07/16/how-to-learn-any-language-in-record-time-and-never-forget-it/.

                                                  I’m kind of skeptical of the importance of using pictures over translations and I also think learning massive amounts of vocabulary is very underrated by seemingly everyone in the language learning world, so I’d disagree on stopping at ~2000 words.

                                                  1. 3

                                                    Yeah, the method I am sticking with recommends cramming about 650 words of vocab (plus whatever you need after that), and then lighting up the grammar portion - forming sentences and stuff, and then practicing with a native speaker. These latter two parts are easy to underestimate in importance, and I found it super tempting to just declare victory once you know 2000 words (but couldn’t yet understand or make myself understood).

                                                    So, yeah, ups and downs (:

                                                1. 3

                                                  Hey the link is broken for me, it directs me to:

                                                  https://boinkor.net/2018/11/memorizing-passwords-with-anki--1password/

                                                  changing it to:

                                                  https://boinkor.net/2018/11/memorizing-passwords-with-anki-1password/

                                                  fixes the issue:)

                                                  1. 2

                                                    Thank you, I’ve removed the spurious ‘-’ from the story URL.

                                                    1. 1

                                                      It’s still there? EDIT: also, a missing ‘a’:

                                                      https://boinkor.net/2018/11/memorizing-passwords-with-anki-1pssword/
                                                      https://boinkor.net/2018/11/memorizing-passwords-with-anki-1password/
                                                      
                                                      1. 2

                                                        Ooof, I messed that up, I guess. I put in a redirect for the two URLs (the one with the extra - and the one with the missing a). Hope that resolves it.

                                                        1. 2

                                                          Thank you, I’ve corrected the story URL again, this time with less PEBCAK.

                                                    1. 1

                                                      I had a good chuckle, thanks for posting this.