Readit News logoReadit News
finiteparadox commented on Multi-Stage Programming with Splice Variables   tsung-ju.org/icfp25/... · Posted by u/matt_d
gsliepen · 2 months ago
> With staging you get to control exactly what gets inlined/partially evaluated.

I want to stress that this is not true. Sure, sometimes it might work, but compilers can also uninline, as well as reorder the way things are evaluated. Compilers don't do a 1:1 mapping of lines of code to assembly instructions anymore; instead they are designed to take your program as input, and generate the best executable that has the same observable effect as your code. So whatever optimization you perform in the source code, it is going to be very brittle as well wrt to seemingly harmless compiler changes (like changing compiler flags, updating the compiler to a new version, and so on).

While indeed nothing is guaranteed, at this point in time the compiler is vastly better at optimizing code than humans are. If you want to make a point that multi-stage programming helps optimize code, you have to do much better than an example of raising x to some power.

finiteparadox · 2 months ago
I think you are missing the point a bit. With staging you can build up arbitrary levels of compile time abstractions and be sure that they will not appear in the final executable. Of course, an optimising compiler will reorder/rearrange code regardless. But it won't reintroduce all the abstraction layers that have been staged away. After enough abstraction layers, without staging even a compiler that optimises aggressively won't know to evaluate them away.

Let's put it another way: do you think there is utility in macros at all? And do you think that type safe code is better than untyped code? If you say yes to both, you must also think that staging is useful, since it basically gives you type safe macros. Now lots more things can be macros instead of runtime functions, and you don't need to deal with the ergonomic issues that macros have in other languages. For a more real world example, see Jeremy Yallop's work on fused lexing and parsing.

finiteparadox commented on Multi-Stage Programming with Splice Variables   tsung-ju.org/icfp25/... · Posted by u/matt_d
gsliepen · 2 months ago
> For example, instead of a power function that uses a loop, you could generate specialized code like x * x * x * x * x directly. This eliminates runtime overhead and creates highly optimized code.

This is misguided. For decennia now, there is no reason to assume that hand-unrolled code is faster than a for-loop. Compilers optimize this stuff, and they do this even better than mindlessly multiplying x by itself. For example, raising x to the power 6 only needs 3 multiplications, see for example: https://godbolt.org/z/Edz4jjqvv

While there are definitely use cases for meta-programming, optimization is not one of them.

finiteparadox · 2 months ago
The point is that compiler optimisations are a black box and not guaranteed. They can be very brittle wrt to seemingly harmless source changes (even something as simple as making an extra intermediate assignment). You are at the mercy of the 'fuel' of the optimisation passes. With staging you get to control exactly what gets inlined/partially evaluated. Of course, to get good results you need to know what to optimise for.
finiteparadox commented on Show HN: I'm building an app to replace Overleaf and Notion    · Posted by u/WolfOliver
jkhdigital · 3 months ago
I started a PhD in 2020 and I know exactly why you created this app because I tried like half a dozen different tools that didn’t fit. I needed a workflow to

1. collect and prioritize relevant research papers

2. make notes and synthesize ideas across my reading

3. use the notes to assemble draft of original writing

4. seamlessly move my own writings into LaTeX documents along with citation details

and ended up in Obsidian where I basically had to build my own tool anyway. Which I never did, because I just wanted to focus on research without fooling around with tools.

finiteparadox · 3 months ago
This sort of flow works well for me with obsidian+paperpile+latex

Dead Comment

finiteparadox commented on Austral: A Systems Language with Linear Types and Capabilities (2022)   borretti.me/article/intro... · Posted by u/yamrzou
rixed · 6 months ago
I love this project and particularly its documentation.

But:

> Design Goals

> - Simplicity (...) is the amount of information it takes to describe a system.

> (...)

>

> Anti-Features

> - There are no exceptions

>

> (Error handling etc. omitted for clarity.)

At first sight, error handling is going to be laborious in this language. I wonder what's the state of the art in PL theory regarding error handling in a context without automatic resource management. Anything better than manual bubbling up of errors up the chain of callers until one takes responsibility?

finiteparadox · 6 months ago
A combination of staging and effects might be a candidate. Any other candidate will probably be staging + X.

https://se.cs.uni-tuebingen.de/publications/schuster19zero.p...

Deleted Comment

finiteparadox commented on There’s no such thing as a tree phylogenetically (2021)   eukaryotewritesblog.com/2... · Posted by u/dynm
photochemsyn · 3 years ago
Humans care about wood, so they made tree (thing which produces wood) a category, as it can be used to build bridges, ships and other structures. Wood being dense also made it a better feedstock for charcoal (one can use grass, however).

As far as why trees don't seem to evolve into grasses, (or grasses into trees), it might be all about C3 vs C4 carbon metabolism, the latter being a complex structural system that pre-concentrates atmospheric CO2 before feeding it into the photosynthetic biochemistry (which is the right way to do artificial photosynthesis as well). This is apparently difficult to do in trees?

https://pubmed.ncbi.nlm.nih.gov/32409834/

> "Since C4 photosynthesis was first discovered >50 years ago, researchers have sought to understand how this complex trait evolved from the ancestral C3 photosynthetic machinery on >60 occasions. Despite its repeated emergence across the plant kingdom, C4 photosynthesis is notably rare in trees, with true C4 trees only existing in Euphorbia."

And here we have the world's largest Euphorbia:

https://www.wikidata.org/wiki/Q5851367

finiteparadox · 3 years ago
If tree is a category, does it have limits?
finiteparadox commented on HypeScript: Simplified TypeScript type system in TypeScript's own type system   github.com/ronami/HypeScr... · Posted by u/kerneloops
finiteparadox · 3 years ago
Incredible, one would expect this to be theoretically possible since Typescript's type system is Turing complete, but it is certainly different to see it done in practice. Wow!
finiteparadox commented on Why asynchronous Rust doesn't work   theta.eu.org/2021/03/08/a... · Posted by u/tazjin
bullen · 5 years ago
I'll repeat this until my karma is zero: Erlang, Rust and Go have simple memory models and cannot do Joint (on the same memory) Parallelism efficiently.

They are only fragmenting development.

In my opinion there are only two programming languages worth mastering: C+ (C syntax compiled with cl/g++) on client and Java SE (8u181) on server. That said C++ (namespaces/string/stream) and JavaScript (HTML5) can be useful for client/web.

All other languages are completely garbage! Not only do they have huge opportunity cost, but they make it harder for this civilization to be useful long term!

We have linux/windows and C/Java, instead of making another language in C, make something useful that is open-source instead!

Edit: Most downvoters here will be technology naive; they think everything gets better for eternity, but in reality everything hits it's peak at some point and electron processors and their OS/languages have now explored all viable avenues. Accept that and stop wasting time!

finiteparadox · 4 years ago
This is just plain wrong. There's nothing you can do in C/C++ (or C+, as you put it) that you can't in rust, when it comes to parallelism. There's always unsafe if you really need it.

u/finiteparadox

KarmaCake day3October 29, 2019
About
what can i say
View Original