Better HN
topnewbestaskshowjobs
Log inSign up

codr7

3,876 karma · joined Mar 28, 2019 (7y ago) · 2,562 submissions

codr7@protonmail.com
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

The user interface tends to be a relatively dynamic part of the application.

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

Before I learned Forth, I was very comfortable in Common Lisp. Now I miss the convenience when writing Forth and raw simplicity when writing Lisp.

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.

[0] https://github.com/codr7/cidk

comment 7y ago · link · parent

I was neck deep back in the days when the only acceptable API was SOAP. I still wonder if anyone actually designed their systems around that POS or if they all did the same thing we did, wrapped a sane protocol in umpteen layers of XML crap at the outer edge.

comment 7y ago · link · parent

Not that I want to interfere with your drawing practice, meaningful time away from the keyboard is essential. But have you considered raising the bar and stepping out of your comfort zone?

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.

[0] https://github.com/codr7/cidk

comment 7y ago · link · parent

Thank you.

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

I'm all for more people creating their own languages, we've been riding on Lisp for quite a while now and I'm sure that's not the final answer to anything.

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

But the mother would have most likely chosen otherwise given a chance.

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

You don't see a problem with aborting because of the "wrong" gender?

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

You can express mathematical abstractions in code, this doesn't imply that one is a subtype of the other. You can express a lot of things in code that have nothing to do with math.

comment 7y ago · link · parent

I did a quick re-implementation [0] taking these ideas into account. It also avoids assuming anything about inputs except iterating the key type and moves most functionality into Node to support more use cases.

[0] https://github.com/codr7/stash/blob/master/trie.cpp

comment 7y ago · link · parent

Very nice, had no idea.

Nodes it is then :)

Do you have any links to share describing the change?

Thanks!

comment 7y ago · link · parent

True enough, my mistake :)

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

He's also arguing that code is math, which is academic bullshit at it's finest.

comment 7y ago · link · parent

Like someone else mentioned, there's no need for Node pointers at all here, storing Nodes by value cuts away a decent chunk of complexity and should run plenty faster (especially when threads are linked).

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

Programming in academia has very little to do with software in general, maybe that's the disconnect.

comment 7y ago · link · parent

I was the most experienced developer and original author, that's a lot of knowledge. There was no one left who was motivated enough and it would have taken much longer than two weeks. I left plenty of documentation behind, but there are so many edge cases where having access to a brain that was involved in the process is invaluable.

comment 7y ago · link · parent

I once had a boss who asked me to spend my last two weeks writing down everything I knew after working there for 13 years and basically creating the entire 2Mloc system they were happily selling from scratch.

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

Haskell is definitely one of the languages that looks most like math. Being used to math, and solving math problems, I can certainly see how that's helpful.

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

Haskell and others have pretty much proved it's possible in practice as well. But from my experience the cure is worse than the disease. Wishing that software was as formal as math is one thing. Pretending it is leads nowhere worth going.

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

But why? Having to sweet talk the compiler into simply reading/writing data by building towers of super abstract mathematical concepts doesn't look like a win from here. If that's the cure, I'll take the disease.

comment 7y ago · link · parent

Not in any sense that matters here, no.

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

But Haskell isn't math, it's code dressed up in a math costume.

comment 7y ago · link · parent

It's not math, though.

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

Just don't let any true believers near it or they'll tear you a new one.

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

Damn right, these days it's about as true as G not doing evil.

comment 7y ago · link · parent

I am aware, Cobol wasn't standardized until 1970 though.

My point is that if you can implement Cobol, you can implement Pascal; and your users will be better off. Cobol has no inherent qualities from my experience that makes it a better choice.

comment 7y ago · link · parent

I once had a boss who was an old Cobol Cowboy, he walked me through a financial system that's still in use.

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.

1
808182
86