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
@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.
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.
@agowa338 @raymaccarthy @blinry
The reflection features of the .NET runtime are so powerful that theoretically you could generate the source code of anything on the fly, modify, and recompile in no time, with no need to download or install anything.
C# was made to compete with Java when Sun sued MS because of J++, but it was never a repackage of J++ at all. J++ was a Java implementation with some extras in order to make Java developers dependent on MS. .NET (the C# runtime) has a similar architecture as the Java runtime, but it is a totally different and incompatible thing. You can't make anything in C# and compile or run it on a JVM, or in Java and compile or run on .NET. AFAIK, there is not even a compatibility layer between libraries. In fact, if you want a .NET binary but dislike C# and VB.NET, your best option is to write it in Python, since there is a Python compiler for .NET, made by MS.