3,876 karma · joined Mar 28, 2019 (7y ago) · 2,562 submissions
2401.
Show HN: calcl – Programmatic Calculator(github.com ↗)
3 points · by codr7 · 7y ago · 2 comments
2402.
Show HN: cidk – Interpreter Devkit in C++(github.com ↗)
2 points · by codr7 · 7y ago · discuss
comment 7y ago · link · parent
Most of this is no longer as relevant in C++, can't speak for Rust. Programming languages have been converging for quite some time, C++ of today is more dynamic and convenient than any version that came before.
That being said, you can't beat dynamic languages for some tasks. Runtime code generation/eval being the most obvious I can think of. Any kind of extension/plugin architecture has everything to win from going all in with a full scripting language from my experience.
comment 7y ago · link · parent
I realize the problem isn't Forth, some people (such as the writer for example) are capable of pulling amazing feats for such a primitive tool.
But as a result, the programming languages [0] I've designed since have all been part Forth and part Common Lisp.
comment 7y ago · link · parent
I've been writing code for about 34 years. Finding interesting problems to solve was a major issue for me until I started creating my own programming languages [0].
It's possible that I'll eventually run into the same problem again, having said everything I have to say about languages. I figure can always write my own OS if nothing else works.
comment 7y ago · link · parent
The point of the message as a whole and the code I shared was the opposite, we need more of this. I included the second paragraph as a disclaimer, I didn't read the book because I don't read much these days but I've heard great things about it.
Nah, there's just no way to protect yourself against this these days. I did absolutely nothing wrong here. But if you're looking for trouble and something to project your self loathing on, you'll find it. Ask and you shall receive.
comment 7y ago · link · parent
Didn't read this one, I don't have much time to read these days. But we definitely need more hands on practical information to counter the avalanche of academic fluff out there, and many seem to enjoy Crafting Interpreters.
Having spent 34 years writing code and around three years full time designing my own languages, most other kinds of code make me fall asleep sitting up these days. Nothing really compares to controlling your world from the outside.
Lately I've been working on a stack machine devkit [0] to use as foundation for new languages, providing convenient access to most of what's needed and an integrated assembler to control it from the outside. The general idea is that you link the library and hook in a custom reader for your syntax, possibly embedded as a separate opcode. It's 5kloc of reasonable MIT-licensed code, small enough to own.
Feel free to have a look and I'll try to answer any questions.
[0] https://github.com/codr7/cidk
Edit: Was it the academic toes? Because I'm just sharing some code I wrote to help people get started designing their own languages. What did you do for others without expecting anything in return lately?
comment 7y ago · link · parent
The reason having a son is so important to them is that they're treated like shit and forced to work their ass off to survive.
None of this is fine, it all has to change if we want to go anywhere worth going.
comment 7y ago · link · parent
I don't know if you got the memo, but equal rights is a pretty Big Thing lately.
I'm pretty sure most mothers would have preferred to keep all their children, and a society without women isn't going very far.
comment 7y ago · link · parent
Just getting rid of the hash buckets and shared_ptrs would be a giant leap in the right direction.
Nice. I have no experience from absl, but I've sucessfully used sorted vectors to speed up these kinds of solutions on several occasions [0].
[0] https://github.com/codr7/cidk/blob/master/src/cidk/env.hpp
comment 7y ago · link · parent
I would consider switching the unordered_map to a sorted vector<pair<T, Node>>; or even better, move the key into Node and simply store as vector<Node>. Hash tables are relatively expensive to create in exchange for excellent performance for large tables, and you're creating a lot of tiny tables. A regular map would likely fall somewhere in between performance-wise since they're cheaper to create.
comment 7y ago · link · parent
comment 7y ago · link · parent
That's when I finally realized how much of a clue he really had.
And the reason I quit is that he gradually started chasing me around and micromanage my time even though I had been left alone to do my thing since forever, and pretty damn good too. But you can't measure the effect, and suits tend to measure what they can.
The effect of leaving was easier to measure, the company folded about a year later.
comment 7y ago · link · parent
Making the jump to stating that everyone would be better off coding math style, which is what some are desperately trying to pull off; doesn't make any sort of sense.
It's remarkable how far you can get within such a rigid and formal framework. But for most messy real world problems, there are better solutions. Lisp being the most powerful invented so far.
comment 7y ago · link · parent
I have most of my feet in the C++/Common Lisp camps these days. Where you accept that the world is a messy place with complex problems that don't fit neatly into labeled boxes, and use the most powerful tools you can think of to deal with it.
comment 7y ago · link · parent
There's no math equation for reading from a socket. Code is not math and math is not code. It's possible to sort of hide the fact by stacking enough abstractions on top, but in the end it's going to be the same old code that makes it happen.
comment 7y ago · link · parent
It's abstract reasoning, as is math. And that's about as deep as the similarities go.
Math can't deal with imperfect input and/or side effects without turning into something else. And code without real world side effects is useless, as is real world perfection.
comment 7y ago · link · parent
I've published plenty of Go code with a panic() here or there to handle fatal issues, and there's never a shortage of ignorant fools dropping in to lecture me.
If I'm not supposed to use it, why is it even in there? To tempt me? That would fit with the glorification of pain and boredom, I guess.
comment 7y ago · link · parent
I can't help but feel that even back in the days, they would have been better served by Pascal with fix point math. The only convenient features I could spot were related to working with records in files, and Pascal has that covered.
Their Cobol implementation sort of, kind of supported subroutines but they were such a pain in the ass that code was usually copy-pasted instead.
The only thing about Cobol that I just can't stand so far is the optional filler "keywords" that allows code to look sort of, kind of like natural language. That's just wrong.