Hacker Newsnew | past | comments | ask | show | jobs | submit | i_don_t_know's commentslogin

I’m not sure I fully understand but this seems to be the kind of problem that Ocaml functors solve. You program against an interface (signature) and you supply a concrete implementation (structure) when you want to run it. You can use different implementations in different parts of your application.

So maybe do something similar in Rust by expanding how you import and export modules?


The Haskell language report precisely defines how layout determines structure: https://www.haskell.org/onlinereport/haskell2010/haskellch10...

Any language that uses layout to determine structure should have a similarly precise definition.


I loved my Kosmos electronics kits. My mom threw out the kits eventually but I still have the manuals.

https://patric-sokoll.de/SonstigeSammlungen/Kosmos%20E200/Ha...

My first computer was their CP1. It was aimed at older children and teens. You programmed it in a custom assembly language. The manual included lots of projects and instructions on how to hook it up to their electronics kits.

http://www.8bit-homecomputermuseum.at/computer/kosmos_comput...

http://www.8bit-homecomputermuseum.at/computer/pictures/kosm...


Simon Peyton Jones's "The implementation of functional programming languages" has a chapter on the "Efficient compilation of pattern matching" (chapter 5 by Philip Wadler).

https://simon.peytonjones.org/assets/pdfs/slpj-book-1987-2up...


Also Xavier Leroy's ZINC paper (https://xavierleroy.org/bibrefs/Leroy-ZINC.html) although I believe that's no longer the implementation used by OCaml since it got replaced by an even more efficient one.


