187 points · by mcp_ · 6y ago · 85 comments
https://en.wikipedia.org/wiki/List_of_JVM_languages
I don't see JVM & CLR even with the dozens of language choices on top of the virtual machine runtimes as giving you ways to do "bare metal" programming. I guess one could arguably squint and say Java's JNI or C# P/Invoke and "unsafe{}" gets you some "bare metal" capabilities but that's a stretch.
I go back to the gp's sentence: "Imagine starting a project in an easy language, then migrating pieces to a faster "bare metal" language as needed in a super piecemeal way."
For example, JVM/Java doesn't have value types[1] (yet) and that's required for programmer's control of exact and efficient memory layout for many bare metal domains. It doesn't matter what flavor of JVM language you use because you're ultimately limited by the JVM's capabilities which causes excessive pointers to pointers which is inappropriate for some high-performance code.
In C#, some future tech like CoreRT might open up some more "bare metal" programming possibilities but that's not production yet[2]. I remember you couldn't even develop a Windows Explorer right-click menu shell extensions in C# because it was a bad idea to load up 2 different versions of the NET Framework runtimes (until NET 4.0). That's not even that low a level of programming and yet C++ had no such limitation.
I use C# as much as I can but I still have to do 50% my projects in C++ because JVM/CLR are not "bare metal" enough.
[1] https://en.wikipedia.org/wiki/Criticism_of_Java#Compound_val...
[2] https://github.com/dotnet/corert#user-content-net-core-runti...
Apparently you missed the Windows 8, 8.1 and 10 train regarding your "bare metal" compilation from C# and VB.NET code.
.NET 4.0 was released in 2008 and I have been able to use C++ as .NET language since 2001, so ....
In fact one of my first .NET projects, in 2002, was to integrate C++ RPC library into Managed C++, long replaced replaced by C++/CLI with .NET 2.0 release.
Going back to Java, IBM, Aicas, PTC, Gemalto will happily sell you Java compilers that generate AOT native code for embedded deployment targets, not to mention what is running on my phone, where 95% of the OS APIs are exposed only via Java and where your beloved C and C++ code needs to use JNI to access them.
Most people on JVM land, use a mix of Java, Kotlin, Scala, Clojure, Groovy, JRuby.
Whereas on CLR land it is C#, F#, VB.NET and C++/CLI (for low level stuff).
Naturally those that want to kill Java, or rather not touch Windows, aren't aware of this.
The choice of the language would become a matter of presenting the compiled code and writing replacements for new code.
The runtime and the type system can't be replaced this way though.
Languages with good type systems and tooling support a workflow where you mostly rely on Intellisense hints and docs, and never read the code itself.
That, but taken to its logical conclusion: if you never read the source code, you don't need to store the source code.
The missing part is the ability to define algorithms as modifications of existing algorithms.
x = y // 2 # floor division
But then I decided to look at the docs:https://doc.rust-lang.org/proc_macro/struct.Span.html
And I noticed source_text, which "preserves the original source code, including spaces and comments"!!!
Why not just use this from the start then?? Seems like the easy way out, no?
(Disclaimer: I don't know Rust, can't even write hello world.)
> However, in rust, there’s no way to differentiate .a.b with .a .b
Now I know that the above is incorrect. I would have never thought of spans so I thank you again
[0] https://conradludgate.com/posts/yew-css/#what-are-the-downsi...
if True:
x()
y()
if True:
x()
y()It's a brilliant hack and we are on Hacker News after all.
To try random ideas is part of learning and when you have something to share, just do that. There will always be like minded someone to pick up.
His primary use for it is building distributable binaries for Mercurial, which is written primarily in Python.
I was also amazed how much is implemented in libtorch itself as opposed to the Python wrapper, which makes much of the Torch functionality available to other languages.
[1] https://github.com/stickeritis/sticker2 https://github.com/stickeritis/sticker-transformers
Lua is often used tightly-coupled to C, and it doesn't have the significant-whitespace issues that Python shows here. Even so, I've only ever seen it used in separate `.lua` files, never embedded directly within `.c` files.
How would I go about doing that? I could put the Python code behind a little http API and call it that way, but that’s a bunch of overhead and extra stuff to maintain just to analyse some text. If I embed said Python tools in my Rust code then I can call those tools with significantly less overhead and complexity.
If you’re suggesting spawning things over shell/cmd line I’m of the opinion that this a generally bad idea.
[0]: https://neosmart.net/blog/2020/self-compiling-rust-code/
But the macro hacks are impressive!
Cool article btw!
It seems like it's a light gray background with a slightly (not much) darker gray text. The contrast and thin font weight is terrible.
And the pink is practically vibrating on the page.
At least the blue is okay.