@ekuber@hachyderm.io
@ekuber@hachyderm.io avatar

ekuber

@ekuber@hachyderm.io

"We spent decades trying to invent a sufficiently smart compiler when we should have been inventing a sufficiently empathetic one."

Rust Compiler team member. If you have to search for answers when the compiler is talking to you, that's a bug.

There are no bad programmers, only insufficiently advanced compilers.

Cache-locality awareness evangelist.

💼@aws, opinions my own

he/him

Trans rights are human rights

This profile is from a federated server and may be incomplete. Browse more on the original instance.

ekuber, to random
@ekuber@hachyderm.io avatar

This has been rattling in my head for a couple of days so I had to go ahead and mock up a potential design for compiler diagnostic output that uses Sixels (an old protocol to draw on terminals) for underlines instead of ASCII art.

I'm not in a place to pursue it myself, but I would love it some project like miette tried to explore what could be done on the terminal beyond Unicode block drawing characters and emoji.

ekuber,
@ekuber@hachyderm.io avatar

(note that this isn't purely an image, this is a screenshot of my terminal after touching a file with ANSI escape codes by hand)

ekuber,
@ekuber@hachyderm.io avatar

@thejpster Those aren't glyphs, it's it's me poking bits one by one to draw the underline and vertical columns. When drawing Sixels, all terminals that support it (except Konsole) will blank out the underlying text. That lets you have text under the drawing that gives you a fallback. It is incredibly finicky, support is spotty, but I still think it'd be neat to explore this.

soller, to random
@soller@fosstodon.org avatar

I think cosmic-term can do all of this except for sixel (and I'm open to implementing that too!)

https://floss.social/@triskelion/112576108605063095

ekuber,
@ekuber@hachyderm.io avatar

@soller does it currently let you query the character cell size? If it doesn't, does it let you query the terminal size in pixels and in characters? (From this the char size can be inferred.)
Once you know the size then you can use sixel graphics to draw things inline with text, like custom icons, sparklines, custom fonts...

ekuber, to random
@ekuber@hachyderm.io avatar

Random question of the day: how do TTS services deal with terminal emulators when sixel graphics are used? Do they get super confused? Ignore the graphics and just deal with the text?
If the later, that might be a workable (if super hacky) way of providing simultaneously nicer output in terminals and cleaner text that conveys the underlying semantics to TTS users.

ekuber,
@ekuber@hachyderm.io avatar

@matt
The following script prints a small green on yellow "Hi" image after the text "before":

#!/bin/sh
echo -n before
printf 'G1BxIzA7MjswOzA7MCMxOzI7MTAwOzEwMDswIzI7MjswOzEwMDswIzF+fkBAdnZAQH5+QEB+fiQjMj8/fX1HR319Pz99fT8/LSMxITE0QBtcCg==' | base64 -d
echo -n after

ekuber,
@ekuber@hachyderm.io avatar

@matt iTerm on Mac, Konsole and xterm in Linux, that I know of. There are more that I haven't used.

ekuber,
@ekuber@hachyderm.io avatar

@matt oh, for xterm you need to pass a flag to it for it to enable sixel support
https://github.com/hackerb9/lsix?tab=readme-ov-file#xterm

ekuber, to rust
@ekuber@hachyderm.io avatar

Niko Matsakis, as usual, with insightful ideas about how to evolve Rust's lifetimes to make them both more powerful and easier to use.
https://smallcultfollowing.com/babysteps/blog/2024/06/02/the-borrow-checker-within/

ekuber,
@ekuber@hachyderm.io avatar

@mcc because lifetime analysis happens at two levels: at the item level, which only looks at declared lifetimes, and in item bodies, where the borrow checker knows when things are used and when they stop being used and checks against the externally declared lifetimes.

ekuber,
@ekuber@hachyderm.io avatar

@mcc I think Niko has talked about supporting what you want with a special 'super lifetime to be used in expressions, where you can tell the borrow checker "this borrow is alive at the end of this block, I want you to extend it as long as it would if declared in its parent block".

ekuber,
@ekuber@hachyderm.io avatar

@mcc (doing it automatically runs the risk of the equivalent of a memory leak, where you're silently holding on to a huge piece of memory while borrowing a small piece of it)

ekuber,
@ekuber@hachyderm.io avatar

@mcc I believe your interpretation is correct (I'm unsure I'm entirely on the same page on what you mean, but it sounds right)

ekuber, to random
@ekuber@hachyderm.io avatar

It's frustrating to see how many people compare languages by looking at their syntax instead of their semantics. You can make a C-looking Haskell or a Python-looking C.

ekuber, to random
@ekuber@hachyderm.io avatar

“I've learned that when people give you notes on something, when they tell you what's wrong they're usually right, when they tell you how to fix it they're usually wrong” — Bill Hader

ekuber,
@ekuber@hachyderm.io avatar

@noharmpun no joke. It is a quote from Bill Hader in an interview when talking about script writing, which I'm sure is just a remix of earlier thoughts that he's heard, but I liked the way it was framed and fits my understanding of how to take feedback constructively.

ponda, to rust
@ponda@mastodon.online avatar

#C compiler on error: Line 45: segfault 0x00000634634
#Rust compiler on error: There is an issue with your code in the line 45, see here: [you code]. To fix it you simply have to do this and this, like that [fixed code]. Please have a nice day!
#rustlang #programming #software

ekuber,
@ekuber@hachyderm.io avatar

@0xDEADBEEF @ponda understanding arcane errors are a sign of experience, but idealizing arcane errors is falling with Stockholm Syndrome.

ekuber, to photography
@ekuber@hachyderm.io avatar

A bit blurry due to using a 2x converter on a very soft 500mm on a cheap tripod with very bad skill, but still very happy with how it came out.

ekuber,
@ekuber@hachyderm.io avatar

And here's the same scene without a plane

bswolf, to rust
@bswolf@hachyderm.io avatar

: You cannot create a struct whose default value is larger than the size of your stack. Box::new only moves the object in; Box::default calls new with the result of default (which is stack).

And based on comments in https://github.com/rust-lang/rust/issues/53827, even if I did manage to create such an object, cloning it would also blow away the stack due to stack allocation.

Yuck. This is going to make creating a giant EnumMap very difficult.

ekuber,
@ekuber@hachyderm.io avatar

@willglynn @bswolf I know that there are a few crates that provide a macro for this exact thing. Asahi Linux wrote one for their GPU driver.

became_fish, to rust
@became_fish@jorts.horse avatar

people say "C++ isn't any closer to the metal than is" but what is the memory footprint of returning a Result? in C++ i can pass an out parameter by reference to avoid allocating anything on the stack - how do i do that in rust? is it with a &mut ptr? is it done automatically by the compiler when returning?

ekuber,
@ekuber@hachyderm.io avatar
soller, to random
@soller@fosstodon.org avatar

I wrote a PDF reader with libcosmic yesterday. While it is very basic and not likely to be ready for the first COSMIC release, it is pure rust, lightweight, GPU accelerated, and highly portable.

ekuber,
@ekuber@hachyderm.io avatar

@lw64 @soller I believe that the implication when that phrase is used is that cargo run and cargo install --path . will work without additional environment set-up. And that if you're a Rust developer there's no part of the application that you can't modify yourself, of course.

ekuber,
@ekuber@hachyderm.io avatar

@lw64 @soller parsing is precisely one of those libraries that I appreciate being done in Rust. It's its raison d'être. Parsing untrusted input in a language that can easily turn malformed input into runnable code has historically being an endless source of security issues.

hds, to random
@hds@hachyderm.io avatar

@ekuber I just missed the fn keyword and found that the error message in that case wasn't so helpful.

error: expected one of ! or ::, found (

I couldn't find a issue for this, but I thought I'd check with you before creating one.

ekuber,
@ekuber@hachyderm.io avatar

@hds thank you!

faassen, to rust
@faassen@fosstodon.org avatar

I wonder how to best describe how influences design, for better or worse. Here is some rambling...

It makes you avoid cyclical data structures, and you are far more aware of ownership. This makes surprising action at a distance harder. It also makes it more difficult to misuse globals or struct fields as globals just to pass data along to where it is needed no matter how.

Enums turn out to replace dynamic dispatch very often. Inheritance is just gone.

1/n

ekuber,
@ekuber@hachyderm.io avatar

@faassen One thing about traits is that it makes thinking about Rust code closer to how I think about relational databases.

I am reminded of

"Show me your flowchart and conceal your tables, and I shall continue to be mystified. Show me your tables, and I won't usually need your flowchart; it'll be obvious." -- Fred Brooks, The Mythical Man Month (1975)

which significantly shaped how I think about problems. Traits + ADTs put you in the same frame of mind.

  • All
  • Subscribed
  • Moderated
  • Favorites
  • megavids
  • khanakhh
  • mdbf
  • ethstaker
  • magazineikmin
  • cubers
  • rosin
  • thenastyranch
  • Youngstown
  • InstantRegret
  • slotface
  • osvaldo12
  • kavyap
  • DreamBathrooms
  • JUstTest
  • Durango
  • everett
  • tacticalgear
  • modclub
  • normalnudes
  • ngwrru68w68
  • cisconetworking
  • tester
  • GTA5RPClips
  • Leos
  • anitta
  • provamag3
  • lostlight
  • All magazines