Probably Compiling Pattern Matching to Good Decision Trees (by Luc Maranget) is the scheme used by OCaml (http://moscova.inria.fr/%7Emaranget/papers/ml05e-maranget.pd...).

It explains how to minimize the decisions trees you obtain from a match statement, so you gain a ton of efficiency over a naive implementation, especially for large, multi-column matches.


Thanks! That was actually really good. His performance matches the emotions underlying the song.

Something all the covers of Behind Blue Eyes by The Who seem to miss is the slowly rising anger and frustration.


When I became interested in FPGAs recently, I read this book https://nostarch.com/gettingstartedwithfpgas

I bought a cheap FPGA board based on Lattice's ice40. There are free OSS tools to write, simulate, and install your Verilog/VHDL design onto the ice40.

It's probably a far cry from what a professional FPGA programmer does with Vivado etc but it might give you an inexpensive idea of the basics and if you want to pursue it.


Right; i already have looked into this (had gotten a FPGA board from Digilent with Vivado and a whole bunch of FPGA books a while ago) but have not done much with it. I generally like to read/learn different subjects for intellectual curiosity before looking at job/business/etc. opportunities using it.

What i was interested to know from the gp's comment is; what would it take today to actually get into this industry; how the current AI tools make it easy (if at all) and what one should concentrate on if one wants to approach Hardware Chip Design as a whole. The C++ SoC modeling articles i listed above were a great help for me to understand where my software skills could be of immediate value here. Since the gp seemed to be knowledgeable in this domain i was curious to know his take on the overall domain.


I thought this might be better captured in a blog post, so here you go: https://ednutting.com/2026/02/20/sw-to-digital-logic-design....

I think if I spent more than the last 90 minutes on this, I might come up with more detailed and nuanced opinions for you. Irrespective, hopefully this offers some useful thoughts.

Happy to continue the conversation here on HN.


Good introductory overview post.

However, most of it was already known and i was looking for something more specific/detailed given the OP article.

In the past i had worked on a custom SoC (on the software side) and had often interacted with the hardware designers to understand more of their domain. The first surprise was that most Verilog/RTL guys didn't know anything about software (not even assembly/C!) while of course embedded software guys (like myself) didn't know anything about HDLs. There was (and is) a very hard disconnect which is quite interesting. In the spirit of the OP article, the book i linked to actually shows a path via Vivado HLS for software folks to move into hardware design using their C/C++ programming skills. But i would like to see some hardware designer here validate that approach in the real-world. Especially now that you have powerful AI tools available to help you do stuff faster and easier.

With the rise of demanding AI/ML/Crypto applications, there is now a greater interest in designing new types of custom hardware requiring Hardware/Software Modeling(verification/benchmarking)/Co-Design/Co-Verification etc. They involve designing complete SoCs containing CPU/GPU/FPGAs based on specific designs. Given that hardware design is a universe of its own, not knowing the overall picture i.e. architecture/tools/methodologies/etc. makes it quite daunting for software folks to approach it.

PS: Maybe you can augment/create-new blog post with an actual case study based on your experiences on steps involved going from ideation to tapeout.


Chapter 9 and section 10.7 of this book show some interesting (and to me unexpected) uses of effects in Ocaml and how they compare to implementations based on monads:

https://lukstafi.github.io/curious-ocaml/new_book.html

The dscheck model-checker is another interesting application of effects: https://github.com/ocaml-multicore/dscheck


That books seems very interesting in general, thank you for sharing!

Then again, I am a bit skeptical since the author also credits Claude Opus 4.5 and GPT-5.2. Both models got released in November/December last year, which makes me wonder: Was this book written in only 2 months, i.e. mostly by AI?

EDIT: No. Turns out the book is much older and only recent changes were done with the help of LLMs, https://github.com/lukstafi/curious-ocaml/commits/main/?afte... .


Thanks, I've been meaning to delve into algebraic effects and it seems OCaml is the only mainstream language that actually implemented them.


mdx[1] is another variation on this, also in the Ocaml ecosystem. It’s Ocaml’s version of documentation tests as in Elixir and Rust.

But it’s not limited to that. You can write tests in markdown files independently from your documentation. Use “dune test” to run the tests and review failures with “git diff”. Accept the changes if they are correct (changed behavior) with “dune promote”. Very nice workflow.

[1] https://github.com/realworldocaml/mdx


I'm seconding the recommendation to look at Rodnay Zack's books. For example, I really enjoyed Advanced 6502 Programming. It's a project-based tutorial for a custom 6502 machine. The design and schematics are in the book.

https://archive.org/details/Advanced_6502_Programming/mode/2...


WRT advanced 6502 programming texts, allow me plug my (free) book "EOR #$FF: 6502 Ponderables and Befuddlements". It's 64 assembly snippets to ponder, with explanations for each in the 2nd-half of the book: https://archive.org/details/eor6502


Seconded. I bought the first edition of "Programming the 6502" way back in the neolithic, and I enjoyed it greatly. I even read parts of it again now and then these days too, just because I like it. I used to write assembly on, at first, the AIM-65, and later the Apple II.


Is Programming the 6502 enough to learn Assembly on the Apple II ? But it doesn't explain the memory and screen management, right ? So how can we learn that ?


Someone can correct me if I'm wrong, but I believe the screen memory of the Commodore machines (ViC-20, Commodore 64) were the most straight-forward. As opposed to the more janky Apple II memory map.

You could do a lot worse than picking up a new Commodore 64 Ultimate [1]. They're a more or less faithful remake of the Commodore 64 but have an HDMI port, SD card instead of disk drive, etc. You could learn BASIC, should be able move to assembly as well—a quick search pulled up a YouTube course on 6502 assembly for the Commodore [2].

(I realize I am not contributing "books"—but others have done well in this regard. I did want to share what I think is a pragmatic way to learn 6502.)

[1] https://www.commodore.net

[2] https://youtube.com/playlist?list=PLU1o_YShTPgoA7_nZ0PutqaPD...


For that you'll need Apple II documentation - though that's device-specific information. It's easy to find online, e.g. https://nicole.express/2024/phasing-in-and-out-of-existence...., but there's lots more with various levels of info. This one, for example: https://www.kreativekorp.com/miscpages/a2info/memorymap.shtm...

For actual 6502 programming you'll need a dedicated 6502 assembly programming book, for example the aforementioned Rodney Zaks books.


Is the Apple II Reference Manual good for that ? Or anything specific to the Apple II, like "What's Where in the Apple" or "Understanding the Apple II" ?


All of those are quite useful.



I’m not sure the people in Eastern Ukraine who have been “relocated” to Russia agree with your idea of “nothing changes except for the government”. I don’t think the people across Europe and Asia during World War II would agree either.

Your new government does not and cannot trust you. You pledged allegiance to your old country. Are you still secretly fighting for it? Or have you pledged allegiance to your new country? Does that mean anything when you betrayed your old country to whom you had pledged allegiance too? You’re a potential enemy and your new government will act accordingly.


Well I am talking about before a military conflict erupts. I’m talking about what is in the interest of the people, when they are looking at a potential military conflict.

In the case of Ukraine, being peacefully “relocated” to Russia seems much better than what is happening now. Before the war the reputation of the Ukrainian government was not much different from the reputation of the Russian government. If it were me as a Ukrainian in that situation I would not be in favor of fighting.

Now Poles “relocating” to Germany without any conflict seems like it would not have ended well for them. Poles at that time violently resisting made sense. Refusing a land bridge agreement to avoid the need for violence, perhaps not, but resisting occupation, sure. But that is because the two governments at that time actually were very different, one being extremely ethno-centric. This does not really apply to America or Russia. If the Ukrainians were born in Russia nobody would notice, they are well within the ethnic cloud of the Russian state. Same with Canadians in America.

I don’t think allegiance to a nation means much these days. If anyone can move anywhere and not assimilate, who even really cares at that point? Should Canadians accept the human makeup of their nation changing quickly and drastically, no problem, but getting a different government is the end of the world? Doesn’t really make sense to me. Does make sense why governments put out propaganda to rile people up, though, since it is clearly in the interest of the government to resist in all such cases.


> Well I am talking about before a military conflict erupts. I’m talking about what is in the interest of the people, when they are looking at a potential military conflict.

When you’re looking at a potential military conflict, you’re looking at a hostile foreign government that’s openly threatening you. What reasons do you have to believe that they will be friendly and that life will go on as usual after you have surrendered?

The foreign government cares about your land, resources, industry, strategic location, etc. They do not care about you, the people. Otherwise they would encourage you to move to them.

> In the case of Ukraine, being peacefully “relocated” to Russia seems much better than what is happening now.

Would it be better though? The Ukrainian government was/is far from perfect. But it’s the government they chose, it’s not an authoritarian one (it tried to be which led to the Maidan protests). They chose to be an independent country and in control of their own destiny. They don’t want to subject themselves to an authoritarian foreign government and they consider that to be in their best interest.


> What reasons do you have to believe that they will be friendly

Why wouldn’t they be? Like in the case of Ukraine/Russia there is no large ethnic or cultural divide, and in America we don’t believe in that kind of thing mattering anyway, right?

The Russians have no reason for animosity towards the Ukrainian people as far as I can tell. Unlike, say, the Ottomans invading Europe. And especially if they signed a deal through negotiation prior to any violence.

I am not an expert in the area of Ukrainian/Russian history, so I base my position on all the arguments I have seen others make across the full spectrum, and I have seen zero people arguing from any such basis aside from vague allusions to nationalism. Like what makes the Ukrainians different from any of the bazillion other smaller groups that used to exist before they got smooshed into Russia? Is it rational to risk everything to not end up like them? Is where you ended up that much better? And anyway it’s not personal, your government has just gotten too friendly with the Americans, comrade. Etc. I don’t see any other argument for what is happening other than blind obedience to a government that is probably not being totally honest to the people about its motives (just think about how many times that happened during the world wars, that we concretely know about).


  What if the new government also imply that you have to change our religion? What if the new government does not believe in "free enterprise" and will TELL you which company you will work for. What if the new government change the sports teams you like? What if the new government change the language you speak. 

  See for the example https://en.wikipedia.org/wiki/Alsace#Timeline  . Notice how the official language suddenly changes when a new "government" from a different nation take over. Are you so sure that the French Canadians will not have a problem with suddenly English potentially been the official language?


My mother hosted and taught French to half a dozen eastern refugees over 20 years, from Chechnya, Georgia, Kazakhstan and a few Tatars from Russia. Russia is very ethnocentric. Not Nazi level ethnocentric, but what you would expect from a person from an empire from the last 19th century.


So much that is either wildly naive, or willfully disinforming, here.

> In the case of Ukraine, being peacefully “relocated” to Russia seems much better than what is happening now.

Provably false: People are risking their lives to avoid that.

No one outside of Russia (except perhaps you and Trump) ever believed Russia wouldn't pursue cultural genocide.

> Before the war the reputation of the Ukrainian government was not much different from the reputation of the Russian government.

What has the international reputation of a government got to do with... anything? "Oh well, no one can tell us apart from Russia, so we might as well sell our children and be sent to work camps voluntarily."

Also, that was dead wrong.


Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: