Hacker Newsnew | past | comments | ask | show | jobs | submit | rienbdj's commentslogin

> One of the biggest knocks against Rust as a systems programming language is that it has weak compile-time and metaprogramming capabilities compared to Zig and C++.

Aren’t Rust macros more powerful than C++ template metaprogramming in practice?


No, they are not.

They are both; there are things that Rust's macros can do metaprogramming-wise that C++ templates cannot do and vice-versa.

Rust's macros work on a syntactic level, so they are more powerful in that they can work with "normally" invalid code and perform token-to-token transformations (and in the case of proc macros effectively function as compiler extensions/plugins) and less powerful in that they don't have access to semantic information.


Incorrect.

Rust has two separate macro systems. It has declarative "by example" macros which are a nicer way to write the sort of things where you show an intern this function for u8 and ask them to create seven more just like it except for i8, u16, i16, u32, i32, u64, i64. Unlike the C pre-processor these macros understand how loops work (sort of) and what types are, and so on, and they have some hygiene features which make them less likely to cause mayhem.

Declarative macros deliberately don't share Rust's syntax because they are macros for Rust so if they shared the same syntax everything you do is escape upon escape sequence as you want the macro to emit a loop but not loop itself etc. But other than the syntax they are pretty friendly, a one day Rust bootstrap course should probably cover these macros at least enough that you don't use copy-paste to make those seven functions by hand.

However the powerful feature you're thinking of is procedural or "proc" macros and those are a very different beast. The proc macros are effectively compiler plugins, when the compiler sees we invoked the proc macro, it just runs that code, natively. So in that sense these are certainly more powerful, they can for example install Python, "Oh, you don't have Python, but I'm a proc macro for running Python, I'll just install it...". Mara wrote several "joke" proc macros which show off how dangerous/ powerful it is, you should not use these, but one of them for example switches to the "nightly" Rust compiler and then seamlessly compiles parts of your software which don't work in stable Rust...


Docker is enough in practice no?

Congrats to the team!

Is there a video showing someone spinning this up and finding a bug in a simple app?

A broken counter app maybe?


Not yet but I definitely will record one soon. I've been working at the debugging UI for Bombadil (some hints at https://x.com/owickstrom/status/2034925537706020978) that will make for a nice cohesive demo.

Weird - Iain m Banks would’ve found Musk’s politics abhorrent

Ultimately you need staging, yes.

But you can’t have every dev tweaking staging at the same time as they work. How can you debug things when the ground is shifting beneath you?

Ideally every dev has their own AWS account to play with, but that can be cost prohibitive.

A good middle ground is where 95% of work is done locally using emulators and staging is used for the remaining 5%.

One of the first things I do when building a new component is create a docker compose environment for it.


Do the old iPods still hold battery well?


You can buy good quality replacement batteries. I got Cameron Sino "CS-EC003XL". It lasts at least a week before needing a charge, depending how much you use it.


I agree but stuck with Apple ecosystem. I like the cheap wired lightning headphones they do. The audio quality is acceptable on public transit, they’re cheap enough to lose and the mic is surprisingly good. Weirdly if Apple stopped making these I would jump ship for an Android phone with 3.5mm.


But you have wired earpods, both lightning and usb-3. I cannot be happier with those for my iphone and ipad, resp.


My bad, meant USBC - used to have Lightning


But those are close to deterministic.


GitHub has their own study using Copilot but given the obvious conflict of interest I would discount it.


Always nostalgic for Cornflower Blue :)


Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: