Rust
- What are you working on this week? (May. 19, 2024)
Hi rustaceans! What are you working on this week? Did you discover something new, you want to share?
- I found a tool that allows compiling Rust to JVM bytecode (make JAR files from Rust, if you dare?)github.com GitHub - davidar/lljvm: Low Level Java Virtual Machine
Low Level Java Virtual Machine. Contribute to davidar/lljvm development by creating an account on GitHub.
I thought this might interest you Rust folk. This is kinda like an LLVM bitcode to JVM bytecode translator. So run
rustc
with--emit=llvm-ir
(I think that's the flag) and then pass the bitcode image to this program, then get JVM bytecode which you can make a JVM bytecode archive (JAR) from it. Could be an interesting? The author says it can JVM code from Clang output, so why not Rustc?Keep in mind that these are two different beasts, JVM is designed for a safe virtual machine and LLVM is chiefly used to be translated into machine code. However, stupider and more wonderful things have been done with LLVM and JVM, for example, there's an LLVM to 6502 translator, so you could be making NES games with Rust.
I will test this in a few days, busy implementing my own JVM (hope I can do it) and I don't have the Rust toolchain installed on my system. But hey maybe someone can make a Cargo plugin from it (is it possible?)
Thanks, later.
- Dart Macros
YouTube Video
Click to view this content.
Very impressive IDE integration for Dart macros. Something to aspire to.
- Tomorrow is a crab-day 🦀 — Rust birthday 🎉blog.rust-lang.org Announcing Rust 1.0 | Rust Blog
Empowering everyone to build reliable and efficient software.
#rust #rustlang
- Rust's denotational semantics make memory safety possible!
VOID WRONG
It seems like I misunderstood some stuff.
----
Over the years, up until Rust, there were 4 ways to have a 'safe' language:
- A virtual machine (e.g. most languages today) --- whether it's a high-level (scripting languages) one or low-level one (JVM, CLR)
- What C++ and similar languages do, destructors, compile-time bound checks, make a global heap and shit in it, make a local stack and piss in it, etc (basically my AllocPPx.pl but baked into the language)
- Bake the VM in with the machine code. That's what D and Go do, and I think Nim does that too. This will make the point of your language being compiled entirely moot imo.
- Finally, the most 'controversial' decision for imperative-loving chuds: make a functional language. ML/Scheme/CLisp achieve memory safety through closures. Haskell achieves this through Monads. Functional languages have a property which allows them to be be both compiled into machine code and bytecode, and also, interpreted like an scripting language.
The problem with all these approaches is the trade-off between safety and speed. There's another factor, and that is low-level access to the system. Languages like OCaml came close to achieving a balance, and that's why Rust bassed itself on it.
Most imperative languages have 'operational semantics', but not 'denotational semantics'. You can't describe what C does with math. What C does depends on the platform, the CPU, etc.
Rust's safety is achieved by 'flattening out' the memory model of a functional language like Ocaml. OCaml is a language with denotational semantics, because it's a functional language. Rust is an imperative language but it has denotational semantics. At least when comes to memory management.
I am not going to even attempt to describe the denotational semantics of Rust because I am just an amatuer and i don't have a master's in LDT. But if someoen tries, they could.
I think people might have already done it. I am not sure.
If you tell me no, and Rust does not have denotational semantics, I stand by my great-great grandfather's barber's grave that yes, it does!
So why do I say Rust 'flattens out' the functional model for memory management? It does at least with lifetimes. So imagine this: lifetimes are just 'let' bindings, but with a different syntax.
OCaml:
ocaml let rec factorial = function | 0 -> 1 | n -> n * factorial (n - 1);;
Scheme
scheme ; This uses `let` under the hood (define (factorial n) (if (<= n 1) 1 (* n (factorial (- n 1)))))
So these two in Rust would be:
rust fn factorial<'a>(n: u32) -> u32 { match n { 0 => 1, _ => n * factorial(n - 1), } }
I know'a
is almost useless here, but what I meant was, that'a
makes it similar to the 'let' bindings in the prior to examples!Semantics here is clear. Right?
But C:
int factorial(int n) { if (n == 0) return 1; else return n * factorial(n - 1); }
We do have operational semantics here, but who's to say what are the denotational semantics? Right? What is a 'function' in C? Well most C compilers translate it to an Assembly subroutine, but what if our target does not support labels, or subroutines?
You see what I am arriving at?
Conclusion
Rust is a semi-functional, semi-imperative language, but the difference between Rust and other languages with functional aspects is: denotional semantics!
Note: A language having lambda closures does not make it 'functional', you can do that in GNU C too ffs! Denotational semantics make it functional.
- slint 1.6.0 Releasedgithub.com Release 1.6.0 · slint-ui/slint
Release announcement with the highlights: https://slint.dev/blog/slint-1.6-released Detailed list of changes: ChangeLog
- cushy v0.3.0 Releasedgithub.com Release v0.3.0 · khonsulabs/cushy
Breaking Changes This crate's MSRV is now 1.74.1, required by updating wgpu. wgpu has been updated to 0.20. winit has been updated to 0.30. All context types no longer accept a 'window life...
- New crate: derive_typst_intoval
Hey all!
I've just published a small crate, and would like to take the occasion to not only announce this, but also make
typst
better known in the rust community, because I think it's awesome :)What does this do?
It provides a derive macro to derive
typst::foundations::IntoValue
for a struct.Why would I want that?
If you're using
typst
as a library, chances are you want to get data into your documents. Rather than using a templating library or rolling your own, I'd suggest usinginputs
(I'm still excited being made aware of that!), which implies making aValue
out of your data.typst_macros
provides the possibility to deriveCast
, which includes the treasuredIntoValue
... for enums. This is a gap somewhat closed by this crate.So what about this typst?
typst
is a typesetting system (akin to LaTeX) written in Rust. The core and cli are licensed freely, and it is very useable up to the point that I personally don't use latex anymore, but have switched to typst. I'm personally ultra-fond of the ability to use typst as a library, which makes it perfect for apps that want to produce high-quality documents from user-provided data.Any questions, comments, criticism, code reviews welcome! Also, give typst a shot.
- Inside Rust Blog: This Development-cycle in Cargo 1.79blog.rust-lang.org This Development-cycle in Cargo: 1.79 | Inside Rust Blog
Want to follow along with Rust development? Curious how you might get involved? Take a look!
- Rusty Playdate - Toolset and API
I’m working on a big project in #Rust, there is toolset and API for #Playdate.
All going great, moving to stabilization step by step, but so tired of looking at the dull amount ⭐️.
- What are you working on this week? (May. 05, 2024)
Hi rustaceans! What are you working on this week? Did you discover something new, you want to share?
- rustc_codegen_gcc: Progress Report #32
We fixed a couple of bugs and improved the support for Aarch64 which was requested by some people.
- Announcing Rust 1.78.0 | Rust Blogblog.rust-lang.org Announcing Rust 1.78.0 | Rust Blog
Empowering everyone to build reliable and efficient software.
- Websurfx 1.15.0 release
Hello again!!
Sorry for the big delay in the announcements. I know it has been a long time I have not made any announcements, but I will try my best next time this doesn't happen again.
So, through the medium of this post I would like to share with you all the
v1.15.0
major release version of thewebsurfx
project which was released on the 25th of March.If you are new, and you don't know what is
websurfx
then I would suggest taking a look at my previous post here:https://programming.dev/post/2678496
Which covers in depth about what the project is and why it exists.
Credits
Before I share with you the
changelog
, what this release version means and a preview on what we are planning to work on for the next major releasev2.0.0
. I would first like to thank all our contributors and maintainers because of whom this was all possible. Specially I would like to thank spencerjibz, ddotthomas and evanyang1 who have been invaluable to the project. Also,Websurfx
would not have been possible without alamin655 and xffxff early involvement.! Thanks 💖 to all the people involved in the project
Now, let's dive straight into what this release version actually means.
What does this release version means
This new release version
v1.15.0
introduces the new ranking algorithm for search results on the search page which ranks the results based on the relevancy to the user's search query.Changelog
The changelog of all the changes can be found here:
https://github.com/neon-mmd/websurfx/releases/tag/v1.15.0
Preview of the goals for the next major release
- Different levels of privacy to choose from with the help of rust's conditional compiling features (In progress).
- Even more engines will be supported.
- Categories would be added to search results like images, news, etc.
- More themes will be provided by default
- More animations for the websurfx frontend will be supported.
- Multi language support would be added.
- I2p and tor support will be provided.
- Reduce animations would be added for those who don't want animations and effects on the frontend.
- And lots more ✨.
- What are you working on this week? (Apr. 28, 2024)
Hi rustaceans! What are you working on this week? Did you discover something new, you want to share?
- efs, a no_std library for filesystems
efs is a recently published no-std library which provides an OS and architecture independent implementation of some UNIX filesystems in Rust.
Currently only the ext2 filesystem is directly implemented, but I will soonly work on other filesystems!
It's still young so it may contain bugs, but it's hugely tested so that it does not happen.
Some of the features provided :
-
no_std support (enabled by default)
-
General interface for UNIX files and filesystems
-
read/write regular files
-
retrieve, add and remove directory entries directly from a path and a current working directory.
I hope you will find this useful! If you have any remark, idea or issue, do not hesitate to ask here or to submit an issue!
-
- Palette 0.7.6: CIE CAM16, color theory schemes, and some more
The maintainer here! Feel free to ask questions. I know especially CAM16 can feel a bit abstract if you aren't in the loop, but I will try to answer what I can. I have tried my best to explain the concepts in the docs, but it can always be better.
- Leaving Rust gamedev after 3 years
This was a really good summary of what Rust feels like in my opinion. I'm still a beginner myself but I recognize what this article is saying very much.
The hacker news comments are as usual very good too:
https://news.ycombinator.com/item?id=40172033
- Inline const expressions have been stabilisedgithub.com Stabilise inline_const by nbdd0121 · Pull Request #104087 · rust-lang/rust
Stabilisation Report Summary This PR will stabilise inline_const feature in expression position. inline_const_pat is still unstable and will not be stabilised. The feature will allow code like this...
- Porting a cross-platform GUI application to Rust - Mozilla Hacks - the Web developer bloghacks.mozilla.org Porting a cross-platform GUI application to Rust – Mozilla Hacks - the Web developer blog
The Firefox crash reporter has been ported to Rust, with an architecture supporting native cross-platform GUI rendering.
- Hosting Rust crate documentation with Nginx
Docs.rs is great, but if you want to host yourself it's pretty easy.
- What are you working on this week? (Apr. 21, 2024)
Hi rustaceans! What are you working on this week? Did you discover something new, you want to share?
- since: my first project
This is my first project in rust, called:
since
. A small tool to filter logfiles or any other files with a timestamp in it, by a given timestamp.For example:
since 1h /var/log/messages
prints all lines from the last hour.since 00:00 /var/log/messages
prints all lines since 00:00.It would be nice if you could take a look at the code. What would you change, what should I change?
I’m not a professional programmer, this is just a hobby, but I want to learn as much as possible.
- 'Rust manpages' -> UNIX-style manpages for Rust (still WIP, just letting you know of the progress) --- Thoughts?pastebin.com require "json"require "markdown"require "optparse"def parse_type(rs_type - Pastebin.com
Pastebin.com is the number one paste tool since 2002. Pastebin is a website where you can store text online for a set period of time.
The URL leads to a pastebin for a Ruby script I have been writing for the past 2-3 days. It's called
mk_rustman.rb
on my system. They will turn JSON files for Rust docs into UNIX manpages, with Groff ROFF macros forman
(groff_man).The script may be rewritten, or I may change the language. I wish to use:
1- An interpreted language; 2- A dynamically typed language
I will choose a fast language, because the JSON file for Core is very large. Ruby has not been very fast so far, but there's an alternative implementation of Ruby I may try. Another candidate is F#. Does anyone know a dynamic but functional scripting language? Not a giant programing language like OCaml, something small that is functional.
Anyways.
Let me explain the JSON files first.
If you install
rust-doc
on your system:sudo apt-get install rust-doc
And:
exa /usr/share/doc/rust/json or ls /usr/share/doc/rust/json
You shall see these:
alloc.json.gz core.json.gz proc_macro.json.gz std.json.gz test.json.gz
All these JSON files have an 'index' object, this 'index' object is made up of sub-objects indexed by their ID:
zcat /usr/share/doc/rust/json/std.json.gz | jq '.index' | head -n 48
``` { "a:1:8659:4267-0:638:4291": { "id": "a:1:8659:4267-0:638:4291", "crate_id": 0, "name": null, "span": null, "visibility": "default", "docs": null, "links": {}, "attrs": [], "deprecation": null, "inner": { "impl": { "is_unsafe": false, "generics": { "params": [], "where_predicates": [] }, "provided_trait_methods": [], "trait": { "name": "UnwindSafe", "id": "1:8659:4267", "args": { "angle_bracketed": { "args": [], "bindings": [] } } }, "for": { "resolved_path": { "name": "BacktraceFrame", "id": "0:638:4291", "args": { "angle_bracketed": { "args": [], "bindings": [] } } } }, "items": [], "negative": false, "synthetic": true, "blanket_impl": null } } },
```
This is the first object in the list.
The 'meat' of an object is the 'inner' field. Inner can be one of:
``` zcat /usr/share/doc/rust/json/std.json.gz | jq '.. | objects | .inner // empty | keys[]' | sort | uniq
=>
"assoc_const" "assoc_type" "constant" "enum" "extern_crate" "function" "impl" "import" "macro" "module" "primitive" "struct" "struct_field" "trait" "type_alias" "variant" ```
I have parsers for most of these, but not all .And the parsers are incomplete.
These all have common fields. The most important field is the type. Another one is generics field. These two occur a lot.
I wanna turn this into perhaps, a larger project. I made a ChatGPT model to teach me PostScript. I wanna write a documentation language, similar to POD, and I wanna write several targets for it. Then, the Rust Manpaes could use this language.
***
I know that there MIGHT be some people who may not be aware of what UNIX manpages are, maybe they use Window, dunno. So I wanna explain manpages, and why I am adamant to convert Rust documentation to them.
Basically, the story is:
MacIlroy, Thompson and Ritchie decided that, instead of sucking the dicks of higher-ups at Bell labs to buy them a shiny PDP-11 to expand their shiny new OS, UNIX, with, they could promise them some sort of 'clerical use' for it. Using computers for clerical use was not very common back then. In fact, it was only a few years after ASCII was introduced. Story goes, 20-25 years prior, Von Neumann himself slaughtered an undergrad student who had dared to write what is today's equivalent of a 'charset encoding' for one of them giant compooters. This was modern times and people were slowly realizing that computers have other uses than launching rockets at the Vietnamese rice field workers. But even a mini-computer was an investment.
So they conceived ROFF, a documentation system which was adapted by the patent office gals. These gals would get their asses slapped, their boobies touched (as was the custom of the time) and write patents on their terminals with ROFF.
Source of this story:
man 7 roff
The same documentation system was used when Bell Labs decided to sell UNIX to people. And today, we have GNU Roff to take its place. There's also the Hoodlum Toolchest or whatever it's called, and BSD's Roff (which happens to be identical to Bedlam or whatever toolchest).
Groff has a man macro package which makes it extremely easy to write manpages with.
Manpages have 'sections', which are numbered. They could also have letters in them. On Linux, the section for utilities like
ls
andsh
andman
itself is1
, then syscalls are2
, library is3
etc:These two are equivalent:
man ls man 1 ls
But these two are not:
man getopt man 3 getopt
Most languages have manpages.
man 3o List # Ocaml List manpage man 3perl Pod::Usage # Perl Pod::Usage manpage
In both these instances, you can omit '3o' and '3perl'. On Linux, when
man
gets a conflict, it looks uses the default order ,which the user may set.Man pages are saved at
/usr/share/man
and/usr/local/share/man
.You can use
apropos
to search man pages:apropos pid
You can view all the pages in a section with:
``` apropos -s [section] -k .
line
apropos -s 3o -k . ```
Why do I want Rust Manpages?
Simply put, manpages are simpler to navigate, at least for me, than a webpge. Convenience is key here.
Some people like to launch Firefox or Chrome or whatever, and search their shit on google. I don't like that. I consider myself an intermediate practicioner of programming. The last time I used Stack Overflow was several months ago. I don't need to see how a function is used to know how to use it. I can just look at the documentation. So I think that is why I find manpages necessary.
I may make them for Go too. And Nim! Python needs them too. Although Python is like 10 years older than Go and Rust (12 yo Rust, 14 yo Go) so there might be manpages for Python.
Tell me what you think? Do you like this? Has someone already done this?
Thanks.
- Pretty critical PR for rust-msi is getting held up because the maintainer understands the intent but not why this worksgithub.com Fix the problem with long strings by Landay7 · Pull Request #18 · mdsteele/rust-msi
Hi! Thank you for your work, I tried to play with it and figured out that there is an issue with the long string. Basically, it doesn't read fully long string and after that, all strings are messed...
Not to throw shade, just wishing that somebody here can understand. Whenever an input is reasonably long, an analyzing function will crash, and this PR aims to fix that with a mechanism that contradicts the maintainer's understanding while a similar C implementation does not need this fix.
Clearly, the maintainer has not heard a certain programming mantra... - tantivy 0.22 has been released! Performance and Stability Improvements, Top Hits and Term Aggregationsquickwit.io Tantivy 0.22 | Quickwit
Exciting news from the search engine world — Tantivy 0.22 has just been released!
- Rust Mastery book bundle from Humble Bundlewww.humblebundle.com Humble Tech Book Bundle: Rust Mastery by Packt
Master Rust with this book bundle! Explore data structures & algorithms, dive into real-world projects & more. Your purchase helps World Central Kitchen.
- Rauthy OIDC provider v0.22.0 · Now with Upstream Auth Providers (login with GitHub et.al.)github.com Release v0.22.0 · sebadob/rauthy
Breaking There is one breaking change, which could not have been avoided. Because of a complete rewrite of the logic how custom client logos (uploaded via Admin UI -> Clients -> Client Config -> Br...
I’m personally very excited about this because Rauthy provides a robust foundation of OIDC-based identity for the fedi-connected platform we’re building with Weird netizens.
The addition of “social logins” such as GitHub means indie platforms like Weird can let people easily sign in with the mainstream identity provider they’ve already got, but once they’ve signed up they’ll have the option of using our open source identity provider for other services going forward, thus reducing their dependency on the Big Corp.