Posts

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.

foonathan,
@foonathan@fosstodon.org avatar

@zwarich A couple days ago I've watched a lightning talk I gave in 2018.

Learned something new.

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.

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

@zwarich Yup, if you want to facilitate single-pass alias analysis for cases like that you want the opposite of C's register keyword and default semantics. If you have a pointer vs reference dichotomy, you can still allow references to locals to be formed by default as long as something prevents that kind of rebinding.

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

  • 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.
chandlerc,
@chandlerc@hachyderm.io avatar

@zwarich

FWIW, the current model already explicitly materializes storage for temporaries when a pointer is needed as you say. But we have a concrete event where that occurs and we have to start thinking in terms of storage. So I think we're in a good position for readable values to be completely separated from storage.

Whether we add mutable value semantics (w/o storage) is a really interesting question, and something we're keeping open (and looking at Hylo and others to learn about).

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.

foonathan,
@foonathan@fosstodon.org avatar

@zwarich Ahh, yes, that's something I miss as well.

zwarich, to random
@zwarich@hachyderm.io avatar

How bad would it be if a systems language only had user-specified inlining, specified at function declarations, function parameter declarations, or the call site? I’ll even allow automatic inlining of single use local functions as a bonus.

zwarich, to random
@zwarich@hachyderm.io avatar

@pervognsen I didn't realize that this was you on Reddit:
https://old.reddit.com/r/rust/comments/16rhtsw/rust_the_joy_of_safe_zerocopy_parsers/k26dxvn/
I forgot to reply and link to this solution, which I was responsible for in a previous iteration (I was the perf lead for the switch to 16K pages on iOS):
https://github.com/apple-oss-distributions/xnu/blob/main/osfmk/vm/vm_dyld_pager.c
Just apply the fixups when paging data from disk and pretend the page was clean.

pervognsen,
@pervognsen@mastodon.social avatar

@lgerbarg @resistor @zwarich So a normal library/program could exploit this for their memory-mapped DB, for example? Or does it need special key signing like some of the debug server stuff apparently does?

lgerbarg,

@pervognsen @resistor @zwarich Conceptually yes, but in practice no. It is an incredibly power control flow primitive, as such usage is very restricted.

zwarich, to random
@zwarich@hachyderm.io avatar

@d_christiansen I really enjoyed the Functional Programming in Lean book, and was generally impressed to see the transformation from Lean 3 to 4 in terms of usability as a programming language.

Are there any potential new features that you think would really improve the Lean programming experience?

d_christiansen,
@d_christiansen@mathstodon.xyz avatar

@zwarich I don't think that there is "the Lean programming experience" - a person's experience will be determined by their background, their environment, and much more. Different features serve different people.

d_christiansen,
@d_christiansen@mathstodon.xyz avatar

@zwarich that said - error messages, documentation, an auto-formatter, IntelliJ-style refactorings and test runner, Agda-style case splitting and holes, and a debugger all seem like candidates that would help a wide swath of users

zwarich, to random
@zwarich@hachyderm.io avatar

Does anyone have a good solution for writing a recursive descent parser in C/C++ with the following constraints?

  • produces an ordinary heterogeneous AST
  • handles multiple errors (while being able to produce a partial syntax tree for the rest)
  • doesn't use exception handling or setjmp/longjmp

Whenever I crank something like this out, I feel like I'm missing something and writing too much code. I guess I could just use a morass of macros?

zwarich,
@zwarich@hachyderm.io avatar

@pervognsen I thought about it some more and this gets interesting when you combine it with your previously stated dislike of compound expressions. Defining separate test expressions get very similar to what you mentioned in the other sub-thread about defining local blocks with control effects.

glaebhoerl,

@pervognsen @zwarich It's also interesting how "silly newbie instincts", like if (thing == true) { ... } in this case, sometimes point to something deeper.

zwarich, to random
@zwarich@hachyderm.io avatar

My code after learning how unions interact with the C memory model: https://github.com/rui314/chibicc/blob/90d1f7f199cc55b13c7fdb5839d1409806633fdb/chibicc.h#L228-L291

zwarich,
@zwarich@hachyderm.io avatar

@foonathan There are minor issues, but the biggest one by far is the “visible union rule” from N685:
https://www.open-std.org/jtc1/sc22/wg14/www/docs/n685.htm
The related GCC issue is a perennial source of amusement:
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65892
While even the most charitable interpretations of the rule have the property that adding a type declaration with no uses affects codegen, the most conservative interpretations render TBAA useless.

foonathan,
@foonathan@fosstodon.org avatar

@zwarich Oh, that's nice :D

zwarich, to random
@zwarich@hachyderm.io avatar

@graydon Do the results of the .NET green threads experiment make you feel somewhat vindicated?
https://github.com/dotnet/runtimelab/issues/2398
Unless I am mistaken, .NET (via F# and then C#) is the source of the contemporary async/await model.

pkhuong,

@pervognsen Right, from what I've seen of embedded coding, I'd expect the designers to have a static hard bound on the stack size, and provision based on that, green threads or not.

zwarich,
@zwarich@hachyderm.io avatar

@pervognsen @graydon In the original .NET context, most of those problems have easier solutions due to the existence of a GC’d runtime, at least until you hit the FFI.

zwarich, to random
@zwarich@hachyderm.io avatar

We need a systems language that just gives up on undefined padding, makes padding bytes zero, and opens the door to a future of bytewise equality/hashing.

pervognsen,
@pervognsen@mastodon.social avatar

@foonathan @zwarich Ah gotcha, I didn't know that's what that meant. It seems doable to add zeroed padding with a derive macro. But yeah, I've always wanted (at least opt-in) well-defined padding in systems languages too.

foonathan,
@foonathan@fosstodon.org avatar
zwarich, to random
@zwarich@hachyderm.io avatar

I was chatting with matklad about PL design choices to improve tooling and he sent me this very informative post on the Garnet issue tracker: https://todo.sr.ht/~icefox/garnet/52#event-242650

zwarich,
@zwarich@hachyderm.io avatar

It looks like our discussions inspired a blog post: https://matklad.github.io/2023/08/01/on-modularity-of-lexical-analysis.html

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