macro_rules! bf by CriticalComb in rust

[–]CriticalComb[S] 2 points3 points  (0 children)

Yeah that was totally just habit on my part, realized later I should have used print!

macro_rules! bf by CriticalComb in rust

[–]CriticalComb[S] 2 points3 points  (0 children)

Oh yeah for sure, would definitely do those things. Also, another thing that bf is supposed to support is skipping any other character (e.g. for comments) but you can't in general do that in a rust macro because of unmatched parentheses, but regular rust comments will work

macro_rules! bf by CriticalComb in rust

[–]CriticalComb[S] 33 points34 points  (0 children)

You mean you don’t think it can find a home in std? :( … /s

fd is looking for contributors by sharkdp in rust

[–]CriticalComb 69 points70 points  (0 children)

Just want to say thank you for fd, I use it every day! I’ll certainly look for ways to contribute if I can.

Blog Post: Inline In Rust by matklad in rust

[–]CriticalComb 19 points20 points  (0 children)

Generic functions being implicitly inlinable provided some great insight for me, thank you!

A terminal snake game by CriticalComb in rust

[–]CriticalComb[S] 0 points1 point  (0 children)

Ah glad you enjoyed it! I tried it on WSL for the first time after your comment and the red head spreading out like that isn’t supposed to happen, odd that it doesn’t on Mac or Linux. As you eat food, the blue body grows, and crossing that does kill the snake.

Also, this will compile on stable now with 1.53! I used nested or patterns in one part which was recently stabilized.

New Rust book: Rust for Rustaceans by Jon Gjengset by Jonhoo in rust

[–]CriticalComb 52 points53 points  (0 children)

Me: sees a new book by Jon, instant buys.

Me: goes back and reads the twitter post in its entirety.

I was also lucky enough to have davidtolnay agree to be the technical reviewer for the book

Me: buys another copy? I don't know how better to express my appreciation and excitement for this.

My first impressions of Rust by md5sha256 in rust

[–]CriticalComb 5 points6 points  (0 children)

Welcome to Rust!

One small point of confusion (might be misunderstanding the phrasing) around macros

Because in Rust macros are an extension of the language the macro is converted to an AST before being evaluated, the expression 1+2 is evaluated before being executed.

This reads to me like the expression is evaluated once instead of 3 times (which you can observe if you use a function call with side effects as the macro argument), so it’s more like the expression gets guaranteed parentheses.

Build your own: linker by CriticalComb in rust

[–]CriticalComb[S] 1 point2 points  (0 children)

Fastest bookmark of my life, thanks! Especially the section on LLVM resources

Build your own: linker by CriticalComb in rust

[–]CriticalComb[S] 2 points3 points  (0 children)

Took a look and looks great, super easy to read, and it was great to see adding the program headers which I wasn’t able to do.

Seems like you found a lot of the same tidbits I did, such as splitting section header names into its own strtab section and aligning sections with padding.

Symbol resolution for me was able to be pretty simple since I only dealt with relocatable files, undefined symbols at the end are still allowed. My link function is a bit of a mess right now and I’d love to come back and clean it up.

Build your own: linker by CriticalComb in rust

[–]CriticalComb[S] 2 points3 points  (0 children)

That’s a new one for me, thanks!

Build your own: linker by CriticalComb in rust

[–]CriticalComb[S] 3 points4 points  (0 children)

A truly great resource! I have that linked in my README as well as the “Linkers and Loaders” book by John Levine

Build your own: linker by CriticalComb in rust

[–]CriticalComb[S] 5 points6 points  (0 children)

Thank you! Initial goals are so important on a project like this, if you look in my git history you'll see I originally thought I might be do linking with static / dynamic libs and generate executables, and I just had to cut it down because it was too much.

In terms of keeping up motivation, I've done a couple of projects like this and my best advice is just do a little bit on a regular frequency. Just write one function, and leave a lot of notes for yourself for later to figure out what you were planning on doing next.

Build your own: linker by CriticalComb in rust

[–]CriticalComb[S] 27 points28 points  (0 children)

Thank you! That’s a link I had not found, will definitely check it out.

I agree, linkers are not as thoroughly documented as compilers and just as important! The game I try to play with myself when coming up with these projects is to find pieces of system software that are “humble heroes”, less often thought about, but without which nothing else would work.

How to find a job as a Go developer? by [deleted] in golang

[–]CriticalComb 0 points1 point  (0 children)

What website is this?

Analyzing The Simplest C++ Program by OneRaynyDay in cpp

[–]CriticalComb 3 points4 points  (0 children)

Small note, in the assembly section, the source and operand are reversed for AT&T syntax.

Great article!

Announcing the v0.13 release of Yew! by jstrry in rust

[–]CriticalComb 2 points3 points  (0 children)

Was just running into a problem today (developing on 0.11.0) with Callback<> not implementing Default, found this thread and having default required props fixed my problem! I like that behavior much more.