Remember the "One Laptop Per Child" project, that developed a low-cost computer for children in developing countries? I was always amazed by a certain feature: The "View Source" button.

When you pressed it, the source code for the currently running application would open. This was supposed to encourage tinkering with the software on your device! <3

I've been pondering what it would take to build that button on modern machines. Has anyone seen something like that?

(Prototype in next toot.)

You'd roughly need to:

- Figure out which program is currently focused
- Figure out the Git repo of this software
- Clone it into a temporary directory
- Set up the required tools to start hacking on it and compile it

As a quick prototype, I wrote a li'l Bash script that does some of these things. It makes heavy use of #nix and #nixpkgs:

https://codeberg.org/blinry/view-source-button

I enters a "dev shell" with the required tools already in the PATH, and even sets up a Git remote to start contributing. :D

view-source-button

A script that allows you to start tinkering with software

Codeberg.org

So if you've been wondering why I'm into obscure bugs this week like:

- Figuring out why I'm missing icons in pavucontrol https://chaos.social/@blinry/116081436255395069

- Improving the man page of a Nix CLI helper https://github.com/nix-community/nh/pull/568

- Reporting broken shortcuts in the Firefox DevTools https://bugzilla.mozilla.org/show_bug.cgi?id=2017113

… it was testcases for tying out this "View Source Button". :P

blinry (@[email protected])

Attached: 1 image Hmm, is anyone else missing this icon in pavucontrol? (On more "bare-bones" window managers, maybe?) I'm trying to figure which piece I'd need to fix here. I'm on #NixOS, but that doesn't seem to be the only reason. :D This seems to be the "emblem-default" icon https://gitlab.freedesktop.org/pulseaudio/pavucontrol/-/blob/master/src/devicewidget.ui?ref_type=heads#L80 which Nix' adwaita-icon-theme doesn't seem to have anymore… The nixpkgs derivation is here: https://github.com/NixOS/nixpkgs/blob/master/pkgs/by-name/pa/pavucontrol/package.nix #gnome #gtk

chaos.social

It's been fun, it feels like a new superpower to "quickly fix something and send a PR". It's also a super dangerous rabbit hole generator, because now that it's easy to fix stuff, it's very tempting to do so… 🐇

My prototype has some rough edges:

It clones the latest commit, which doesn't always compile using the #nixpkgs setup (but it seems reasonable to check whether the bug is still there).

And invoking the phases of the nixpkgs stdenv manually can be tricky. https://nixos.org/manual/nixpkgs/stable/#sec-building-stdenv-package-in-nix-shell

Nixpkgs Reference Manual

For myself, ideally, the script would set up a #Nix flake with all dependencies in it, and activate it using direnv. Which would probably mean transforming the nixpkgs package into a flake?

The script could also give you some aliases to run the nixpkgs phases like configure, patch, or build, from your current shell – I like using the fish shell, but the stdenv assumes bash. I haven't found a reasonable way to invoke the phases "in a subshell"… Getting errors like this: https://github.com/NixOS/nix/issues/15282

nix develop <installable> --unpack fails with "read-only" error · Issue #15282 · NixOS/nix

Describe the bug I'm trying to run the build phases separately (for hacking on some software using the dev dependencies from nixpkgs), but I'm getting a "read-only" error when running nix develop <...

GitHub
@blinry this looks extremely useful / promising!
@blinry in the Old Days, one could attach a debugger to any running process, and step through it … if the debug symbols were where the debugger could find them, you would step though the source, if not, the machine code … I gather GDB and LLDB can do similar today, tho maybe only in text mode; I’d think a distro could package everything with debug symbols and make some of that much more accessible, even adding a version-specific repo link to the debug info
@ShadSterling @blinry With debuginfod it's not even necessary to install the debug symbols anymore on most major Linux distributions, gdb or whatever program needs them can just download them on demand. At least Fedora also automatically downloads the matching source file. See https://sourceware.org/elfutils/Debuginfod.html
elfutils debuginfod services

elfutils, libraries and tools for ELF files and DWARF data.

