1. 3

    Obligatory: https://www.bay12games.com/dwarves/mantisbt/view.php?id=9195 There was a DF bug where cats were just dying randomly, a fun emergent system bug too

    1. 1

      There’s a twitter feed that posts some of the amusing bugs too: https://twitter.com/dwarffortbugs

    1. 3

      What’s funny is that this is how a lot of old C projects used to work, they would use a Common Lisp program that would generate C code in the manner mentioned here. IIRC Chip Morningstar used to do this when he worked at LucasArts developing video games.

      1. 1

        The metalang99 readme actually rejects code generators:

        The main reason is that native macros allow you to interleave macro invocations with ordinary code. Code generators, on the other hand, force you to either “program in comments” or in DSL-specific files. Can you imagine using Datatype99 in this way? You would have to put nearly all code manipulating sum types into separate files or feeding all your sources to a code generator, thus losing IDE support and development convenience.

        1. 1

          And that’s exactly why I think C++‘s template metaprogramming is something truly special. The template sublanguage is pretty much a convoluted untyped lambda calculus and it lets you syntactically generate code that gets type checked after full instantiation. Still, the host language (the template sublanguage) and the object language (the remaining C-like language, forget about OOP) are very tightly integrated. You can call templated functions in the middle of non-templated functions, and the template arguments get deduced based on the surrounding typing context resulting in code generation followed by type-checking and other template instantiations if necessary, and then there’s also constexpr that allows you to run object-language code while evaluating the host language! This interleaving of type-checking/deduction/interpretation and code generation is not possible with external programs generating C code. And you get all of this with full IDE support.

          Don’t get me wrong, with all of the above said, C++ has so many rough edges and historical accidents that I’ve long chosen to move on to Haskell, but my heart is still itching for a modern language with all the modern tooling that has an untyped host language - simply typed, non-garbage collected/no runtime object language interplay like C++. I’ve had my eyes on terralang for a few years now, but it seems a little experimental (and I don’t have the time to become a contributor and fix issues as I encounter them 😔)

          1. 1

            There are two big problems with C++ templates:

            First, the type language and the expression language are completely distinct. I can write a == b but I can’t write decltype(a) == decltype(b), I have to instead write std::is_same_v<decltype(a), decltype(b)>. This makes anything that needs to move between the expression and type languages very clunky. This is slowly being improved, with things like constexpr / constinit and the reflection TS that let you stay in the expression language for much longer.

            The second problem is that (until concepts) it lacked any concept of a metatype. All types that you manipulate in the type language are instances of the type typename. This meant that your only option for type checking was at instantiation. You can’t write a template and type check it. This is largely addressed by concepts, except that concept syntax makes template syntax look pleasant in comparison.

            The C++ code that I write makes very heavy use of templates but it always makes me long for a cleaner language.

      1. 1
        # Implement the self-to-self case
        eff(atk::Flying, def::Flying) = NOT_VERY_EFFECTIVE
        

        Isn’t this line unnecessary due to the following?

        eff(atk::T, def::T) where {T <: PokéType} = NOT_VERY_EFFECTIVE
        
        1. 2

          Ah! good catch. It’s actually a typo. Flying cannot attack flying according to the type chart.

        1. 5

          It looks like Julia never added explicit interfaces. That’s a bummer. I know there was some discussion years ago, but I moved off of projects where it made sense as a language choice, so I lost track. I always felt that making interfaces explicit would help with documentation (at a minimum) since, at least at the time, it was common to see an informal interface referred to in documentation, but never fully documented itself. This made it trial-and-error to implement.

          1. 6

            With dynamic dispatch/typing, you really don’t need an explicit language construct for interfaces. In a language like Java, it’s completely dependent on the user to define that relationship. When you have a function like push!(collection::AbstractArray, item::T) your “inferface” is a loose contract. That being said, libraries like Traits.jl / WhereTraits.jl implement a macro to assist in any strict interfaces.

            1. 5

              Yeah, I understand they’re not necessary, but I prefer them because they force a kind of documentation. Otherwise there’s no way for me to know that a particular type implements an interface without inspecting all its method implementations.

              1. 2

                Absolutely, in an ideal world you’re within slapping distance of people who don’t document their code. :)

          1. 3

            Thanks for the post, I was looking forward to it since you announced it yesterday. A minor note: the last paragraph/sentence it missing a word.

            I’m still trying to somehow use Julia but find myself resorting to python anyways due to the availability of libraries, unfortunately.

            1. 1

              Fixed! Thanks, I’ll fix that in a bit! I just use Julia for personal projects, and honestly if I can’t find a library for what I want to do, I’ll usually write that functionality from scratch as a bit of an exercise.

            1. 2

              Minor typo. You have eff(atk::Electric, def::Grass) = NO_EFFECT. You should have eff(atk::Electric, def::Ground) = NO_EFFECT.

              Overall, good article. I am trying to use Julia more and more (instead of python) since it seems to me to be an extremely versatile language, and with good support for mathematics.

              1. 1

                Fixed! oops! thanks for catching that!

              1. 17

                Your site looks beautiful :-)

                1. 6

                  I totally agree. Everything is so crisp. The pokemon type tags were exactly right.

                  1. 7

                    Thanks! I did the CSS myself (it was very painful). I did the diagrams in Adobe Illustrator

                1. 4

                  Putting the finishing touches on an explainer article about Multiple Dispatch in Julia. Unfortunately, there’s not a lot of good entry-level explainers out there, so I’m using Pokemon’s type system (Fire, Water, Normal, etc). It’s a familiar example, and maps well to the abstract idea of type system interactions.

                  1. 1

                    Python really just needs to support dynamic typing at this point. Duck typing and the corresponding ecosystem that’s emerged just to do basic type system work is kind of a circus.

                    1. 4

                      Don’t you mean “static typing”? Python is a strongly typed, but dynamically typed language.

                      Anyway, Python’s never going to have compulsory static typing. Gradual static typing, sure, but it’s never going to be compulsory.

                    1. 2

                      Continuing some work on a nutty Julia to Verilog transpiler. I’m doing it for a friend who has hacked the hell out of Python to get code generation working, but it’s really unergonomic.

                      1. 2

                        I’m tinkering around with an cryptographic offline IOU / Credit system for tracking transactions without a centralized bank. Ideally it would allow people to continue trading resources either off-grid or in the event of a natural disaster

                        1. 1

                          This looks like a beautiful course. I wish I had time to take it.

                          It looks like they’ve committed to computational notebooks. It’s really the only reasonable way to run a class like this. But wow, the first notebook:

                          When running this notebook for the first time, this could take up to 15 minutes. Hang in there!

                          I guess it’s the overhead of setting up the project on Binder first.

                          1. 1

                            The lengthy warmup is kind of a meme within the Julia community. https://discourse.julialang.org/t/roadmap-for-a-faster-time-to-first-plot/22956

                            1. 1

                              Oh yeah - that’s a mega thread. hah. So there is no scripting solution in Julia yet because of the slow startup times, I take it?

                              I used to work at Nextjournal. They have robust Julia support and it was never 15 minutes. It’s pretty clearly a case of Binder allocating resources for the notebook in the background.

                          1. 2

                            Ironically, BTC’s adoption by larger organizations has been to pay for ransomware attacks. Even though only 45% of attacks end up with a payout for the ransomer, organizations have been holding on to BTC just in case

                            https://blog.emsisoft.com/en/33977/is-ransomware-driving-up-the-price-of-bitcoin/

                            1. 1

                              “Only 45%”? I’m surprised it is that high.

                            1. 2

                              I’m working on a minimalist blogging engine. It isn’t a static site generator, because I dislike most of those for reasons I have trouble putting into words. It will be very “web 1.0”, usable from absolutely anything with a browser. It will have an RPC API to make it easy to add frontends. I’ll possibly add support to allow posting and commenting via email.

                              Essentially it will be a tool to “enable Chris to write and publish frictionlessly.” I’ll put the source up somewhere once it’s usable, on the off-chance that someone else wants to use it.

                              Tentatively I’m calling it FWB, for “fight writer’s block” or “frictionlessly write blog”. I like overloaded TLAs and double entendre.

                              1. 1

                                This sounds interesting! I personally use a static site generator to publish my blog (< 1 article a month). I would love to hear your gripes with static hosting, though

                                1. 1

                                  I’m not opposed on principle to static site generators. They’re a great solution for a lot of folks, and they have some real advantages, like being able to host a site on just about anything with a web server.

                                  I’m sure I could get everything I want from a static site generator, but I’d end up writing a bunch of tooling to do it. Some of that tooling is going to cancel out the nice properties of a static site, so I may as well make one monolithic thing that is self-consistent.

                                  Static site generators force me to think about things orthogonal to writing, like “what am I going to call this file, where am I going to put it, etc.” Ideally, I’d like to be able to type “M-x new-post” in emacs and have emacs spawn an empty buffer. Write some stuff, and then hit C-c to post a draft. I don’t have to deal with a “build” step or an upload step.

                                  While I do the vast majority of my writing in emacs, I also want some device independence. When I’ve used static site generators in the past, they’ve tended to tie me to a Unix environment.

                                  Finally, if I wanted to add comments to a static site, I need to either use a third-party service like disqus – extremely unpalatable –, find an existing static comment system, or roll my own.

                                  I’m making a bunch of excuses for NIH.

                              1. 10

                                This is a sort-of brute force way to find Mona Lisa. This paper contains details on how to make any cellular automata differentiable, and it’s what enables works like this

                                I’m planning to implement my own neural automata at some point, since they can produce some very trippy visuals

                                1. 3

                                  Sparse voxel oct-trees? I read Tero Kerras’ white paper ages ago, cool to see it implemented!

                                  1. 6

                                    Fun: Normally I’d be preparing for Advent of Code season, but I’ve been having a lot of fun writing a solver for slime molds. IRL they can solve some pretty complex problems with essentially no coordination, and they make some pretty darn cool patterns while they do it. I spent last week porting my model to GPU and it’s made the exploration process much easier. This week I’m refactoring in hopes of getting multiple “species” to simulate competition between different strategies.

                                    Here’s a model I was playing around with yesterday

                                    1. 1

                                      This sounds super-interesting and I bet heaps of people in here would love to hear more about it.

                                      1. 2

                                        I’m glad to see the interest! I’ll definitely post a full write up when I’m finished. If you’d like to read along at home: I’m following this white paper (among others). https://uwe-repository.worktribe.com/output/980579

                                        1. 1

                                          Count me among them. My family and I were watching the Nova episode on slime mold just a couple of weeks ago and we’ve been talking about it ever since.

                                      1. 1

                                        Get some ham radio equipment, and you can try to boot over short wave radio!

                                        1. 4

                                          Working on implementing an agent-based physarum (slime mold) model in Julia. I’m working hard to polish some simple explanatory animations for the eventual blog write up. It’s honestly super fun to implement emergent systems, also keeps my PL knowledge up to snuff.

                                          Also eating lots of turkey :)

                                          1. 10

                                            Campaigning for Joe Biden because I hate myself

                                            1. 6

                                              I begrudgingly signed up to phone bank for Biden after doing texting and phone campaigns for Bernie during the primaries. Feels bad man

                                              1. 2

                                                May I ask why it feels so bad?

                                                1. 6

                                                  I feel that Joe Biden is a piece of shit.