logoalt Hacker News

gokyesterday at 4:46 PM5 repliesview on HN

The real lesson here should be that doing crazy shit like swizzling the program counter in a signal handler and writing your own assembler is not a good idea.


Replies

themafiayesterday at 6:33 PM

Neither of those are "crazy shit." It's just complex because the environment offers specific features like automatic GC with async preemption in a compiled language which pretty much requires it.

Complex engineering isn't something to be avoided by default.

achieriusyesterday at 7:16 PM

Sorry, how exactly do you think compilers are supposed to work if not by 'writing [their] own assembler'? Someone has to write the assembler, and different compilers have different needs.

platinumradtoday at 12:26 AM

Those are both completely normal things to do when you're implementing a programming language. For example, the Hotspot JVM uses SIGSEGV to stop the world for garbage collection.

wat10000yesterday at 5:43 PM

The general wisdom is that you shouldn't do this stuff yourself, and you should instead rely on tried and tested implementations. But sometimes you're the one who provides the tried and tested implementations. Implementing a compiled language is often one of those times.

blinkingledyesterday at 5:14 PM

This^. Keith W on Dtrace blog said it a decade ago https://wesolows.dtrace.org/2014/12/29/golang-is-trash/

I like Go but I don't really like their NIH / replace everything with our stuff stance - esp on system tools like assemblers and linkers.