Threads for edwardloveall

    1. 15

      The C’s prefix syntax has been used for so long that .* looks weird, but a postfix operator is the right place for a dereference. It chains nicely, and if you squint, it’s consistent with field access syntax that is also a form of dereference.

      1. 11

        The “.” is weird, though — it makes it look like a struct field. Pascal’s postfix “^” operator is clearer.

        (An article explaining pointer dereferencing seems maybe a bit basic for lobste.rs…?)

        1. 6

          Think about it as just “field access, but with a wildcard”

          Instead of .field you do .* which matches all fields, and suddenly it feels more natural than another “special syntax”

          1. 3

            According to this mental model, .? should return arbitrary one field :D

            1. 2

              It should return all fields whose names are one character :)

          2. 2

            I was actually coming here to say that I really appreciate the well-written, intro-level post. I’ve been programming for almost 15 years professionally but I’ve spent all that time in high-level languages and am still really “getting” pointers. Programming is such an enormous field, there’s always something to learn. 🙂

            1. 1

              Do you feel the same way about calling methods with .?

              1. 1

                No, a method is an element of the pointed-to struct, just like a field access. It’s the use of “.” without any field that seems weird to me.

                1. 2

                  Funny, I quite like it. If I ever create a language of my own I’d probably use that.

                  Maybe it is just from being exposed to Go, with it’s “ptr.(type)” and “ptr.(int)” forms for type switch and assertion which make it seem a bit more comfortable.

            2. 6

              Adding to snej’s comment, in Pascal you write p^ to dereference a pointer and r.f to select a field from a record. If you have a pointer to a record, you can write pr^.f. It’s simple, orthogonal and logical.

              The C language made the ergonomic mistake of using a prefix operator to dereference a pointer (*p). To get a field from a struct pointer, this means you write (*rp).f. That sucks so badly that C has a short-form for this: you can write rp->f instead. It’s an over-complicated bad design.

              Zig collapses the C operators . and -> into a single . operator, and replaces C’s one-character prefix pointer-deref operator * with a two-character postfix operator .*. This is a bit more ergonomic than C, but it’s still a bad design, when compared to Pascal.

              1. 4

                Not to defend prefix dereference, but it’s not like you can’t fix C’s mistakes. Rust supports rp.f just fine by auto-dereferencing until it finds the right type and doesn’t need -> or an explicit deref for trivial accesses

                The order of operations issue still exists, but to a much lesser extent.

                1. 3

                  Huh, I wonder if that Pascal design is why the Haskell lens packages uses ^. as an alias for view. As in, record ^. foo . bar . baz = view (foo . bar . baz) record accesses a value nested through several layers of record.

                  1. 3

                    BCPL has two forms of the dereference operator, prefix unary and infix binary. The latter does double duty for structure access and array indexing.

                    C           BCPL
                    *ptr        !ptr
                    ptr->field  ptr!field
                    ptr[n]      ptr!n
                    

                    In pre-K&R C before the type safety of structures was improved, C’s ptr->field was a lot more like BCPL’s ptr!field, but with a nicer way to declare the field offsets and types. But like BCPL, the left hand operand could be anything. For example, in the 6th edition kernel there are expressions (after macro expansion) like 0177560->integ for accessing hardware registers.

                    Late 1960s versions of BCPL had the rather awkward lv and rv operators for taking addresses and indirection; they became @ and ! in the early 1970s. https://www.softwarepreservation.org/projects/BCPL/

                    The lv / rv thing was from Strachey’s idea of lvalues and rvalues. The CPL project seems to have struggled a lot with references, list processing, and record types. The whole effort fell apart before they worked out a solution.

                    Dunno how much users in the USA kept up with revisions to BCPL after Martin Richards returned from Cambridge Massachusetts to Cambridge England.

                  2. 2

                    I like how Nim uses p[] for dereference. It’s like indexing an array, but without an index.

                  3. 6

                    Meta: While I use Marginalia, isn’t this off topic? As I understand, “web” is for web technologies not something on the web. Since tags are mainly for blocking, perhaps that’s less relevant.

                    Nevertheless, I recently discovered https://handwiki.org/ a huge wiki with good articles about technical subjects (explaining/teaching them) and haven’t shared it because I’m not sure how to present it (and the text block isn’t for submission purposes.)

                      1. 4

                        I debated this, too, when posting. Ultimately I figured that the audience here would appreciate it so I posted. Maybe we need a new tag but I’m not sure how to categorize it.

                        1. 2

                          I love the wiki but wow I hate the popup that screams at me and removes my text highlight.

                          1. 1

                            There was a post about handwiki the other day: https://lobste.rs/s/fzjejf/handwiki

                            Edit: I’m not reading “hours ago” and usernames it seems, it was you who posted it two hours after this comment, disregard.

                            1. 1

                              I’m not sure how to present it (and the text block isn’t for submission purposes.)

                              You can seed discussion with your own comment on the story.

                            2. 7

                              The software itself is called Nepenthes, after the carnivorous plant that traps flies, mosquito larvae, bugs, spiders, ants, and such.

                              1. 1

                                Oh, yes, thank you. My mistake entirely for the previously incorrect title

                                1. 5

                                  This might be perfectly fine; 6 connections is a lot, but if someone has multiple tabs open to your site you can hit it, and it is annoying when you do - not only do the SSEs fail to connect on new tabs (or existing tabs fail to reconnect), but the regular page load might too! It acts like the site is down.

                                  (What grinds my gears about this is the 6 connection limit is arbitrary - it doesn’t actually come from the spec, which says: “Clients that use persistent connections SHOULD limit the number of simultaneous connections that they maintain to a given server.” so ok, they put a limit (though important to realize that “SHOULD” is not a requirement; it should be evaluated in the conditions you actually apply it to,), but then it says “A single-user client SHOULD NOT maintain more than 2 connections with any server or proxy.” you can understand that at the time when servers weren’t designed for long lived connections, but now? regardless, where’s the 6 come from? I guess they reevaluated it later - good - but then arbitrarily stopped reevaluating later, alas.)

                                  Anyway, it isn’t really important because is is very easy to workaround: set up a wildcard subdomain to your server and make each connection go to a random one.

                                  My live deployment literally does replace("mydomain.dom", "stream"+Math.floor(Math.random() * 100) + ".mydomain.com") when establishing the EventSource. Took a few minutes to set up (I like wildcard subdomains anyway tbh but even if you don’t, it isn’t hard to set one up), and then the problem just completely disappeared, even with the users who leave tabs open for ages and end up with dozens of them. Been years now.

                                  1. 8

                                    It is not arbitrary limit though: it is one that was found out by testing to be highest amount of connections that can still work without trashing the throughput. Those experiments have been repeated at least for 4G connections (and were actually way too high for 3G).

                                    I found out about those limits and the experiments when I was working on chromium network stack about decade ago (when 4G LTE was still the newest thing around), but it seems to be impossible to find those experiment results anymore.

                                    edit: realized that I didn’t mention what goes wrong with higher connections counts over slower/higher latency links. Unsurprisingly it is TCP and its congestion control. Which is also the reason why QUIC/HTTP3 is not on top of TCP, major goal was to be able to increase the connection count per client.

                                    1. 3

                                      Does this apply to usually-idle connections too? I can understand saturating the physical link with multiple active connections, but one just sitting there idle rarely (if ever) transmitting anything ought not do much to the throughput (and if it does, you can close it at any time too).

                                      I know almost nothing about how 3G/4G stuff actually works though, except that it radios the stuff (and my understanding is that’s why events on phones tend to be sent down a different mechanism, so it can turn off the radio more often to save power… but again i know almost nothing so don’t believe me lol).

                                    2. 3

                                      This is a cool workaround. I’ve always thought that the 6 connection limit kind of was just this arbitrary “fuck SSE” thing but that workaround is reasonable.

                                      1. 3

                                        You can also work around that arbitrary limit by fronting your SSE stream with an additional BroadcastChannel and enough metadata in each SSE for each tab to determine which ones it should care about. It is much more complicated but it is available when you don’t control the infrastructure.

                                    3. 18

                                      My opinion is that SQL should be for computers to write. This would put it firmly in the same category as LLVM IR.

                                      I dunno man. I been exposed to ORMs since Enterprise Java Beans pre-relase (around 1997). Hand writing SQL queries always feels better to me. I think iBATIS (later donated to Apache Foundation), was on to something back in 2002. Write SQL manually, then derive binding types from the queries. Bottom-up instead of top-down.

                                      1. 3

                                        As I gain more and more experience with SQL, I tend to agree with you: the less I want it abstracted away from me. But I don’t think I could have arrived there without an abstraction. Instead of “SQL should be for computers to write” or “hand writing SQL queries always feels better”, the answer—like with most things—probably lies somewhere in the middle.

                                        I am intrigued by your sql -> bindings idea, though and I had not heard of iBATIS.

                                        1. 7

                                          Check out https://sqlc.dev/. I’ve been using this recently and it seems to be the most natural fit. I’ve used plenty of ORMs and I’ve done plenty of “raw” SQL over the years. I love the type safety of the ORM, but I tend to dislike the queries it writes. And I love the flexibility of writing my own queries, but I miss the type safety (and dislike writing the boilerplate that inevitably comes with it). sqlc bridges that nicely.

                                          1. 2

                                            It sounded similar to JOOQ (https://www.jooq.org/ ), so I looked up how do these relate: https://news.ycombinator.com/item?id=41498268

                                            1. 1

                                              Interesting

                                              Does sqlc only work with Go? It seems the same analysis could yield types for a variety of languages.

                                              1. 2

                                                It supports several languages and has a plugin API, so Rust could be supported as well (it’s not currently).

                                          2. 2

                                            You don’t want to write SQL manually.

                                            But what you want is a DSL that is as close to SQL as possible but making use of the typesystem and allowing for typesafe extraction and combination of parts - while taking care of encoding/decoding results.

                                            In the Java world, JOOQ gets pretty close to that. It can look like this:

                                            select(field1, field2).from(table1).leftJoin(table2).on(condition1).where(...)
                                            

                                            This allows to do things like

                                            var dynamicCondition = if(...) conditionA else conditionB
                                            select(...).from(...).where(dynamicCondition)
                                            

                                            And it ensures that you don’t mess up and combine SQL parts that actually cannot work together.

                                            I’m not sure what the general term for this type of library is, but it is definitely not ORM.

                                            1. 1

                                              Just saw this today: this is what I meant what you really want right? (but in typescript)

                                              https://news.ycombinator.com/item?id=42334379

                                            2. 19

                                              For anyone wanting to disable the AI/assistant/telemetry features in Zed, here’s my config snippet:

                                                "features": {
                                                  "inline_completion_provider": "none",
                                                  "copilot": false
                                                },
                                                "assistant": {
                                                  "version": "2",
                                                  "enabled": false
                                                },
                                                "telemetry": {
                                                  "diagnostics": false,
                                                  "metrics": false
                                                }
                                              
                                              1. 7

                                                Perhaps you should enable the metrics so they can ser that you’ve disabled the ai bits?

                                                1. 4

                                                  Thank you. I wish these features were opt-in.

                                                2. 3

                                                  The author’s first point is about GraphQL’s allegedly bigger attack surface. Again this focuses more on completely public GraphQL APIs which are relatively rare

                                                  I don’t think this is right. Offering a public vs private API doesn’t have much effect on the size of the attack surface: you can have a completely undocumented, “private” GraphQL API and you still need to worry about attackers who sniff the traffic to your web/mobile frontend, grab an auth token and start trying to find security bugs that leak another user’s data.

                                                  1. 2

                                                    The referenced first point that this comment was in response to was talking about the attack surface created by allowing arbitrary queries, which the author of this article is saying is only a hard problem if you have a public api. A private API would use persisted queries and then the attack surface is just exactly the same as a hand-crafted REST API.

                                                    The author wasn’t suggesting that private APIs don’t have to be secure.

                                                    1. 2

                                                      I assume he really means not reachable from the public internet. And only allowing persisted (so basically allowlisted) queries or query templates.

                                                      1. 1

                                                        I did exactly this with Medium’s undocumented API for https://scribe.rip (minus trying to find other user’s data)

                                                      2. 6

                                                        This is extremely cool and I am going to be so annoyed when a setup wizard makes me wait through an extra 38s of animation.

                                                        1. 4

                                                          While this was submitted a year ago, it didn’t seem to garner much attention. Given this community’s interest in both networking and text-based tools, I thought it was worth another mention.

                                                          1. 13

                                                            My holy grail is a programming system / game engine where I get all of the following built-in to the environment:

                                                            • Live code updates (ideally, multiple versions of a function can exist at once and have their outputs compared)
                                                            • Time travel (such that I can see a bug, rewind the state of the game to a good state, fix the bug, then continue playing)
                                                            • Coroutines (manually building state machines for scripted logic that needs to take place over multiple frames is pointlessly masochistic IMO)
                                                            • Save games without writing explicit serializers, that are stable in the face of code or asset changes

                                                            Some of these goals conflict with each other in deep, possibly unsolvable ways, but that doesn’t stop me from continuing to turn designs over in my head. I don’t know that it’s doable without building my own programming language and runtime.

                                                            1. 8

                                                              Love2D gives you the first three (rxi has a tiny library for code updates and IIRC there’s a time travel library floating around too), and the fourth point “Save games without writing explicit serializers, that are stable in the face of code or asset changes” is just how you design your schema (I personally would choose something like sqlite3 because it’s touted to be faster than a filesystem, compressable, and also it’s much more malleable than alternative database formats in the given space).

                                                              1. 2

                                                                I’ve gone pretty far with love2d and Fennel, but there are a lot of practical caveats to code reloading, especially if you want to prefer bare functions to OOP - you really need to be consistently calling reloadable functions by indexing into a table, everywhere, for it to work smoothly.

                                                                I’m sure there are time travel libraries for love2d, but I suspect they’re built for mechanical purposes, not development workflow. There’s no way they’d be able to rewind a coroutine, for example, or an unhandled crash. Ideally time travel could work everywhere.

                                                                My savegame ideal is something like, say, Adventure Game Studio, where you don’t really need to think about savegames at all, you just write your game logic, and there’s a generic serializer that can write out the game state. It should at least be possible to express data migrations, though, which I believe AGS falls down at. Explicit schema for all game state isn’t a bad idea - I suspect it may not actually be possible to do this in a principled way without it - but that is in conflict with any game state stored implicitly in coroutines and closures. It would be nice to have some way of bridging that gap.

                                                              2. 8

                                                                This is not the same thing, but it reminded me of the Tomorrow Corporation Tech Demo and I wanted to share.

                                                                1. 4

                                                                  Oh, thanks, I’ll have to watch this!

                                                                  EDIT: Watched it and I’m losing my mind a little, haha! There’s stuff going on here that I’ve barely dared to dream of. Much to chew on.

                                                                2. 4

                                                                  Save games without writing explicit serializers, that are stable in the face of code or asset changes

                                                                  This overlaps with Erlang’s hot-loading mechanism if you squint the right way. In particular, the way that a new Erlang deploy can ship with “upgrade” functions per-module which take version N-1 of the module’s state and return version N.

                                                                  Erlang can do this without a type system because you never have to think about anything but version N and version N-1, but what you’re describing might have to deal with versions 1 thru N, so that might push the limits of what you can do without formalized types.

                                                                  1. 3

                                                                    Yeah, a lot of my thinking about this stuff often ends with me going “actually Erlang pretty much already works like that, doesn’t it?” I think “not handling version N-2” is OK and often necessary (there’s not much you can realistically do with a savegame that’s in the middle of a level that no longer exists), but you’d want a simple, consistent way to revert to a sane valid state when a migration isn’t possible or available. Certainly, from the perspective of building a development workflow with instant iteration, it’s probably almost never going to be worth the effort to write an explicit migration - that’s more necessary for handling the case of releasing a patch without flushing every player’s saves down the toilet, which AGS absolutely will do if you are not very careful.

                                                                    1. 1

                                                                      What you are talking about is very similar to this: https://vimeo.com/906418692 , especially at 10:50

                                                                    2. 5

                                                                      I’ve got a few.

                                                                      The biggest one is creating a “new Arduino”, but with lua using a web-based IDE served straight from the (at least to start) ESP32 so it’s entirely self-contained and has no dependencies to install. I’ve pretty much only got false starts to show for it. I feel like it’s a project that has a ‘activation energy’ that is just a bit too far out of my reach. Part of my problem is that I’m just not satisfied with the existing parts I could build it out if, mostly NodeMCU which was unfortunately made when Node.js was popular and it decided to copy all the callback hell problems instead of just using coroutines.

                                                                      Others (in decreasing order of white-whale-ish-ness):

                                                                      • A ground-up re-implementation of OpenSCAD, but using curves instead of polygons. (That can also be built to WASM w/o emscripten.)
                                                                      • A new router OS in the same vein as VyOS, but with a more flexible/responsive configuration language. (And a build system that doesn’t require root on a specific version of debian.)
                                                                      • A p2p-real-time-synced ‘application database’ for writing applications w/o any server dependency.
                                                                      • A ‘react-native’ but for GTK that lets me write GTK applications in Rust without the impedeance mismatch of the GObject system.

                                                                      In general my biggest problem is that I just don’t have the mental bandwidth for projects like these while working full time (especially, like right now, while repeatedly beating by head against the SNMP RFCs while writing a new SNMP implementation in Rust).

                                                                      Edit: Comparing my response to others, my problem might just be too many projects…. Anyone have tips for getting myself to want to do fewer different things?

                                                                      1. 3

                                                                        a “new Arduino”, but with lua using a web-based IDE served straight from the (at least to start) ESP32 so it’s entirely self-contained and has no dependencies to install.

                                                                        CircuitPython has a workflow pretty similar to what you describe, at least for boards/chipsets with native WiFi and no USB.

                                                                        1. 1

                                                                          For whatever reason me and python have never really gotten along. I really want specifically Lua. Partly because I don’t want a trimmed down version of a fat language like Python, and partly because the most productive I’ve ever been writing device code was back when I was an intern writing POCs in Lua and then translating them to C Lua libraries for an STM32-based project running eLua.

                                                                        2. 3

                                                                          Nah, I got a bunch of others also. I take what I can from them and realize the point is not to finish but to entertain and learn. You’re doing great.

                                                                          1. 2

                                                                            Thanks. Yeah, I logically realize that too about my projects, I just can’t seem to convince myself of that, I dunno, emotionally?

                                                                          2. 2

                                                                            A ‘react-native’ but for GTK that lets me write GTK applications in Rust without the impedeance mismatch of the GObject system.

                                                                            Have you seen https://relm4.org/?

                                                                            1. 1

                                                                              I have. I used the old relm, but haven’t actually done anything with relm4 more than half the tutorial. Thanks for pointing me at it again though, I now see that they have async support (and the examples are using tokio, so it looks like that’s compatible). That was one of my biggest stumbling blocks the last time I tried to do any GTK + Rust stuff. I might have to give it a go again.

                                                                            2. 2

                                                                              A ground-up re-implementation of OpenSCAD, but using curves instead of polygons. (That can also be built to WASM w/o emscripten.)

                                                                              I really like the idea here - OpenSCAD is just such a clean and simple interface, the cheatsheet fits-ish on one page, but it’s really clunky with its curve handling and need for epsilons everywhere. The WASM thing seems more like a nice-to-have than an obvious thing to include in the project though.

                                                                              1. 2

                                                                                I really like the idea here - OpenSCAD is just such a clean and simple interface, the cheatsheet fits-ish on one page, but it’s really clunky with its curve handling and need for epsilons everywhere.

                                                                                Yep, exactly where I’m coming from with wanting this myself.

                                                                                The WASM thing seems more like a nice-to-have than an obvious thing to include in the project though.

                                                                                Mostly, yeah. I just really want to be able to have a fully static site with a ‘customizer’ for the various designs I’ve shared.

                                                                            3. 8

                                                                              For me it’s making topographic maps from height data with smooth height lines. Pretty much every tool out there samples points at some regular interval (e.g. marching squares) so you can see line segments in many cases. I want smooth lines (mathematical curve segments) but my math skills are not good enough. Yet!

                                                                              1. 3

                                                                                Assuming you already have the line segments from some variation of alphashapes or something, I think you could take a subset of the vertices and use polynomial interpolation and just plot out the pixels.

                                                                                I’m sure there’s something wrong with this assumption, I do a lot of geospatial stuff at work (more rasterization based), and there’s always some hitch, but hopefully it’s at least a place to look?

                                                                                1. 1

                                                                                  That sounds interesting. I might be able to help? DM me if you’d like.

                                                                                    1. 4

                                                                                      It’s true. I want smoothness for aesthetic reasons, not accuracy ones

                                                                                    2. 1

                                                                                      If your ultimate output is discrete points, you might be able to use sinc interpolation.

                                                                                      1. 1

                                                                                        I bet you could do an algorithm almost identical to marching squares except:

                                                                                        1. For every square-side that straddles a contour, use linear interpolation to decide “where” the contour crosses the side, instead of using the midpoint of the side.

                                                                                        2. Once you have your connected components, draw them using an appropriate spline (centripetal Catmull-Rom?) instead of piecewise linear. That sounds scary, but in the end it’s just polynomials. You can either sit down with the right book and play around until you get it right — or, most likely, you can farm it off to some library.

                                                                                        1. 4

                                                                                          I sent this directly to edwardloveall, but since there’s discussion I’ll paste it here too. Basically I’m agreeing with hobbified, but with more detail.


                                                                                          I’ve run into a problem with some overlap: taking a description of a ship hull, given as a sequence of coordinates of points along the hull, and producing smooth lines out of them. So I think I know one way you could approach the problem.

                                                                                          The Problem

                                                                                          To make sure we’re on the same page, here’s the problem statement I’m imagining.

                                                                                          As input, you have:

                                                                                          • A coordinate space. X and Y are flat, Z is height.
                                                                                          • A 2d grid of heights. It has a resolution in X and Y, which is how far apart the grid points are. Each grid point gives the elevation at that point.
                                                                                          • A set of desired contour line elevations. E.g. maybe you want a contour line every 20 feet of elevation.

                                                                                          As output, you have:

                                                                                          • Smooth contour lines, at every point the terrain passes through that elevation level.
                                                                                          Proposed Solution

                                                                                          My thought was the same as hobbified:

                                                                                          https://lobste.rs/s/3a4zga/do_you_have_any_programming_white_whales#c_c8q6nl

                                                                                          But in more detail:

                                                                                          Think of your input 2d grid of heights as a bunch of squares. Do linear interpolation along every edge of every square, to determine where contour lines cross that edge. Call each point at which a contour line crosses an edge of a square a crossing point. For example, if a square edge goes from elevation 10ft (at one corner) to elevation 50ft (at the adjacent corner), and you want a contour line at every multiple of 20ft, then there are two crossing points along that edge. There’s a crossing point 1/4 of the way along it for the 20ft contour line, and a crossing point 3/4 of the way along it for the 40ft contour line. Organize the crossing points for every contour line height into lines and loops. For example, perhaps you have 22 crossing points at height 20ft, and 12 of them form a loop, 6 of them form another loop, and 4 of them form a line that goes off the edge of the map. You know that two crossing points are “next to” each other in their line/loop if the edges that they’re on share a point in the 2d grid. To be clear, you don’t have any curves yet, just sequences/loops of crossing points, where each crossing point is on the edge of a square. Draw each contour line as a smooth curve connecting the crossing points! What you need is an algorithm that takes a sequence of points and produces a smooth curve that passes through those points. Fortunately there is a perfect algorithm for this. It has the frightening name “cubic centripetal Catmull-Rom”, but it’s not too bad. It takes four points A, B, C, D, and it makes a smooth curve between B and C. So if you have a loop like (A, B, C, D, E, F, A, B, …) then you invoke it with F, A, B, C to get a curve between A and B, then you invoke it with A, B, C, D to get a curve between B and C … etc … and finally you invoke it with E, F, A, B to get a curve from F to A. On the other hand, if you have a line (A, B, C, D, E, F) with two ends A and F (b.c. your contour line went off the edge of the map), then there’s a question of what to do to get a curve from A to B since there’s no point before A (likewise with F). What you can do for that is invent a new point before A with BeforeA = A - (B - A) and a new point after F with AfterF = F - (E - F) and use those. Alternatively, you can just let your contour lines end near the edge of the map if you can afford to throw away the edges of the data. You might be able to find an existing library that does Catmull-Rom in your language. But also it’s not horrible to implement yourself. I did so here, plus there are multiple sample implementations on Wikipedia:

                                                                                          https://github.com/e-matteson/lapstrake/blob/master/src/catmullrom.rs

                                                                                          Note that most of the examples use 3-d points, whereas you just need 2-d points, since each contour line is (by definition) at a fixed height.

                                                                                          Another Category of Solution?

                                                                                          Another sort of solution I could imagine is an algorithm that interpolates points inside each square, but is smart enough to take into account more than just the four corners of the square. For example, if you have a square like this:

                                                                                              4 ? 4
                                                                                              ? ? ?
                                                                                              4 ? 4
                                                                                          

                                                                                          then there’s only really one sensible interpolation for it, it’s flat:

                                                                                              4 4 4
                                                                                              4 4 4
                                                                                              4 4 4
                                                                                          

                                                                                          However, suppose you looked further afield, and saw the squares around that square:

                                                                                          1 ? 1 ? 1 ? 1
                                                                                          ? ? ? ? ? ? ?
                                                                                          1 ? 4 ? 4 ? 1
                                                                                          ? ? ? ? ? ? ?
                                                                                          1 ? 4 ? 4 ? 1
                                                                                          ? ? ? ? ? ? ?
                                                                                          1 ? 6 ? 6 ? 1
                                                                                          

                                                                                          Then you might interpolate the ?s in the square more like this, since it’s looking more like a hill top:

                                                                                          1 ? 1 ? 1 ? 1
                                                                                          ? ? ? ? ? ? ?
                                                                                          1 ? 4 4 4 ? 1
                                                                                          ? ? 4 5 4 ? ?
                                                                                          1 ? 4 5 4 ? 1
                                                                                          ? ? ? ? ? ? ?
                                                                                          1 ? 6 ? 6 ? 1
                                                                                          

                                                                                          Those exact numbers are pretty arbitrary, but hopefully you get the general idea.

                                                                                          I don’t know of any algorithm that does that though. (Which isn’t to say there isn’t one. I don’t know this space much at all.) When I imagine how this sort of interpolation might work, I imagine it using quadratic or cubic equations, and minimizing curvature differences while fitting the points.

                                                                                          If you were able to interpolate inside the square more accurately like this, then you could turn a 2-d grid of heights into a 2-d grid of heights with higher resolution. And then you could continue to do something simple like marching-squares on the higher-resolution grid, but if the resolution was high enough you wouldn’t see the line segments anymore.

                                                                                          Curious if anyone knows a nice algorithm that does this sort of thing.

                                                                                          1. 5

                                                                                            What you’re describing at the end sounds like bicubic interpolation. It uses a 4x4 neighborhood, as you describe, and it gives an output that’s continuous and has continuous derivatives. It’s a super common utility function in any graphics library, or you can even get a GPU to do it for you.

                                                                                            And yes, I think the idea of upscaling using a smooth algorithm like that before contour-tracing would probably work fine. And it has a nice property: if your goal is to make a pan-and-zoomable map, you just have to take some subset of the source data and upscale it to a number of points that’s about the same as the number of screen pixels, and then all of the line segments should be about 1 pixel in length!

                                                                                      2. 6

                                                                                        I can’t help but be that guy and share this article about the difference between macarons and macaroons: https://www.thespruceeats.com/difference-between-macarons-and-macaroons-435337

                                                                                          1. 2

                                                                                            It should have the letters āēīōū on it.

                                                                                              1. 1

                                                                                                I also definitely think of Macron every time I see either word, and have to spend some non-zero amount of effort remembering the difference.

                                                                                              2. 0

                                                                                                I still get them confused due to the sheer popularity of the former as a pastry being pronounced like the latter. Thanks for the link!

                                                                                                1. 3

                                                                                                  The way I remember it is macaROONs feels reasonable to say with a very strong Texan-American accent, like

                                                                                                  Let’s have some macaroons, y’all!

                                                                                                  And the other one is French.

                                                                                              3. 6

                                                                                                As one of the co-admins of https://hotlinewebring.club/ I support this message and am happy to answer questions about creating/running/moderating a webring.

                                                                                                1. 4

                                                                                                  Great article. Love the interactivity and visuals.

                                                                                                  1. 12

                                                                                                    The one feature I really crave to see on git forges is the ability to create a PR/MR without forking the project locally on that instance (the target instance). It would be nice to not need an account on the target instance at all, but the important need is to create a PR/MR without forking there. It should be simple to do this: someone with an account could just send a .patch file in git format-patch format. I regret that the design chosen makes that feature basically the very last things, after things nobody cares about (follow projects on other instances, big meh).

                                                                                                    Note: the problem with forking a project is that it consumes resources on the server. If you make forking avoidable for graceful interaction, you can let people create accounts with limited rights, and not worry too much about their resource consumption.

                                                                                                    1. 3

                                                                                                      Note: the problem with forking a project is that it consumes resources on the server.

                                                                                                      What resources? Not disk space (at least on GitHub): https://github.blog/2015-09-22-counting-objects/#your-very-own-fork-of-rails

                                                                                                      1. 3

                                                                                                        If you let people fork on your server, you can do copy-on-write optimizations at the time of the fork, but obviously you also need to let them push new content to your server, and basically you are acting like a data-storage service for them. It is then very difficult to distinguish between malicious usage of your storage resources and expected usage. For example, if the original repository has large-ish binary blobs stored in them, reasonable commits pushed to the new fork may contain many new versions of those large binary blobs.

                                                                                                        1. 4

                                                                                                          Oh, I see. So you’re basically worried about abusive users using repos as object storage? So the problem isn’t really forks, it’s allowing repo creation at all (but if you disable that, now suddenly nobody can send MRs because they can’t fork)?

                                                                                                          1. 4

                                                                                                            Yes. This is a concrete problem for me because some instance operators disable repo creation for non-trusted accounts for this reason, breaking the expected interaction patterns for contributions from non-trusted users.

                                                                                                        2. 2

                                                                                                          That’s really interesting to know, thanks. I had assumed for some reason that it was making a deep copy.

                                                                                                          For me then, it’s a small cognitive load to fork. I now have this copy of the project under my account, that maybe receives a commit or two and then is usually abandoned. I can delete it to clean up the clutter, but what if I get on a role and contribute again soon? I refork and do the whole dance again.

                                                                                                          I’d be nice to avoid all that and send a patch.

                                                                                                        3. 1

                                                                                                          This is the big problem. PRs are not part of git but have become integral because of its UX.

                                                                                                          There really isn’t a good solution here: either send patches via email or via “side” proprietary APIs.

                                                                                                          Git appraise looks interesting but outside collaboration is not possible.

                                                                                                          I could see an activity pub implementation of PR be interesting, but you still need an account somewhere just to send a patch.

                                                                                                          1. 1

                                                                                                            It would be awesome to be able to just copy/paste a diff or patch.

                                                                                                            1. 2

                                                                                                              Yes, and a service that would accept such patches (for example the git format-patch format that makes it easy and convenient to send a series of commits with commit messages, etc.) through a standard web API, for example a POST request, could easily be connected with another server/instance that would submit PRs/MRs on their user’s behalf using this mechanism. I work on my favorite gitlab instance, I can use it to “send a MR” to another instance: my instance computes this patch file (trivial), sends the POST request on my behalf (I provided my username on the target instance in a form field), and I get a login screen to authenticate my account on the receiving instance that then creates the MR. This is easy to do with very simple and standard web interaction patterns, open to either manual or automated use.

                                                                                                          2. 4

                                                                                                            I used Tufte CSS on Scribe and I’ve gotten many complements on “my” design.

                                                                                                            1. 36

                                                                                                              It doesn’t matter whether telemetry was added to a product in good faith or not: projects change leadership, corporations are taken over, data sets leak, or people just change their mind. Once I opt in any change in the amount and quality of the data sent to headquarters is likely to be done without my explicit consent.

                                                                                                              I also believe that the gains in quality that are claimed to be achieved based on telemetry data are highly exaggerated for commercial (i.e. ad industry) reasons. Apart from minor ergonomical improvements I can not think of much that is to be achieved by collecting user data, saying this as someone who is maintaining an open source project for 25 years, now.

                                                                                                              1. 11

                                                                                                                Apart from minor ergonomical improvements I can not think of much that is to be achieved by collecting user data

                                                                                                                Here is a list of things that Go team wanted to learn from transparent telemetry they proposed. It seems reasonable to me and hard to get any other way.

                                                                                                                1. 13

                                                                                                                  It’s a reasonable list, but as Bunny351 pointed out, that list and who’s in charge of it can change. It does not exist in isolation or frozen in time.

                                                                                                                  1. 8

                                                                                                                    I’m not arguing for Go telemetry, just pointing out that the telemetry in general can have many use-cases that are even well documented. When you contrast that with someone who claims to have lots of experience and at the same time fails to see any use for such telemetry, it’s hard for me to not see this as a dishonest claim made only to push some hidden agenda. It would be much better for people involved in such discussion to be honest and say what they really think out loud, instead of making such silly claims. You don’t want telemetry in Go because you don’t trust Google or big corps in general? Fine, just say so instead of those silly pseudo technical arguments. 🤷

                                                                                                                    1. 13

                                                                                                                      No need to get personal. I clearly wrote that I think the claimed advantages are exaggerated, and that I do acknowledge minor gains, I also wonder what “hidden agenda” you are talking about. In fact, your strong wording makes me wonder what your agenda is…

                                                                                                                      In my experience I found it more fruitful to directly engage with users and co-developers to gather areas of improvement instead of relying on questionable statistics that might be abused or may even misrepresent real use. Users should not be a resource to be mechanically harvested. If I’m unclear about the usage patterns of the tool I maintain, I can politely ask the userbase and they may or not be interested in telling me about it.

                                                                                                                      No, I don’t trust Google. I do trust certain communities in the moment, that may change in the future the same way as communities, their governors or their policies may change. That is my main point: trust is not something I grant eternally, and tool vendors should acknowledge and accept this.

                                                                                                                      Regarding my honesty: I truly can not remember any situation where adding telemetry to something I maintained would have made a genuine impact, note that I’m talking of my personal experience. There may be minor gains, perhaps, but is it worth requiring the user to pay for these gains with his or her data? I think not.

                                                                                                                      1. 4

                                                                                                                        All I’ve seen of you in all the threads on the Go telemetry has been weird attacks on people rather than on their arguments. You jump down the throat of anyone who you feel hasn’t sufficiently “read the proposal”, you impute dishonest motivations to those who disagree with you, etc.

                                                                                                                        Perhaps you could find a more constructive way to make your points?

                                                                                                                      2. 2

                                                                                                                        It’s worth noting that the GDPR requires both consent to collect data and restricts the use of that data to the things for which consent was given. It’s possible to write a GDPR-compliant privacy policy that lets you use telemetry data for the good (for the user) purposes but which would expose the holder of the data to huge liability if they’re new management tried to use it for anything else.

                                                                                                                      3. 9

                                                                                                                        I’m a bit wary of this because I think it’s quite easy to use lists like the above to win the argument by economy: coming up with the list is a lot more time-efficient than going through it point by point and refuting each thing. But there are some points worth bringing up that apply to most of them.

                                                                                                                        Many people have opposed opt-in, claiming it will bias the results. rsc has also been vocally anti-surveys for similar reasons. But all of these suggestions are susceptible to other sources of bias—they overcount projects which are built often (or invoke other tools often; the same objection applies). I don’t know which projects those are, but I see no reason to just assume that the number of times a thing is compiled correlates with its significance.

                                                                                                                        Also, as other people in the thread have raised, that a thing happens (relatively) rarely doesn’t mean that its presence is unimportant. rsc has framed this as an exercise in answering important quantitative questions, but making the debate about how to answer them would be reasonable only if the quantitative answers were ends in themselves. They’re not—they’re a way of answering qualitative questions about the importance of various things to the community. I don’t think they achieve this.

                                                                                                                        I could go deeper and attack the statistics side of this, but I think it’d be a bit redundant. The data can’t be of high quality, even if it gathered and handled perfectly (which I don’t think it is) because it’s answering the wrong questions.

                                                                                                                        There is yet a wider zoom level through which to view this debate, however. Go as an institution has apparently been built on the premise of not talking to one’s customers. This is typical for Google, but it shouldn’t be typical for FOSS.

                                                                                                                        1. 2

                                                                                                                          That article would be a bit more compelling if Russ put a disclaimer stating “I have not received any pressure from my superiors at Google to collect more data from Go users.”

                                                                                                                        2. 3

                                                                                                                          What’s to prevent a sufficiently evil change in guard to just start collecting that info without really notifying you (or burying it)? Like, this seems like a legitimate concern that isn’t something that can be solved by complaining about telemetry. Just disable it and move on or use something else.

                                                                                                                          1. 1

                                                                                                                            Once I opt in any change in the amount and quality of the data sent to headquarters is likely to be done without my explicit consent.

                                                                                                                            That’s a fair complaint. Assuming we wanted telemetry but wanted to avoid this issue, I see a design that could fix this.

                                                                                                                            Most projects’ SEND_TELEMETRY setting or environment variable is a boolean – DO_NOT_SEND or SEND. In the project that we want to add telemetry to, instead make it an enum: DO_NOT_SEND, SEND_V1, SEND_V2. If the project wants to start collecting new data, it would have to convince users to change their settings to SEND_V2. Whether the project used opt-in or time-delayed opt-out for its initial request to enable telemetry, it would use the same strategy to request the upgraded telemetry.

                                                                                                                            1. 2

                                                                                                                              So long as the initial team stays in control and that enum is never expanded to new telemetry. What about telemetry you thought you were collecting on day 1 and it turns out there was a bug that meant you never sent anything useful? Could you fix that? What about sending the uptime but you realize you also need to know if the copy on disk is newer than your program’s uptime?

                                                                                                                              Much of this relies on the continued single minded determination of the person or entity making the decisions to make them consistently and correctly.

                                                                                                                          2. 8

                                                                                                                            It’s me! The one who uses Panic’s Nova! https://nova.app

                                                                                                                            It’s an absolute underdog — a Mac-only GUI IDE - but I love it and have loved it since it launched at the end of 2020, and it’s been receiving regular and substantial updates since then.

                                                                                                                            • It uses a small amount of memory and energy, zippy, opens big files happily
                                                                                                                            • Has many high-quality extensions, many of which make use of an excellent built-in LSP client.
                                                                                                                            • Thoughtful UI design that feels totally idiomatic to macOS.
                                                                                                                            • A built-in debugger
                                                                                                                            • A git GUI which handles the most common git tasks really well
                                                                                                                            • Built-in preview browser
                                                                                                                            • A licensing model I’m happy with (pay the softawer + a year of updates, use as long as you like)
                                                                                                                            • vim mode

                                                                                                                            And there’s so many tiny great things, like how you can hover over sections of the minimap and see symbols of what you’re hovering over. Details!

                                                                                                                            I work mostly with JS/TS and use the Nova with (my own) Deno extension. Deno’s rust-based toolchain with Nova’s native performance just feels so light and great.

                                                                                                                            1. 2

                                                                                                                              I was going to chime in that I did use Nova for a couple years for embedded (ARM32/64) development, Python scripting, and shell scripting. I have a fairly complex setup where I need to compile inside Docker and then have a variety of scripts for running or debugging in QEMU or hardware. I am a longtime Mac & iOS developer (20+ years) and really appreciate Panic and their apps, but I was just getting random crashes once or twice a week (always reported) but they were killing my productivity when they happened. Combine that with the need to do some STM32 development and debugging and VS Code’s built-in debugger support, I fully switched over to VS Code and in months now haven’t had a single crash. In addition, I find I am able to script the tasks, launchers, and hotkeys that I want faster and more flexibly, and there is a huge variety of debugger support. VS Code also feels faster. It pains me to leave behind a true native app but I have not looked back since VS Code. I feel like the sweet spot for Nova is web and scripting development but when it comes to a lot of native development, it can’t really compete the same was VS Code can.

                                                                                                                              VS Code extensions I particularly like: CodeLLDB, Cortex-Debug, indent-rainbow, PDF Preview, PlatformIO, and Vim (25+ year Vim user as well, depending on task).

                                                                                                                              1. 2

                                                                                                                                Same. I love Nova. It feels like the most “Mac-assed Mac app.” Two other things ill add that I’ve enjoyed-

                                                                                                                                • The diff view. It’s absolutely perfect for comparing current branch/commit vs. older commits / tags
                                                                                                                                • The gitlens-type feature. No extension needed, just flip the setting on

                                                                                                                                I’ve been starting to dabble with Deno and i’m using your extension. Thanks for making it!

                                                                                                                                1. 1

                                                                                                                                  Ohhh yeah the diff view is great! And thanks for trying my extension!

                                                                                                                                2. 2

                                                                                                                                  $100 for a text editor? Is it worth it?

                                                                                                                                  1. 9

                                                                                                                                    For me who makes a web developer’s salary and wants to see investment in tools that are not made with electron, yes!

                                                                                                                                    1. 1

                                                                                                                                      For me definitely. Programming is what I do for a living, and $100 is a small amount to pay for something which makes my work more pleasant every day.

                                                                                                                                      And ahem, it’s an IDE.

                                                                                                                                      1. 1

                                                                                                                                        And ahem, it’s an IDE

                                                                                                                                        I mean even Panic don’t call it an IDE - I think there’s a certain level of functionality that people expect when the term IDE is used.

                                                                                                                                        I haven’t looked at Panic since it was in pre-release days, but I would be very surprised if it had the functionality an IDE like Jetbrains offers.

                                                                                                                                        That doesn’t mean it’s bad necessarily, it just means it’s a different type of tool.

                                                                                                                                        An electric drill can drive screws, but it isn’t the same thing as an impact driver, which is designed to drive screws.

                                                                                                                                        1. 2

                                                                                                                                          If having a debugger, symbol browser, and LSP support doesn’t get you into the IDE club I don’t know what does!

                                                                                                                                          1. 1

                                                                                                                                            Usage detection and refactoring support is the thing that is pretty universally missing from “editors” that people end up calling “IDEs”.

                                                                                                                                            I just downloaded the latest version, opened up a project and it could neither tell me where a symbol was being used, nor gave me any way to intelligently rename or otherwise alter that symbol with automatic changes being applied to the calling locations.

                                                                                                                                            It also doesn’t help IMO that the extension system is apparently based on javascript, but from a quick check, at least some of the extensions then require nodeJS and NPM be installed, for extensions that have no specific ties to JS as a language.

                                                                                                                                            1. 1

                                                                                                                                              I’m not familiar with Jetbrains IDEs. What do they offer beyond what LSP offers? I’ve just recently, over the last couple of years, started using LSP more. I’d be interested to know what I’m still missing compared to a “proper” IDE.

                                                                                                                                              For reference, these are the LSP functions that I most often use:

                                                                                                                                              • Go to definition of symbol
                                                                                                                                              • Find references to symbol
                                                                                                                                              • Go to type definition
                                                                                                                                              • Find implementations
                                                                                                                                              • Rename symbol
                                                                                                                                              • Apply suggested bugfix (usually that’s adding an import)

                                                                                                                                              It’s been a long time since I’ve really used a proper IDE and I don’t think I’ve ever used a Jetbrains one. What else is there?

                                                                                                                                              1. 2

                                                                                                                                                Well if those things you list actually worked in Nova maybe I’d be ok with that, but I couldn’t get it to work any more than a glorified “find substring in project” (more details here: https://lobste.rs/s/nbr9bl/what_s_your_editor_setup#c_s0ewvx)

                                                                                                                                                Jetbrains does support a lot more though:

                                                                                                                                                • change method signature (i.e. add/remove/re-order method arguments) - this also works on interfaces, so implementing classes reflect the same change, as well as calls to the changed method;
                                                                                                                                                • extract variable/constant/class property/method from an expression (including duplicates);
                                                                                                                                                • extract interface from class (i.e. create an interface and replace applicable references to the concrete class, with the interface name);
                                                                                                                                                • inline a variable/method/constant/property;
                                                                                                                                                • move a symbol to a different namespace (including moving an entire namespace);
                                                                                                                                                1. 1

                                                                                                                                                  Sorry, I was hijacking this thread to ask about Jetbrains - I don’t know anything about Nova! Maybe Nova is buggy. For the things I listed, LSP works really well.

                                                                                                                                                  Thank you for the examples of other things that Jetbrains does. You’ve got me interested now: I wonder which IDE functionality is most used? Does Jetbrains collect telemetry? Come to think of it, I wonder which LSP functionality I actually use often. Naïvely, this seems like something that could actually be amenable to empirical study.

                                                                                                                                                  1. 2

                                                                                                                                                    I wonder which IDE functionality is most used

                                                                                                                                                    Yeah I’m not sure really - and it probably depends a lot on the language involved. I would imagine that things like this are much more heavily used, as you go up the scale in terms of how powerful the language’s type system is.

                                                                                                                                                    1. 1

                                                                                                                                                      Yeah, you would think that a powerful static type system would allow more things like this to be automated. I have seen some impressive demonstrations with Idris but most IDE functionality seems to focus on Java-style OO languages rather than anything fancier. Is there anything Jetbrains-like for Haskell?

                                                                                                                                                      1. 1

                                                                                                                                                        I don’t believe there’s any first-party support, but there seems to be at least one third party plugin for it - whether it supports full/any refactoring support or not I don’t really know, Haskell isn’t really in my wheelhouse.

                                                                                                                                              2. 1

                                                                                                                                                I have all of these features, you just haven’t set anything up.

                                                                                                                                                You need to install an extension which supports the type of project you’re opening (e.g. the Rust extension, the TypeScript / Deno extension, Gleam extension, etc.). The extension is responsible for hooking up a LSP with Nova’s built-in LSP client which enables these features.

                                                                                                                                                Because the extension API uses JS, some people build their extensions using the NPM ecosystem. The final extension is run in a non-Node runtime. There’s certainly no requirement to have NodeJS or NPM to be installed for an extension to work, that’s on the extension author.

                                                                                                                                                1. 1

                                                                                                                                                  Ok, so I went back to it, because hey maybe I just missed something. Believe me, I’d love a lighter IDE than Jetbrains. I’d even accept some reduced functionality of esoteric things like vagrant support, or run-on-remote-interpreter support, if necessary.

                                                                                                                                                  The project in question happens to be PHP - a language Nova supports “out of the box”. The only extra extension I found which suggests it adds more functionality “language support” for PHP, is the one I mentioned above, which says, very clearly in its description:

                                                                                                                                                  Intelephense requires some additional tools to be installed on your Mac: Node.js

                                                                                                                                                  Anyway. So I tried with the built in language extension, because hey, it should work right?

                                                                                                                                                  “Go to definition” works.. it’s janky and kind of slow but it works (or so I thought).

                                                                                                                                                  As far as I can tell, thats it.

                                                                                                                                                  I found “Jump to (Previous|Next) Instance” which just highlights the same class name (in a comment as it happens) in the currently open file. Not sure if that’s what it’s supposed to do, but it’s completely unintuitive what this is meant to do, or why I would want that.

                                                                                                                                                  I tried Cmd-Click just by reflex from JetBrains muscle memory - and it shows me results when invoked on methods.. but besides being ridiculously slow, it’s woefully inaccurate. It just seems to show any method call that’s the same method name, regardless of the class it’s invoked on. Further investigation shows that’s actually the same behaviour for “go to Symbol” on methods too.

                                                                                                                                                  I get it - some language extensions will have more functionality than others - but this is a language they list with built in support, and it has a lot of capability to specify types, right in the language. If it can’t infer the correct symbol reference from php8.x typed code, I can’t even begin to imagine what it’s like with a language like Javascript or Python or Ruby.

                                                                                                                                                  Maybe it all works wonderfully if you specify an interpreter path for the project? I don’t know. It doesn’t let me specify a remote interpreter (e.g. in a VM or Container, or an actual remote machine), and I’m not about to go down the rabbit hole of trying to get the same language runtime and extension versions installed on macOS just to test that theory.

                                                                                                                                    2. 22

                                                                                                                                      Well, they brought MagSafe back, and the M1 chips are almost unbelievably good, so current state = good. The worst thing I can say is most all their screens are 60 Hz.

                                                                                                                                      I would recommend the cheapest M2 laptop they offer, and maybe some SD cards (some folks think the storage is small).

                                                                                                                                      1. 6

                                                                                                                                        I think all of the M1/M2 macbooks have ProMotion (120hz) displays

                                                                                                                                        1. 14

                                                                                                                                          The 14” and 16” M1 MacBook Pros have ProMotion displays. The 13” M2 MacBook Pro and the M1/M2 MacBook Air do not.

                                                                                                                                          1. 2

                                                                                                                                            My M1 macbook pro does not have promotion. it’s 60hz, non HDR. still a very good panel though.

                                                                                                                                          2. 4

                                                                                                                                            Totally agreed on everything but the “cheapest” if only because the SSDs were changed from 2 separate chips down to 1 which makes read and write performance noticeably slower.

                                                                                                                                            1. 2

                                                                                                                                              If you go with SD cards be sure to check the speeds as well, since there are still very slow SD cards being sold.