Thursday, July 29, 2021

Gibson fretwire

Apparently with my Gibson Les Paul craze back again, I’ve been dabbling into the specs of the High Performance series. The specs list the fretwire as “Low”, without any further info on the actual dimensions. Also, other models are listed as having “Medium Jumbo” fretwire. What do they mean?

Fortunately Gibson Customer Service kindly answered my emails, and these are the measures:

Fretwire Height Width
Medium Jumbo .055" .090"
Low .045" .086"

This information, paired with this fretwire chart and our JP chart, gives us a good comparison with commonly known fret sizes:

Fretwire Height Width
Dunlop 6000 .058" .118"
6100 (Ibanez JPM) .055" .110"
6105 (Ibanez JEM) .055" .090"
6140 (Ibanez Universe) .039" .106"
EBMM medium jumbo (Majesty) .051" .108"
high wide (JP6) .047" .104"
Suhr jumbo .057" .110"
medium .055" .090"
heavy .051" .108"

I just can’t understand, however, why would they use vintage frets in such a modern guitar.

Sunday, July 11, 2021

Accepting both Vec or slice of String or &str in Rust

In whathever programming language, it’s rather common to have a function which accepts an array of strings. Specifically in Rust, there is the notion of slice, which can be used as a reference to a Vec. And also there is the notion of &str, which can be used as a reference to String. Putting both concepts together as an argument is not trivial, though.

Turns out I found a way to make it work by using the AsRef trait – as many things in Rust, traits lead the way. By using generics, it becomes possible:

fn foo<S: AsRef<str>>(names: &[S]) {
	for name in names.iter().map(|s| s.as_ref()) {
		println!("{}", name);
	}
}

Or alternatively using the impl keyword for the trait bound:

fn foo(names: &[impl AsRef<str>]) {
	for name in names.iter().map(|s| s.as_ref()) {
		println!("{}", name);
	}
}

The function above accepts both Vec and slice of String or &str. But notice how, in order to retrieve the string itself, the as_ref() method must be called.

Friday, July 9, 2021

About these 10 years

Hello, dear reader.

I started this blog exactly 10 years ago, in a Saturday morning, without having much idea about what I’d write here. I just wanted a safe place to vent.

Now, after 10 years, there’s quite an interesting content written down. In many ways, it’s a window to see my own maturing on various topics. Things that matter – or mattered at the time – to me, and nobody else. Well, actually some posts did generate outsiders’ interest but that’s not the point: this is a personal blog in the most actual sense.

But the thing is that it feels like it was yesterday. 10 years went by.

Thursday, July 1, 2021

Missing the ternary operator in Rust

Just out of curiosity, I wrote a Rust macro similar to Visual Basic’s IIf function:

macro_rules! iif {
	($cond:expr, $iftrue:expr, $iffalse:expr) => {
		if $cond { $iftrue } else { $iffalse }
	};
}

Usage:

let n = iif!(1 == 1, "yes", "no");

Close to the ternary operator, which I’m sorely missing in these Rust days.