@blinry Everything in me currently screams "Smalltalk" ;-)
@dwardoric @blinry I was thinking Lisp Machines, but, nevertheless, very cool project! :3

@korenchkin @dwardoric @blinry I mean, this is already pretty easy today if you use Emacs for everything =) C-h k gives you hyperlinks straight to the source of any command bound to a keystroke

the main problem is that sometimes your boss makes you use programs that aren't emacs =(

@technomancy @dwardoric @blinry I'm lucky, I can use emacs all day :3
@dwardoric
Yep, that was my immediate thought also. Real-time source and variable viewing and changing. It was neat and I've always been sad it wasn't a standard thing.
@blinry
@eythian @blinry Well from certain viewpoints it is a terrible idea. 😅
But it would be great to have something like this behind a toggle switch. My mind just pictures an old PC with a turbo button and pressing it enables that. 😁
As mentioned in the other reply Lisp would also be a good choice. 😊
@dwardoric
For sure, it doesn't have to be the same, but it was so handy as someone learning at the time being able to see what was happening, and when I broke it I got to keep both parts :)
@blinry
@eythian @blinry Yes definitely awesome. Those glory days of goofing around in this new world of silicon. =)
@dwardoric @blinry which was what the first sugar system was implemented in.

@blinry This is such an awesome idea! When I read your first toot I thought immediately "that'd be near impossible for non-interpetted language programmes" but I love this because you've converted it into essentially a search problem!

Such a clever way to take stuff from "almost impossible" to "super achievable" almost instantly!

@blinry

This seems like just the thing to shave papercuts and rough edges off linux mobile efforts.

@blinry

Or have the entire system built around being interpreted like Python or C#. Maybe C# would even be a better option as it's JIT compiler is better in my eyes. And it integrates better with that XML based GUI definition language Microsoft had.

Edit: WPF XAML was it.

@agowa338 @blinry Wasn't C# simply a MS repackage of MS J++, the MS version of Java, because they were sued by Sun?
Years ago I used to peer inside Java "jars" on XP and Ubuntu.

I found C# far better than VB.net, but both inferior to VB6 for quick GUIs on SQL or simulating keypad and LCD of a microcontroller and prototyping the code.
Then I went back to RF design and mostly abandoned programming apart from JAL on PIC18.
But view source is very niche. You only want the overhead on a Dev's PC.

@raymaccarthy @blinry

don't know. Was before my times.

And btw, there is basically 0 overhead from "view source" in C#, as the JIT will at runtime optimise the code and cache the compiled code until it is invalidated by you changing the source or something. In fact if you're writing powershell and the interpreter hits a loop the first few passes will be interpreted while it is in the background compiling it. And once it is done it'll on-the-fly switch over to the optimised compiled code.

@raymaccarthy @blinry

