1. 1

    and the binaries are tight!

    He’s talking here about no-std. But I wonder, in light of this, why the std-based (i.e. non-embedded) Rust world has a reputation for bloat while the no-std ecosystem apparently does not. Maybe the embedded developers are just aware enough of their constraints that they don’t pile on abstractions?

    1. 2

      Making an analogy to C++, I think maps and vectors are incredibly convenient data structures, but they have 2 issues for embedded: 1) they allocate on the heap (in order to grow) and 2) they bloat your code because you will have vector<T> and map<K,V> for dozens of T, K, V in a given program.

      So if you make a rule of not using heap allocation, then you can’t use standard containers, and a consequence of that may be less code bloat. You have to do everything the “long way” – C-style – which is way more code to write, but compiles to less code.

      I don’t actually have any experience with Rust no_std but I think there are pretty clear parallels… interested in any opinions to the contrary.

      1. 1

        That’s one thing I like about Zig: I can use standard containers without heap allocation. No no_std needed, just pass in an appropriate allocator.

      2. 1

        different targets, no-std has to be slim, with std you can use the NPM approach: everything and the kitchensink, also it’ll work without any problems to do that. And of course a static compiled runtime (that isn’t stripped?) doesn’t help reducing the size.

      1. 23

        Waiting for ““Static Linking Considered Harmful” Considered Harmful” Considered Harmful

        1. 7

          it’s just harmful considerations all the way down

          1. 1

            Allthough if we’re to keep the cadence, the next harmful consideration is due in September 2036 or something.

          2. 2

            I think that would be hilarious!

            1. 2

              Rule of Threes. After ““Static Linking Considered Harmful” Considered Harmful” Considered Harmful, we’ll get tired of the joke. So, still one more to go lol

              1. 1

                We need a British person beyond that point. Because we all know that they have a good feeling for overdoing jokes to the point where they get funny again.

                1. 2

                  But you have to listen very carefully, because they will say it only once.

              2. 2

                Reminds me of a notice I saw that said (translated) all posting except posting about posting forbidden forbidden.

              1. 7

                You can have type level programming without distinguishing between type level programming and value level programming. Dependent types achieves this, by making types and values live in the same namespace.

                1. 1

                  Do you have any favorite examples?

                  1. 6

                    Dependent types make stuff like type families, GADTs and kinds obsolete, which are all special-cased in Haskell today.

                    So since we’re talking about removing code, I it is weird to bring an example. But really just take any arbitrary type family, and that can serve as an example.

                    A function like this has to be written using a type family or GADT in Haskell:

                    the (Bool -> Type) (\x => if x then Float else Int)
                    

                    (this is Idris syntax)

                    1. 2

                      Does that mean Zig has some form of dependent types?

                      fn the(x: bool) type {
                          return if (x) f64 else i64;
                      }
                      
                      pub fn main() void {
                          @import("std").debug.warn("wee " ++ @typeName(the(true)));
                      }
                      
                      1. 4

                        I would say that Zig does have dependent types, but it’s dependent type system is “unsound”, in the sense that a function call can type check in one use case but might fail type checking in another use case, due to how types are only checked after use and monomorphization. It’s arguably better than not having them at all, though, and I think that’s born out in practice.

                        It certainly limits the value of dependent types, though. You can’t reliably use Zig’s type system as a proof assistant in the way that you can use Coq’s, Agda’s, or Idris’s.

                        1. 2
                  1. 4

                    Very beautiful.

                    I wonder what such a clock would be like here in the north, where the day portion of a nychthemeron is very long in the summer and very short in the winter. :)

                    1. 2

                      Nevertheless, the solution I used was to mark the beginning and end of the day at the point where the Sun is closest to the horizon. This makes the solution continuous, in the sense that a person observing the clock while moving north into the Arctic circle at certain times of the year would see the day progress bar advance normally, while the sunset indicator would move toward either 0 or 100 before vanishing altogether.

                      The sunset indicator is moving around, but the progress bar should still take 24 hours to go around.

                    1. 8

                      Why do we need new GUI implementations? From an end user’s standpoint, they result in app UX that’s incompatible with other apps and often missing features like accessibility or platform integration. (Viz: everyone’s complaints about the UX of Electron apps like Slack.) From a developer’s standpoint, a new framework is yet another complex new API to learn, and likely means adding hacks to support platform-specific features.

                      (Obviously if you’re building your own OS you’ll need a new GUI framework. But otherwise, just let me use UIKit or AppKit, kthxbye.)

                      1. 9

                        My understanding is that “cross platform desktop apps” are an unsolved problem. It’s not like we have N equally good alternatives. If you want to deliver a high quality UI-intensive cross platform desktop app which is a core to your business, your choices are:

                        • use QT with either unsafe C++ or dynamically typed Python
                        • build your own UI framework on top of Skia
                        • compromise on high quality and pick electron/Swing/JavaFX/sciter
                        • compromise on cross-platform and use mac stuff on mac, win stuff on win, and ¯\_(ツ)_/¯ on Linux
                        1. 2

                          Flutter basically chose your 2nd option, but then built a generic widget framework on top of it. It has its shortcomings, but it’s certainly an interesting project in this space.

                          1. 1

                            Flutter is another Swing/JavaFX/Electron/Sciter, but with a less popular programming language.

                          2. 1

                            As a developer it’s pretty obvious I should choose #3. As a user, anything other than #4 makes it pretty obvious the developers value my experience significantly less than their time.

                          3. 6

                            It would be nice to have a production-quality choice for a cross-platform GUI besides Electron or maybe Qt.

                            1. 5

                              Both serve to demonstrate that there is no such thing as cross-platform GUI.

                            2. 2

                              I suspect the major reason is a unified cross-platform development experience. I think the mobile space has shown that it’s too costly to maintain separate code based for iOS and Android. React Native has proven that many (most?) apps can be written once and deployed on both.

                              1. 1

                                I don’t agree with that.

                                Providing separate native mobile applications is not a big problem, if done right. It means isolating core business logic to a layer that can be treated almost like a line-by-line translation (we use Kotlin and Swift), and keep UI layer similar where it can be, but embrace platform native solutions where appropriate.

                                I think the allure of react-native is more than just the cross platform part. It’s about NodeJS - it attracts developers from a web/Node background.

                                1. 3

                                  When I worked at a major music streaming company, we wrote cross-platform libraries for the non-UI bits, and built native UIs on top of that.

                                  So most code was shared, but users didn’t have to suffer with non-native UI.

                              2. 2

                                My experience with cross-platform applications makes me think common backend differrent frontends (assuming you can glue them with a common interface; UIKit is radically different from Win32) is the better alternative; but is economically unviable (why spend money twice or thrice when Electron exists and lets you use cheap webdevs?) as well as being poison for devs (why do I need develop the same thing thrice? what about Linux? clearly i could reimplement all this myself) who don’t really “get” platforms or UX.

                                1. 1

                                  Check out the retrospective on the xi-editor project, which tried to use native GUIs and found that they’re overrated for some kinds of applications. This is what led to the Druid project.

                                  1. 6

                                    That’s a pretty… opinionated, I guess? retrospective. I mean:

                                    When doing some performance work on xi, I found to my great disappointment that performance of these so-called “native” UI toolkits was often pretty poor, even for what you’d think of as the relatively simple task of displaying a screenful of text. A large part of the problem is that these toolkits were generally made at a time when software rendering was a reasonable approach to getting pixels on screen. These days, I consider GPU acceleration to be essentially required for good GUI performance.

                                    On the one hand, that sounds plausible.

                                    On the other hand, considering that, between macOS and Windows, we have text editors and IDEs that have hundreds of millions of happy users, which are very efficiently used to write software worth billions of dollars, every day, maybe these “so-called ‘native’ UI toolkits” aren’t that bad. Or, okay, maybe they’re not too good, but one developer’s failed attempt to use them to write an editor up to their standard is probably not enough of a sample to say it’s high time we replaced them with something better.

                                    The author then goes on to discover that their own, high-performance implementation then doesn’t have any of the benefits of native toolkits. Well, yeah, like virtually all engineering problems, this one ends with a trade-off, too. Beating the performance of 30 year-old GUI toolkits with a small toolkit written today is probably not that complicated. But beating the reliability of a 30 year-old toolkit, even without feature parity, is a multi-year project. 30 years of bugfixes is no mean feat.

                                1. 1

                                  If you don’t have the hardware but want to make SNES tunes/sounds, Plogue has a very good software version.

                                  1. 5

                                    TIL that “disable comments” are a noun, not a verb, which does make the headline grammatically correct even though it doesn’t look that it is.

                                    1. 4

                                      A good example of why compound-words are useful. Sometimes I write them with a hyphen in English when I would use a compound in other languages.

                                      1. 2

                                        It verbn’t.

                                        I think it would make more sense if it was enclosed in quotes; that way, it would sound more like a feature to me.

                                      1. 11

                                        Note that the internet uplink remains untouched at 1 Gbit/s

                                        cries in suburban Texan

                                        1. 4

                                          telecom germany wants 55€ for 250 Mbit/s (if its available at all), in another post they said they pay ~50€ for 1Gbit/s T_T

                                          1. 4

                                            I have gigabit cable from vodafone in Germany. I def. get the downstream when I am using an ethernet cable. 500Mbit via Wifi is def. also the norm. Upstream is unfortunaltely only 50Mbit. All in all it costs me 50€/month. I think that is an okay price.

                                            1. 1

                                              Friend of mine was happily switching to 300Mbit unitymedia and then got total outages over days when corona hit..

                                              1. 1

                                                It works well for us because we live on the ground floor and there is some sort fo problem with the cable in the appartements above us. But due to certain people not being on speaking terms in our house for some reason, it is not going to be fixed. Therefore nobody else has cable internet and we don’t share the line. Sometimes human drama is to ones advantage.

                                                That being said, there is the occasional 6 hour outtage at night with vodafone cable too, but I guess that is unavoidable with residential internet.

                                                1. 1

                                                  I’ve got the 100 Mbit from t-com but without any outage. I really dislike any kind of glitches to my connection.

                                            2. 1

                                              Here they offer 10 Gbit/s for ~40€ but I can’t really justify it. I’m happy with my cheap 200 Mbit.

                                            3. 3

                                              Cheer up; in my part of London, UK, I can’t get more than 8Mb. “First world”, “Global capital”.

                                            1. 2

                                              What happens if you are at the receiving end of this Cellebrite software, and your phone is one of the phones that has these completely unrelated files on it?

                                              Maybe your “interviewer” won’t find it as funny. Maybe it’s still better than the alternative? If they’re actually doing it, that is.

                                              1. 5

                                                If you are being “interviewed” by a government that does not have guarantees around civil rights and rule of law, a cheeky exploit likely won’t matter: the presence of Signal may be enough to convict you in the eyes of the state, let alone anything else found on your phone.

                                                If the state does respect rights and rules of law, I think the presence of an exploit targeting forensic gathering tools that you didn’t install yourself could arguably introduce enough doubt to the process to exclude anything identified in the search.

                                                1. 4

                                                  If the state does respect rights and rules of law

                                                  Show me a state whose spooks and counterterrorism apparatus respect rights and rules of law and I’ll show you a bridge you can buy for 5 bucks.

                                                  1. 3

                                                    Some governments have been known to torture and imprison people on the basis of owning a Casio watch: https://www.theguardian.com/world/2011/apr/25/guantanamo-files-casio-wristwatch-alqaida

                                                    Having Signal or WhatsApp on your phone is sure to be excuse enough if the government you’re dealing with doesn’t guarantee civil rights or the rule of law

                                                  2. 3

                                                    Your interviewer won’t find it, that’s the point. Your interviewer’s software will parse the file, and the file triggers a remote code execution. But why would that remote code execution be displayed to the interviewer as user?

                                                    But as it happens, I sort of know someone who works with this. His employer will be angry at Cellebrite, and will the contract will soon say “all CVEs must be applied, or else they pay damages”. Moxie will not have overlooked this aspect.

                                                    1. 3

                                                      Not knowing more than what’s presented in the article, I imagined for example that the interviewer could have old reports open, or visible in a file browser, and then the exploit would modify them all. That could be one way to notice that something just happened.

                                                      Like when I change some file from underneath my text editor, and it goes “the file changed on disk, what do you want to do?”

                                                      1. 2

                                                        A common fallacy of general computing.

                                                        When you can program a computer to do anything, that includes any imaginable bad things. Just choose a meaning of “bad”, and general computing includes at an instance of that. The fallacy is to transfer the badness to general computing, or the developer who can choose freely what code to write and run.

                                                        A program such as Signal can run any code on a Cellebrite computer, including code which is bad for the Signal user. That doesn’t make Signal bad, or imply that the Signal developers would act against their user’s interest, or even that they might. Just that they could.

                                                        1. 1

                                                          Modifying past and future reports is not something I came up with. It’s right there in the article.

                                                          1. 1

                                                            Yes, because it’s a good threat.

                                                            Cellebrite has two main customer groups, one of them involves prosecution. That statement tells prosecutors that the report they use aren’t reliable. Those prosecutors need reliability and will tell their Cellebrite salescritters that, so it’s an excellent way to threaten Cellebrite’s Cellebrite’s income.

                                                  1. 7
                                                    fn main() {
                                                        println!("Hello, world!");
                                                    }
                                                    

                                                    It is pure, and innocent, and devoid of things that can fail, which is great.

                                                    Nitpick, but println! can panic.

                                                    1. 6

                                                      Productive Compile Times

                                                      With Bevy you can expect 0.8-3.0 seconds with the “fast compiles” configuration

                                                      That seems much more reasonable than any Rust project I’ve touched. I was curious how that works, and found some info.

                                                      1. 12

                                                        Can we please stop using tabs altogether (the last vestigial remain of MDI) and move towards BeOS’s Stack paradigm in which each window title is “a tab” and you can stack together different windows?

                                                        The stack paradigm is easier for the users: one concept (windows) instead of two similar-but-different concepts (windows and tab-inside-windows).

                                                        A graphical example: https://www.haiku-os.org/docs/userguide/en/images/gui-images/gui-s+t.gif

                                                        1. 7

                                                          Every time I see tabs mentioned, I’m thinking about window management. The window manager is too weak, and therefore the application themselves had to step in and invent their own.

                                                          So basically agreeing :)

                                                          1. 5

                                                            Counterpoint: there are two major kinds of tabs, which the article seems to think about as dynamic and static. I would call them task-windows and multi-rooted trees.

                                                            A task-window is the kind of tab that MDI and browsers use: effectively a complete copy of the application main window, but space-compressed. A perfect window manager might be the best way to handle these, but it would have to be good enough for every application’s needs. I haven’t met a perfect window manager yet, but I haven’t seen them all.

                                                            A multi-rooted tree is most often found in giant config/preference systems, e.g VLC and LibreOffice. It could be represented as a single-rooted tree, but the first level branches are trunk-sized and so independent that a user will often only want to tweak things in one branch. Separating them out into tabs is a pretty reasonable abstraction. It’s not the only way of breaking the tree up, but it maps nicely from category to tab, subcategory to delineated section.

                                                            1. 3

                                                              Another counterpoint is Firefox with a lot of tabs. There are some optimizations that Firefox can do because it has access to domain knowledge. Like not loading all of the tabs on start. It could probably unload tabs as well. In order to do that the window manager needs to expose a richer interface.

                                                          2. 4

                                                            Former BeOS fan here.

                                                            Please no. :-(

                                                            This is all IMHO, but…

                                                            There are at least 2 different & separate usage cases here.

                                                            № 1, I am in some kind of editor or creation app & I want multiple documents open so I can, say, cut-and-paste between them. If so, I probably mainly want source & destination, or main workpiece & overflow. Here, title-bar tabs work.

                                                            № 2, I’m in a web browser, where my normal usage pattern goes: home page → lots of tabs (50+) → back down to a few → back to lots of tabs (and repeat)

                                                            In this instance, tabs at the top no longer work. They shrink to invisibility or unreadability. In this use case, I want them on the side, where I can read lots of lines of text in a column of a fixed width. Hierarchical (as in Tree-Style Tabs) is clever, yes, but I don’t need I already have a hierarchy: a browser window, and inside that, tabs. Those 2 levels are enough; I rarely need more than 2 or 3 browser windows, so I don’t need lots of levels of hierarchy in the tabs and TST is unnecessary overload and conceptual bloat.

                                                            The fact that Chrome can’t do this is why I still use Firefox. Or on machines where I don’t have to fight with Github, Waterfox, which is a fork in which XUL addons still work & I don’t need to lose another line of vertical space to the tab bar. In Waterfox as in pre-Quantum Firefox, I can combine my tabs sidebar with my bookmarks sidebar, and preserve most of those precious vertical pixels.

                                                            We have widescreens now. We have nothing but widescreens now. Vertical space is expensive, horizontal space is cheap. Let’s have window title bars wherever we want. How about on the side, like wm2? https://upload.wikimedia.org/wikipedia/commons/3/3b/Wm2.png

                                                            That worked well. That can mix-and-match with BeOS-style tabs very neatly.

                                                            1. 4

                                                              Microsoft was working on a feature called Sets for Windows 10 that would basically do this. I was very sad to learn that the project was axed though even after making it into an Insiders build :(

                                                              1. 2

                                                                Compare with tabbed application windows in current macOS. In almost any Cocoa app, tabs can be torn off to make their own window, or merged with another window. I’m not as familiar with Be, but the main differences seem to be that tabs still go in a bar under the title and can only be joined when they’re the same kind. I’m curious how stacking windows of different kinds would feel. Maybe a window would become more like a task workspace.

                                                                1. 2

                                                                  I like the idea, and have tried it in Haiku, but in practice it was harder to use for me.

                                                                  Maybe I missed some shortcuts? I was dragging windows to each other manually.

                                                                  Maybe it’s just a matter of getting used to it? I don’t know.

                                                                  1. 3

                                                                    Applications, like web browsers, could create shortcuts for creating a new window as a tab of the current window. I think that would make it near identical in terms of behavior.

                                                                1. 2

                                                                  Looking forward to this and many other things in Gnome 40. :)

                                                                  1. 3

                                                                    I’ve been using Recursive from the article as my UI font for a while.

                                                                    The uniwidth feature makes some things look less janky, for example typing in a URL/search bar, where the matched text is bold. As additional letters match, the other letters all stay in place, and it’s nice.

                                                                    Other things I like about it is that it can be monospaced, which I use for code/as default monospace font, as well as “casual,” which I use as my serif font on the web and elsewhere. So it covers all of my UI needs.

                                                                    1. 7

                                                                      this is remarkable!

                                                                      for the sake of my understanding, what are the other popular options for installing a drop-in c/c++ cross compiler? A long time ago, I used Sourcery Codebench, but I think that was a paid product

                                                                      1. 7

                                                                        Clang is a cross-compiler out of the box, you just need headers and libraries for the target. Assembling a sysroot for a Linux or BSD system is pretty trivial, just copy /usr/{local}/include and /usr/{local}/lib and point clang at it. Just pass a --sysroot={path-to-the-sysroot} and -target {target triple of the target} and you’ve got cross compilation. Of course, if you want any other libraries then you’ll also need to install them. Fortunately, most *NIX packaging systems are just tar or cpio archives, so you can just extract the ones you want in your sysroot.

                                                                        It’s much harder for the Mac. The license for the Apple headers, linker files, and everything else that you need, explicitly prohibit this kind of use. I couldn’t see anything in the Zig documentation that explains how they get around this. Hopefully they’re not just violating Apple’s license agreement…

                                                                        1. 3

                                                                          Zig bundles Darwin’s libc, which is licensed under APSL 2.0 (see: https://opensource.apple.com/source/Libc/Libc-1044.1.2/APPLE_LICENSE.auto.html, for example).

                                                                          APSL 2.0 is both FSF and OSI approved (see https://en.wikipedia.org/wiki/Apple_Public_Source_License), which makes me doubt that this statement is correct:

                                                                          The license for the Apple headers, linker files, and everything else that you need, explicitly prohibit this kind of use.

                                                                          That said, if you have more insight, I’m definitely interested in learning more.

                                                                          1. 1

                                                                            I remember some discussion about these topics on Guix mailing lists, arguing convincingly why Guix/Darwin isn’t feasible for licensing issues. Might have been this: https://lists.nongnu.org/archive/html/guix-devel/2017-10/msg00216.html

                                                                          2. 1

                                                                            The license for the Apple headers, linker files, and everything else that you need, explicitly prohibit this kind of use.

                                                                            Can’t we doubt the legal validity of such prohibition? Copyright often doesn’t apply where it would otherwise prevent interoperability. That’s why we have third party printer cartridges, for instance.

                                                                            1. 2

                                                                              No, interoperability is an affirmative defence against copyright infringement but it’s up to a court to decide whether it applies.

                                                                          3. 4

                                                                            When writing the blog post I googled a bit about cgo specifically and the only seemingly general solution for Go I found was xgo (https://github.com/karalabe/xgo).

                                                                            1. 2

                                                                              This version of xgo does not seem to be maintained anymore, I think most xgo users now use https://github.com/techknowlogick/xgo

                                                                              I use it myself and albeit very the tool is very heavy, it works pretty reliable and does what is advertised.

                                                                              1. 2

                                                                                Thanks for mentioning this @m90. I’ve been maintaining my fork for a while, and just last night automated creating PRs for new versions of golang when detected to reduce time to creation even more.

                                                                            2. 3

                                                                              https://github.com/pololu/nixcrpkgs will let you write nix expressions that will be reproducibly cross-compiled, but you also need to learn nix to use it. The initial setup and the learning curve are a lot more demanding that zig cc and zig c++.

                                                                              1. 3

                                                                                Clang IIRC comes with all triplets (that specify the target, like powerpc-gnu-linux or whatever) enabled OOTB. You can then just specify what triplet you want to build for.

                                                                                1. 2

                                                                                  But it does not include the typical build environment of the target platform. You still need to provide that. Zig seems to bundle a libc for each target.

                                                                                  1. 2

                                                                                    I have to wonder how viable this will be when your targets become more broad than Windows/Linux/Mac…

                                                                                    1. 6

                                                                                      I think the tier system provides some answers.

                                                                                      1. 3

                                                                                        One of the points there is that libc is available when cross-compiling.

                                                                                        On *NIX platforms, there are a bunch of things that are statically linked into every executable that provide the things that you need for things like getting to main. These used to be problematic for anything other than GCC to use because the GCC exemption to GPLv2 only allowed you to ignore the GPL if the thing that inserted them into your program was GCC. In GCC 4.3 and later, the GPLv3 exemption extended this to any ‘eligible compilation process’, which allows them to be used by other compilers / linkers. I believe most *BSD systems now use code from NetBSD (which rewrote a lot of the CSU stuff) and LLVM’s compiler-rt. All of these are permissively licensed.

                                                                                        If you’re dynamically linking, you don’t actually need the libc binary, you just need something that has the same symbols. Apple’s ld64 supports a text file format here so that Apple doesn’t have to ship all of the .dylib files for every version of macOS and iOS in their SDKs. On ELF platforms, you can do a trick where you strip everything except the dynamic symbol tables from the .so files: the linker will still consume them and produce a binary that works if you put it on a filesystem with the original .so.

                                                                                        As far as I am aware, macOS does not support static linking for libc. They don’t ship a libc.a and their libc.dylib links against libSystem.dylib, which is the public system call interface (and does change between minor revisions, which broke very single Go program, because Go ignored the rules). As I understand correctly, a bunch of the files that you need to link a macOS or iOS program have a license that says that you may only use them on a Mac. This is why the Visual Studio Mac target needs a Mac connected on the network to remotely access and compile on, rather than cross-compiling on a Windows host.

                                                                                        I understand technically how to build a cross-compile C/C++ toolchain: I’ve done it many times before. The thing I struggle with on Zig is how they do so without violating a particularly litigious company’s license terms.

                                                                                        1. 2

                                                                                          This elucidates a lot of my concerns better than I could have. I have a lot of reservations about the static linking mindset people get themselves into with newer languages.

                                                                                          To be specific on the issue you bring up: Most systems that aren’t Linux either heavily discourage static libc or ban it - and their libcs are consistent unlike Linux’s, so there’s not much point in static libc. libc as an import library that links to the real one makes a lot of sense there.

                                                                              1. 1

                                                                                Doing some cleanup and improvements on Rocket, my Gemini browser.

                                                                                Hopefully I can tag a v0.1 soon.

                                                                                1. 6

                                                                                  When I was playing around with Rocket, I felt that Rust was an easy way to make a web API/website.

                                                                                  Compared to Django or Rails or similar frameworks, it seemed to me like there was significantly less to worry about.

                                                                                  But I haven’t built anything serious with it, so maybe I would change my mind if I did.

                                                                                  Rust is not my favourite language (that would be Zig) but I would use it if I had to build a web app.

                                                                                  1. 2

                                                                                    I think the article makes some good points on why writing APIs might be easy, but proper websites / web applications not so much if you factor in things like form validation or CSRF tokens. And where there might be middlewares for that they are not standardized across web frameworks or toolkits.

                                                                                    1. 1

                                                                                      I’ve used Rocket in some internal tooling in my company. I’ve liked the API; but the requirement of using nightly Rust compiler build is a real dealbreaker, regularly I had to spend time fighting with the compiler in order to compile the library. Even if it finally compiled, few months later and few rustup’s later, it broke again.

                                                                                      I’ve switched to Actix, which requires a stable compiler version.

                                                                                      1. 1

                                                                                        I had an argument with a person that said: the rust compiler changes too much, they need to update their code constantly.

                                                                                        I was really surprised because my experience was had the opposite with very rare exceptions.

                                                                                        They failed to mention that they used the nightly compiler. When we discovered that this was the cause for our different experiences, they basically said that in their opinion, you had to use the nightly compiler to use anything in their niche (ML).

                                                                                        I wonder for how many people this seems to be the case and if popular libraries like rocket which depend on nightly, support this.

                                                                                        1. 1

                                                                                          Yeah.

                                                                                          That’s one reason why I haven’t done anything serious with it.

                                                                                          It should work on stable in the next release it seems.

                                                                                          1. 1

                                                                                            It should work on stable in the next release it seems.

                                                                                            If I’d knew that, I’d leave those tools running on Rocket, dammit! ;)

                                                                                      1. 7

                                                                                        This seems to assume that all of cURL can be reimplemented without the use of unsafe.

                                                                                        Maybe it can, I don’t know, but I know other web-related Rust projects have had memory bugs/CVEs.

                                                                                        1. 4

                                                                                          Since cURL doesn’t have much need to touch raw memory or external API’s beyond what the standard library provides, I think it’s safe to assume that it shouldn’t need to use unsafe. Any time that it does would be for a performance tradeoff.

                                                                                          1. 1

                                                                                            I would imagine that it could. Rust without unsafe is pretty limited, in that the only data structure that it supports is a tree, but that is pretty much all that you need for most parsers and most of the dangerous code (i.e. the code that interacts with untrusted data) in cURL is parsing protocol messages.

                                                                                            1. 3

                                                                                              …the only data structure that it supports is a tree…

                                                                                              Technically true, if you consider records, sequences and such to be special cases of trees, but not terribly useful. You can make anything out of a tree after all. More precise to say that safe rust only supports non-cyclic data structures.

                                                                                              1. 1

                                                                                                No, safe rust doesn’t support arbitrary DAGs. An arbitrary DAG allows shapes where one node has two pointers to it from places higher up. This requires aliasing, which requires unsafe in Rust. The most common way of doing this in Rust is via the RC crate, which can be implemented in Rust only with unsafe code.

                                                                                          1. 49

                                                                                            Good lord, how is it elegant to need to turn your code inside-out to accomplish the basic error handling available in pretty much every other comparable language from the last two decades? So much of Go is well-marketed Stockholm Syndrome.

                                                                                            1. 16

                                                                                              I don’t think that responding with a 404 if there are no rows in the database is that any language supports out of the box. Some frameworks do, and they all have code similar to this for it.

                                                                                              1. 3

                                                                                                And sadly so often error handling is often done in a poor manner in the name of abstraction, though really bad one that effectively boils down to ignore that things can go wrong, meaning that one ends up digging through many layers when they actually do go wrong.

                                                                                                People eventually give up and copy paste StackOverflow[1] solutions in the hopes that one of them will work, even when the fix is more accidental and doesn’t fix the root cause.

                                                                                                The pinnacle was once checking code that supposedly could not fail. The reason was that every statement was wrapped in a try with an empty catch.

                                                                                                But back to the topic. Out of the box is all good and nice until you want to do something different which in my experience happens more often than one would think. People sometimes create workarounds. In the example of non existing rows, for example doing a count before fetch, so doing two queries instead of one, just to avoid cases where a no rows error would otherwise be thrown.

                                                                                                Now i am certainly not against (good) abstractions or automation, but seeing people fighting against those in many instances makes me prefer systems where they can be easily be added and can easily be reasoned about, like in this example.

                                                                                                [1] Nothing against StackOverflow, just blindly copy pasting things, one doesn’t even bother to understand.

                                                                                              2. 10

                                                                                                In what way is Go’s error handling turning my code inside out?

                                                                                                1. 6

                                                                                                  Pike has set PLT back at least a decade or two.

                                                                                                  1. 7

                                                                                                    It is possible to improve the state of the art while also having a language like Go that is practical, compiles unusually fast and is designed specifically to solve what Google found problematic with their larger C++ projects.

                                                                                                    1. 8

                                                                                                      compiles unusually fast

                                                                                                      There is nothing unusual about it. It’s only C++ and Rust that are slow to compile. Pascal, OCaml, Zig and the upcoming Jai are decent. It’s not that Go is incredible, it’s that C++ is really terrible in this regard (not a single, but a lot of different language design decisions made it this way).

                                                                                                      1. 3

                                                                                                        For single files, I agree. But outright disallowing unused dependencies, and designing the language so that it can be parsed in a single pass, really helps for larger projects. I agree on Zig and maybe Pascal too, but in my experience, OCaml projects can be slow to compile.

                                                                                                        1. 2

                                                                                                          I’m enjoying tinkering with Zig but I do wonder how compile times will change as people do more and more sophisticated things with comptime.

                                                                                                          1. 2

                                                                                                            My impression from hanging out in #zig is that the stage 1 compiler is known to be slow and inefficient, and is intended as a stepping-stone to the stage 2 compiler, which is shaping up to be a lot faster and more efficient.

                                                                                                            Also there’s the in-place binary patching that would allow for very fast incremental debug builds, if it pans out.

                                                                                                        2. 2

                                                                                                          Don’t forget D.

                                                                                                        3. 1

                                                                                                          My experience with Go is that it’s actually very slow to compile. A whole project clean build might be unusually fast, but it’s not so fast that the build takes an insignificant amount of time; it’s just better than many other languages. An incremental build, however, is slower than in most other languages I use; my C++ and C build/run/modify cycle is usually significantly faster than in Go, because its incremental builds are less precise.

                                                                                                          In Go, incremental builds are on the package level, not the source level. A package is recompiled when either a file in the same package changes, or when a package it depends on changes. This means, most of the time, that even small changes require recompiling quite a lot of code. Contrast with C, where most of the time I’m working on just a single source file, where a recompile means compiling a single file and re-linking.

                                                                                                          C’s compilation model is pretty bad and often results in unnecessary work, especially as it’s used in C++, but it means that you can just work on an implementation by just recompiling a single file every build.

                                                                                                          1. 1

                                                                                                            I have not encountered many packages that take more than one second to compile. And the Go compiler typically parallelizes compilation at the package level, further improving things. I’m curious to see any counter examples, if you have them.

                                                                                                        4. 4

                                                                                                          I don’t remember anyone in POPL publishing a PLT ordering, partial or total. Could you show me according to what PLT has been set back a decade?

                                                                                                        5. -2

                                                                                                          Srsly, I was looking for simpler, and was disappointed by the false promise.

                                                                                                        1. 2

                                                                                                          Wow, I love this.

                                                                                                          I wish I could make a game with it.