@zwarich@hachyderm.io avatar

zwarich

@zwarich@hachyderm.io

Programming language & compiler enthusiast, computer architect, and creator of Rosetta 2.

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

zwarich, to random
@zwarich@hachyderm.io avatar

The worst realization that you’re aging is searching for something on Math Overflow and realizing that you answered it 8 years ago.

pervognsen, to random
@pervognsen@mastodon.social avatar

This classic blog post resurfaced on the Rust subreddit today after someone posted that they wished ownership had been explained to them with a metaphor about pirate treasure chests.

https://byorgey.wordpress.com/2009/01/12/abstraction-intuition-and-the-monad-tutorial-fallacy/

'But now Joe goes and writes a monad tutorial called “Monads are Burritos,” under the well-intentioned but mistaken assumption that if other people read his magical insight, learning about monads will be a snap for them. “Monads are easy,” Joe writes. “Think of them as burritos.”'

zwarich,
@zwarich@hachyderm.io avatar

@pervognsen Also, unlike in mathematics where the concrete examples are always instances of the general concept, some of these real-world examples for programming are pretty bad. Who actually stuffs a burrito with another burrito?

pervognsen, to random
@pervognsen@mastodon.social avatar

This came up in another thread today but I figure I'd throw a brief comment to the timeline. The concept of "grace periods" where you separate the logical and physical deletion of resources is something you see in RCU, EBR, QSBR, etc, but it's just as useful in single-threaded code where you only have pseudo-concurrency through subroutine calls. Like the age-old pattern of deferring deletion until the end of the game loop, or autorelease pools in Objective C which get drained by the run loop.

zwarich,
@zwarich@hachyderm.io avatar

@pervognsen @SonnyBonds If only programming languages could associate the arena with the handle for you so you don't need to pass the arena around everywhere.

zwarich,
@zwarich@hachyderm.io avatar

@pervognsen @SonnyBonds The only thing that annoys me about serializing these sorts of web-of-arenas structures is that once you start doing any sort of reclamation, the exact layout of the data depends on the history of all operations performed on that arena.

Of course, since you can always canonicalize the whole web, this is mostly an aesthetic concern.

zwarich,
@zwarich@hachyderm.io avatar

@pervognsen @SonnyBonds Related, but do you have a parallel interning strategy that you really like? I remembered seeing this post from matklad, but didn't reach a conclusion about it from reading it alone (and had no chance to implement it): https://matklad.github.io/2023/04/23/data-oriented-parallel-value-interner.html

zwarich,
@zwarich@hachyderm.io avatar

@pervognsen I know, it's giving Meta "<popular tool> can't handle our scale" vibes.

In places where I've had this problem in the past, I've just used local interners and eaten the cost of doing cross-boundary comparisons. It also has the advantage that you're much more likely to be able to eventually reclaim names than when using a global interner.

sunfish, to random
@sunfish@hachyderm.io avatar

I just gave myself permission to say "I don't think I'll ever understand how Windows filesystem paths work" and it felt good.

zwarich,
@zwarich@hachyderm.io avatar

@sunfish i node dat feel

regehr, to random
@regehr@mastodon.social avatar

getting the impression that the author of this slide deck feels slighted

https://www.cs.umd.edu/~hjs/slides/dagstuhl05.pdf

zwarich,
@zwarich@hachyderm.io avatar

@regehr Writing assembly code using S-expressions for an architecture with an accumulator in 2012 is certainly an aesthetic choice one could make.

forrestthewoods, to random
@forrestthewoods@mastodon.gamedev.place avatar

Proving that Immediate Mode GUIs aren’t significant battery hogs. Computers are really fast!

MacBook M1 Idle: 3.5 watts

Dear ImGui: 7.5
ImPlot: 8.9
EGUI: 8.2
Rerun: 11.1

Spotify: 5.8
VSCode: 7.0
YouTube: 11.5
Facebook: 8.7

Compiling: 50.0

Full blog post: https://www.forrestthewoods.com/blog/proving-immediate-mode-guis-are-performant/

zwarich,
@zwarich@hachyderm.io avatar

@pervognsen @forrestthewoods Is this just bidirectional type checking (or left corner parsing) in a new guise again? It seems like there's only like 3 good ideas...

pervognsen, to random
@pervognsen@mastodon.social avatar

Clippy is so good.

zwarich,
@zwarich@hachyderm.io avatar

@pervognsen Yeah, but Clippy clearly missed the "it looks like you're trying to implement a data structure with parent pointers" lint.

regehr, to random
@regehr@mastodon.social avatar

"Explaining Code using ASCII Art" was one of the most fun blog posts I ever wrote

https://blog.regehr.org/archives/1653

and now there's a paper on this topic! ❤️

https://pg.ucsd.edu/publications/how-programmers-ASCII-diagram-code_CHI-2024.pdf

zwarich,
@zwarich@hachyderm.io avatar

@regehr Obligatory VPRI STEPS TCP/IP stack reference: http://www.moserware.com/2008/04/towards-moores-law-software-part-3-of-3.html

Sadly, most references to STEPS appear to have bitrotted in not much more than a decade.

zwarich,
@zwarich@hachyderm.io avatar

@pervognsen @regehr The dopiest shit I can remember being high on at one point is metaobject protocols. Imagine liking inheritance so much that you want individual programmers to be able to silently change how it works at runtime.

pervognsen, (edited ) to random
@pervognsen@mastodon.social avatar