(PowerShell may be an even better fit than C# for this usage...)

@agowa338 @blinry
But MS is determined to make Windows unusable except as a terminal for Edge.
I've not missed C# IDE or Powershell on Linux since abandoning Windows in 2017.

@raymaccarthy @blinry

Good that the Powershell and dotNET teams already kinda split and opensourced themselves to avoid that :P

@raymaccarthy @blinry

Oh and if you've done anything with REST-APIs or transforming file formats (aka mapping objects and such) then PowerShell is definitely killing it.

That's where it shines and even outperforms python in my eyes. Everything else it is kinda on-pair with python. Except you actually get working explicit typing (should you want to explicitly type something)

+ interop with unmanaged code is easier.

@agowa338 @raymaccarthy @blinry the open sourcing of dotNET was largely due to the Mono project, an independent reimplementation that started out as a way to run Silverlight (dotNET browser extensions) on Linux, and grew into a company that could compile C# for iOS, which Microsoft bought, and incrementally merged the Mono and dotNET

@ShadSterling @raymaccarthy @blinry

Well not just that. The community also for long asked for it and the development team also eyed with breaking out of the corporate Microsoft release cycle if I recall correctly.

@ShadSterling @agowa338 @blinry
Except I couldn't get Silverlight to run on any browser on Linux. The company I was advising did most of their work online using Silverlight.
Ironically MS was even then depreciating it!

@raymaccarthy @ShadSterling @blinry

Because Silverlight was shit, even when compared with Flash and Java browser plugins. But all three got replaced by HTML5 (and when apple denied them on iOS)

@agowa338 @raymaccarthy @blinry “Moonlight” was the Mono-based substitute for Silverlight; I know I installed it but I don’t remember what if anything it worked for. IIRC Silverlight was an attempt to compete with Flash and … whatever Macromedia’s other flash-like thing was … but all it really did was make an even smaller niche for IE-only sites

@ShadSterling @raymaccarthy @blinry

Netflix probably. I think they used Silverlight as DRM in the early days or something.

@agowa338 @raymaccarthy @blinry yeah, that sounds right. That was definitely something I had problems with
@ShadSterling @agowa338 @raymaccarthy @blinry Silverlight was the Microsoft answer to Adobe Flex, which used the Flash runtime but had a huge open source SDK for so called Rich Internet Applications
@falken @agowa338 @raymaccarthy @blinry I was thinking of Macromedia Shockwave, which I guess was the predecessor to Flash; I don’t really remember Adobe Flex. But yeah, Silverlight was trying to get everyone to use Microsoft tools instead of any of those, and to trap them in IE too

@ShadSterling @[email protected] @raymaccarthy @blinry

Yea, because of that I had a Firefox addon that would allow to have "IE-Tabs". But that was before Firefox went downhill...

@agowa338 @raymaccarthy @blinry Same! I’ve missed that at times, when I have to use chrome-only sites
@ShadSterling @agowa338 @raymaccarthy @blinry Microsoft once brought me fish and chips to try and make me switch sides lol
@agowa338 @raymaccarthy @blinry have they? Got a link?

@simon_brooke @raymaccarthy @blinry

I think they said something like this at one of the powershell converences. But it has been a while. Also I doubt it was monocausal anyhow...

@raymaccarthy @agowa338 @blinry not simply a repackage, it was a redesign from the ground up, trying to improve on the things Java aimed for but didn’t really achieve - and with some success
@ShadSterling @agowa338 @blinry
Yes, J++ was. The C# (2004?) was very much a repackage of J++, but I tried both and stuck with VB6. I had used C++ from 1987.
Later I did some cross platform Java designed to maintain look & feel of what ever theme of XP or Vista used, whichever desktop + theme on Linux and for Mac, though I didn't personally test the Mac. Baffles me how badly Mozilla does; should know better. The Java app talked to a device driver for a PCMCIA based 4G card (not LTE or Wimax).
@raymaccarthy @agowa338 @blinry yeah, J++ was an attempt to EEE Java, especially for “applets” in IE, that got shut down by the court ruling. dotNET and C# were the subsequent attempt to build a better mousetrap, which largely succeeded in terms of capabilities, but failed to replace Java in adoption because it was closed-source and windows-only
@ShadSterling @agowa338 @blinry
And if C# had been crossplatform and more liberally licenced, Android might have used it instead of Java. Then Oracle would not have sued Google.
But Symbian devs were using Mobile Java and Google wanted them.
Sun had the odd idea that Mobile Java was free-sh, Desktop Java was free-ish, but it was forbidden to use the Desktop version on anything else. It never made sense.
@agowa338 @blinry I used to have the dream of a runtime that worked like a dynamic language interpreter, but rather than being specific to one language each call could invoke a different interpreter for whichever language was needed for the method being called. My original goal was to not have to recreate every library in every language, but the more I thought about it the more other potential benefits I saw. Even wrote my undergraduate thesis about how it might be done

@ShadSterling @blinry

Sounds like you'd want to write a JIT compiler for C tbh...

@agowa338 @blinry what a nightmare that would be! Which AOT compiler would you target compatibility with? How would you handle ISA extensions? Allow specifying compiler options? Well, I might want a C interpreter+JIT for new code targeting that system, but for existing code with an established build process, I’d use the existing distributed machine code, so the language module used is minimal (until it gets run on future hardware with an incompatible ISA)

@ShadSterling @blinry

Well it was your idea. I didn't even say it was possible to pull off. Your idea just sounded like JIT compiled C to me...

Also anyone know what magic https://godbolt.org/ is using under the hood? I'd hope they're not actually running each of these compilers on their system each time you put something in there and somehow do it interpreted? Right?

Then something like that may be able to help.

Compiler Explorer

Compiler Explorer is an interactive online compiler which shows the assembly output of compiled C++, Rust, Go (and many more) code.

@agowa338 @blinry I can see how it could sound that way; the mental model I landed on aims to run existing AOT-compiled software unchanged, to maximize compatibility.

godbolt.org gives you a compiler picker and an options field, so each time you put something it actually runs just the compiler you pick - https://xania.org/202506/how-compiler-explorer-works

How Compiler Explorer Works in 2025 — Matt Godbolt’s blog

How we handle 92 million compilations a year without everything catching fire

@ShadSterling @agowa338 @blinry that's one of the very long term goals of my post-scarcity computing project, but it's not one I expect to hit in my lifetime.

"To summarise, again:

Code is data. The internal representation of data is Don't Know, Don't Care. The output format of data is not constrained by the input format; it should suit the use to which it is to be put, the person to whom it is to be displayed...."

/Continued

@ShadSterling @agowa338 @blinry

"Thus if the person to whom my Java code is reflected back is a LISP programmer, it should be reflected back in idiomatic LISP syntax; if a Python programmer, in idiomatic Python syntax. Let us not, for goodness sake, get hung up about syntax; syntax is frosting on the top. What's important is that the programmer editing the code should edit something which is clearly understandable to him or her." -- me, obviously.

https://www.journeyman.cc/blog/posts-output/2006-02-20-postscarcity-software/

Post-scarcity Software

For years we've said that our computers were Turing equivalent, equivalent to Turing's machine U. That they could compute any function which could be computed. They aren't, of course, and they can't, for one very important reason. U had infinite store, and our machines don't. We have always been store-poor. We've been mill-poor, too: our processors have been slow, running at hundreds, then a few thousands, of cycles per second. We haven't been able to afford the cycles to do any sophisticated munging of our data. What we stored — in the most store intensive format we had — was what we got, and what we delivered to our users. It was a compromise, but a compromise forced on us by the inadequacy of our machines.The thing is, we've been programming for sixty years now. When I was learning my trade, I worked with a few people who'd worked on Baby — the Manchester Mark One — and even with two people who remembered Turing personally. They were old then, approaching retirement; great software people with great skills to pass on, the last of the first generation programmers. I'm a second generation programmer, and I'm fifty. Most people in software would reckon me too old now to cut code. The people cutting code in the front line now know the name Turing, of course, because they learned about U in their first year classes; but Turing as a person — as someone with a personality, quirks, foibles — is no more real to them than Christopher Columbus or Noah, and, indeed, much less real than Aragorn of the Dunedain.

The Fool on the Hill

@simon_brooke @ShadSterling @blinry

Sounds like you'll have a lot of fun trying to map the ASTs of the code in addition to making interpreters for all languages that aren't interpreted then...

@simon_brooke @agowa338 @blinry that’s way more ambitious than the runtime I dreamed of; part of the reason for making it one giant FFI is that, even aside from different runtime in-memory type representations, the different semantics and scoping rules make arbitrary translation extremely challenging. Encapsulation seemed to me more tractable. But methods written to be attached to objects of my dream runtime could be easier to manipulate that way
@blinry Might I suggest using `nix eval --raw nixpkgs#$PKG --apply 'pkg: …'` to avoid repeatedly invoking `nix eval`?

@blinry

The python IDE. Basically you'd have to make the entire system in an interpreted language. Whatever that may be.

@agowa338 @blinry DWARF also includes information on where the source file is, so most binaries can also point to where the source code is.

@lanodan @blinry

Not familiar with DWARF, however a JIT language has the added benefit of being able to change it in real time.

Interview with an Emacs Enthusiast [Colorized]

YouTube