Reddit Programming
211 subscribers
1.22K photos
126K links
I will send you newest post from subreddit /r/programming
Download Telegram
https://www.reddit.com/r/programming/comments/1qi0soq/par_language_update_crazy_if_implicit_generics/

<!-- SC_OFF -->Thought I'd give you all an update on how the Par programming language (https://github.com/faiface/par-lang) is doing. Par is an experimental programming language built around linear types, duality, automatic concurrency, and a couple more innovations. I've posted a video called "Async without Await" (https://www.reddit.com/r/programming/comments/1p0goii/what_if_everything_was_async_but_nothing_needed/?utm_source=share&utm_medium=web3x&utm_name=web3xcss&utm_term=1&utm_content=share_button) on this subreddit and you guys were pretty interested ;) Recently, we've achieved 3 major items on the Current Roadmap (https://github.com/faiface/par-lang/issues/127)! I'm very happy about them, and I really wonder what you think about their design. Conditions & if Read the full doc here. (https://faiface.github.io/par-lang/quality_of_life/if.html) Since the beginning, Par has had the either types, ie. "sum types", with the .case destruction. For boolean conditions, it would end up looking like this: condition.case { .true! => ... .false! => ... } That gets very verbose with complex conditions, so now we also have an if! if { condition1 => ... condition2 => ... condition3 => ... else => ... } Supports and, or, and not: if { condition1 or not condition2 => ... condition3 and condition4 => ... else => ... } But most importantly, it supports this is for matching either types inside conditions. if { result is .ok value => value, else => "", } And you can combine it seamlessly with other conditions: if { result is .ok value and value->String.Equals("") => "", result is .ok value => value, else => "", } Here's the crazy part: The bindings from is are available in all paths where they should. Even under not! if { not result is .ok value => "", else => value, // !!! } Do you see it? The value is bound in the first condition, but because of the not, it's available in the else. This is more useful than it sounds. Here's one big usecase. In process syntax (somewhat imperative), we have a special one-condition version of if that looks like this: if condition => { ... } ... It works very much like it would in any other language. Here's what I can do with not: if not result is .ok value => { console.print("Missing value.") exit! } // use `value` here Bind or early return! And if we wanna slap an additional condition, not a problem: if not result is .ok value or value->String.Equals("") => { console.print("Missing or empty value.") exit! } // use `value` here This is not much different from what you'd do in Java: if (result.isEmpty() || result.get().equals("")) { log("Missing or empty value."); return; } var value = result.get(); Except all well typed. Implicit generics Read the full doc here. (https://faiface.github.io/par-lang/types/implicit_generics.html) We've had explicit first-class generics for a long time, but of course, that can get annoyingly verbose. dec Reverse : [type a] [List] List ... let reversed = Reverse(type Int)(Int.Range(1, 10)) With the new implicit version (still first-class, System F style), it's much nicer: dec Reverse : [List] List ... let reversed = Reverse(Int.Range(1, 10)) Or even: let reversed = Int.Range(1, 10)->Reverse Much better. It has its limitations, read the full docs to find out. New Runtime As you may or may not know, Par's runtime is based on interaction networks, just like HVM, Bend, or Vine. However, unlike those languages, Par supports powerful concurrent I/O, and is focused on expressivity and concurrency via linear logic instead of maximum performance. However, recently we've been able to pull off a new runtime, that's 2-3x faster than the previous one. It still has a long way to go in terms of performance (and we even known how), but it's already a big step forward. <!-- SC_ON --> submitted by /u/faiface (https://www.reddit.com/user/faiface)
Optimizing satellite position calculations with SIMD and Zig
https://www.reddit.com/r/programming/comments/1qibtpn/optimizing_satellite_position_calculations_with/

<!-- SC_OFF -->A writeup on the optimization techniques I used to hit 11M+(~7M w python bindings) satellite position calculations per second using Zig. No GPU, just careful memory access patterns <!-- SC_ON --> submitted by /u/Frozen_Poseidon (https://www.reddit.com/user/Frozen_Poseidon)
[link] (https://atempleton.bearblog.dev/i-made-zig-compute-33-million-satellite-positions-in-3-seconds-no-gpu-required/) [comments] (https://www.reddit.com/r/programming/comments/1qibtpn/optimizing_satellite_position_calculations_with/)
Collaborative editing with AI is really, really hard
https://www.reddit.com/r/programming/comments/1qif79w/collaborative_editing_with_ai_is_really_really/

<!-- SC_OFF -->When I started working on this, I assumed it was basically a solved problem. But when I went looking to see how other products implemented it, I couldn't actually find anyone that really did full-on collaborative editing with AI agents. This post is basically the notes that (I hope) are useful for anyone else who wants to build this kind of thing. <!-- SC_ON --> submitted by /u/hausdorff_spaces (https://www.reddit.com/user/hausdorff_spaces)
[link] (https://www.moment.dev/blog/collab-with-ai-is-hard) [comments] (https://www.reddit.com/r/programming/comments/1qif79w/collaborative_editing_with_ai_is_really_really/)
Flutter ECS: Performance Optimization & Profiling
https://www.reddit.com/r/programming/comments/1qinnyc/flutter_ecs_performance_optimization_profiling/

<!-- SC_OFF -->Hey all! I just published Part 4 in my Flutter ECS series on Medium focusing on how to optimize performance and profile your app when using an Event-Component-System architecture. If you’re building Flutter apps with ECS (or curious about it), this article breaks down practical patterns that help you avoid wasted work, reduce rebuilds, and make performance a design feature not an afterthought. In this post, you’ll learn: - Why single responsibility systems make performance tuning easier - How reactsTo, interactsWith, reactsIf / executesIf influence performance - Practical ECS profiling strategies to pinpoint bottlenecks - Component update controls (force, notify) that help batch or silence changes - How ECS surfaces performance issues you’d otherwise miss in widget centric code This is Part 4 of my series; if you missed the earlier posts, they cover rethinking state management, async workflows, and testing ECS systems. Read the full article here: https://medium.com/@dr.e.rashidi/flutter-ecs-performance-optimization-profiling-e75e89099203 If you try any of the techniques or want feedback on using ECS in your project, drop your thoughts below! 😊 <!-- SC_ON --> submitted by /u/_Flame_Of_Udun_ (https://www.reddit.com/user/_Flame_Of_Udun_)
[link] (https://medium.com/@dr.e.rashidi/flutter-ecs-performance-optimization-profiling-e75e89099203) [comments] (https://www.reddit.com/r/programming/comments/1qinnyc/flutter_ecs_performance_optimization_profiling/)
WSL Dashboard v0.1.0 Released,A modern, high-performance, and lightweight WSL (Windows Subsystem for Linux) instance management dashboard.
https://www.reddit.com/r/programming/comments/1qir79v/wsl_dashboard_v010_releaseda_modern/

<!-- SC_OFF -->Built with Rust and Slint for a premium native experience. Key Features Intuitive GUI with dark mode support and smooth animations. One-click management for all your WSL distributions (Start, Stop, Terminate, Unregister). Quick access to distribution terminals, VS Code, and File Explorer. Real-time WSL instance status monitoring and display. Export and backup to .tar or compressed .tar.gz archives. Import and clone instances from backups or existing distributions. Relocate large WSL instances (VHDX migration) to other disks to save C: drive space. Smart distribution installation from Microsoft Store or GitHub. Built-in RootFS download helper for manual installs. Detailed insights into VHDX file location, virtual disk size, and actual disk usage. The software supports multiple languages: English, Simplified Chinese, Traditional Chinese, Japanese, French, Spanish, Russian, Portuguese, German, Italian, Turkish, Indonesian, Hindi, and Bengali. https://github.com/owu/wsl-dashboard If you find this open-source project useful, please star it on GitHub. Thank you very much! <!-- SC_ON --> submitted by /u/freecalf (https://www.reddit.com/user/freecalf)
[link] (https://github.com/owu/wsl-dashboard) [comments] (https://www.reddit.com/r/programming/comments/1qir79v/wsl_dashboard_v010_releaseda_modern/)
Building a Multi-Tenant Metrics Pipeline for Thousands of Clients (with Thanos)
https://www.reddit.com/r/programming/comments/1qiuq77/building_a_multitenant_metrics_pipeline_for/

<!-- SC_OFF -->Last big project I did at my last position. It was a lot of fun and I wanted to do a high-level blog post on how it worked. <!-- SC_ON --> submitted by /u/jrobbproj (https://www.reddit.com/user/jrobbproj)
[link] (https://jamesrobb.ca/projects/metrics_pipeline/) [comments] (https://www.reddit.com/r/programming/comments/1qiuq77/building_a_multitenant_metrics_pipeline_for/)
Why Naive SPSC Queues Fail - A Step-by-Step Walkthrough
https://www.reddit.com/r/programming/comments/1qivp66/why_naive_spsc_queues_fail_a_stepbystep/

<!-- SC_OFF -->I put together a short video series that walks through building a single-producer / single-consumer queue from scratch. The current videos cover: • a naive SPSC implementation • why it seems correct • where it breaks down (cache effects, memory ordering assumptions) The next step will be evolving this into a lock-free design, but I wanted to share the reasoning process first since that’s usually glossed over. Feedback from people with real-world concurrency experience would be very welcome. https://youtube.com/playlist?list=PLHricCAtcO58\\\_4dKgQOzIT6rl9ke5vS1w&si=3NBWV9fsrlKHnylV (https://youtube.com/playlist?list=PLHricCAtcO58%5C%5C%5C_4dKgQOzIT6rl9ke5vS1w&si=3NBWV9fsrlKHnylV) <!-- SC_ON --> submitted by /u/okay_vss (https://www.reddit.com/user/okay_vss)
[link] (https://youtube.com/playlist?list=PLHricCAtcO58_4dKgQOzIT6rl9ke5vS1w&si=3NBWV9fsrlKHnylV) [comments] (https://www.reddit.com/r/programming/comments/1qivp66/why_naive_spsc_queues_fail_a_stepbystep/)
Two Catastrophic Failures Caused by "Obvious" Assumptions
https://www.reddit.com/r/programming/comments/1qj00yq/two_catastrophic_failures_caused_by_obvious/

<!-- SC_OFF -->Both incidents involve smart people doing reasonable things and systems behaving exactly as designed. Mars Climate Orbiter (1999): lost because one team used Imperial units and the other used Metric. Citibank $500M error (2020): a routine interest payment turned into a principal transfer due to ambiguous UI labels. The problem wasn’t complexity but "meaning" that existed only in people’s heads. This is a breakdown of how assumptions turn into catastrophic technical debt. <!-- SC_ON --> submitted by /u/Vast-Drawing-98 (https://www.reddit.com/user/Vast-Drawing-98)
[link] (https://open.substack.com/pub/alexanderfashakin/p/make-it-make-sense-nobody-clicked-the-wrong-button?utm_campaign=post-expanded-share&utm_medium=web) [comments] (https://www.reddit.com/r/programming/comments/1qj00yq/two_catastrophic_failures_caused_by_obvious/)