I dug up some old Emacs code I hacked up in a weekend as a proof of concept for a GDB/MI-based debugger UI (though this doesn't look like the final version): https://gist.github.com/pervognsen/74d04030b5bb4348534f. Anyway, it reminded me how pleasant it was to program the UI. You re-render the model state from scratch to buffers based on user actions or async messages from the GDB/MI process. Emacs's buffer abstraction lets you attach arbitrary Lisp values as metadata to text ranges and query them by buffer position.

zwarich,
@zwarich@hachyderm.io avatar

@pervognsen know that there are projects along these lines already, but it would be interesting to see a really well-done immediate mode TUI framework, and an extensible text editor built on top of it. An immediate mode TUI is perfect for an application that supports both dynamically reloadable configuration and plugins.

pervognsen, to random
@pervognsen@mastodon.social avatar

It's always been odd to me that the standard introductory textbooks on formal languages and computation usually don't mention the least fixed point approach to context-free languages versus the standard derivational approach ("a string belongs to the language generated by a context-free grammar if there is a derivation of that string from the grammar's start symbol").

zwarich,
@zwarich@hachyderm.io avatar

@pervognsen What's the most introductory textbook that even proves this, nevermind using it as a basis for their treatment? Bonus points if they take a greatest fixed point approach to automata.

pervognsen, to random
@pervognsen@mastodon.social avatar

A full Boeing 747 is almost twice as energy efficient per passenger-kilometer (the energy it takes to transport one passenger for one kilometer) as a gasoline car with one passenger. https://www.withouthotair.com/c20/page_128.shtml

zwarich,
@zwarich@hachyderm.io avatar

@pervognsen This disappointed me in the opposite direction when I discovered how inefficient hiking is (especially as you increase walking speed) compared to exercising on a bike. You really need to bike hard to burn calories.

dsp, to random
@dsp@nullptr.rehab avatar

The reason I love Rust and Zig is that I am still burned from the one time I used a C library that runs it's own threading while calling back into the callers code. Making any language with runtimes aware of running C threads that you can't control is really painful.

zwarich,
@zwarich@hachyderm.io avatar

@dsp Not the exact same situation, but one of the worst parts of any web browser engine is dealing with situations where you end up running a recursive event loop, e.g. when running developer tools. I asked people still working on browsers and they confirmed that it's still a problem.

Early in my career, I came up with a principle that nesting corecursion → recursion → corecursion is almost always a bad idea, and you should push the second corecursion down to the top level if at all possible.

zwarich, to random
@zwarich@hachyderm.io avatar

This issue with the C++ memory model has been haunting me:
https://docs.google.com/presentation/d/1TJBCPr6SP5wILt4or2j9QYUpl4rjhzQCAHRaumIB9mA/
It seems to break some basic local reasoning properties that you'd really like to hold.

zwarich,
@zwarich@hachyderm.io avatar

@pervognsen That file makes a good argument for declaring address-taken variables upfront.

zwarich, to random
@zwarich@hachyderm.io avatar

@chandlerc I’m following Carbon pretty closely, and hope that it succeeds so there are fewer and fewer contexts in which I could be asked to write C++.

However, I’m a bit puzzled by the safety story. What makes you confident that you can focus on adding safety after the fact and succeed rather than building it in from the beginning?

zwarich,
@zwarich@hachyderm.io avatar

@chandlerc That at least makes some degree of sense.

Do you have a rough idea of what kind of type system features you'll need to achieve safety? Given the close relationship with C++ and its idioms, it's honestly hard to imagine something other than Rust-style ownership w/ borrowing. All of the obvious alternatives I can think of would require a larger departure from C++ idioms.

zwarich,
@zwarich@hachyderm.io avatar

@artificialmind @chandlerc One of the keys to Rust ergonomics is that the . method call operator will perform several implicit coercions (e.g. autoderef, autoref, even user-defined ones), which do not happen for ordinary function calls. If your language preserves this behavior, I doubt the default would matter too much.

One major ergonomic thing that Rust missed out on was autoref/deref for Copy types. I was told this was considered for an edition, but it never happened.

zwarich,
@zwarich@hachyderm.io avatar

@chandlerc Carbon does have some things going for it relative to Rust.

  • It has HKT from day one: When everything takes an extra lifetime parameter, plain types become type constructors. Rust's reasons for not doing real HKT never made any sense.

(continued)

zwarich,
@zwarich@hachyderm.io avatar

@chandlerc

  • Better modeling of the distinction between values and storage. This has been a pain for Rust, esp. regarding semantics of unsafe code and enabling optimizations. I'm mildly skeptical this will continue unabated in Carbon, just because of the need to take pointer references to temporary values for API reasons. In a perfect world, having a memory address and having a readable (and/or writable value) would be completely separated from each other.
zwarich, to random
@zwarich@hachyderm.io avatar

Can someone please make a value-oriented systems language with implicits? I’d really like Comparable to be implemented for T and an accompanying Context rather than just a T.

zwarich,
@zwarich@hachyderm.io avatar

@foonathan On 64-bit systems, there's often an advantage to using 32-bit indices instead of pointers, but this imposes a requirement that you always have a context available with which to interpret these indices. But all of the traits/interfaces/etc. for equality, comparison, hashing, etc. will not let you use the context in order to implement them.

A language with implicit arguments (and possibly singleton types or some other mechanism of linking a value with its context) would fix this.

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