Incidentally this falls in the 'sort an then pick the middle' because the original text says nowhere that is must be a n*log(n) sort and what I described here is essentially the same but with counting sort (and a couple redundant steps removed).
344 karma · joined July 8, 2020
Incidentally this falls in the 'sort an then pick the middle' because the original text says nowhere that is must be a n*log(n) sort and what I described here is essentially the same but with counting sort (and a couple redundant steps removed).
Example: I recently executed `git checkout .` (that incidentally would not be caught by this project) on the wrong repo. Oh the pain. But I would have probably confirmed the "captcha" blindly as I really wanted to execute that... just not on that repo.
I guess you can make an argument that the best way to get an array sorted is to have the array already sorted, but that sounds as "the best way to calculate the length of the hypotenuse is to just measure the hypotenuse, and Pythagoras never realized it was a problem upstream".
- System.Diagnostics.Debug.Assert (on debug builds)
- Envinroment.FailFast (this is precisely what panic! is usually used for)
- void BlowUp() { BlowUp(); }
But, in reality, any unexpected Exception: how would you properly handle an unexpected NRE or index out of bounds? Either swallowing the exception (bad) or aborting.
Why I did it: in 2013-2014 I was SUPER bored and burned-out, I needed a challenge and I picked that one. Oh, I was wrong.
The GOOD: the challenge has been fun, I learned A LOT. I learned how to use ANTLR, and then I learned that ANTLR was getting in the way and now I'm wary of ever using a parser generator at all, for sure not that one. I learned how to write a recursive descent parser, even if I did it by reversing engineering (i.e. mostly copying) the original rd-parser of puc Lua. And I learned that no matter what I do, what I find the hardest is respecting the correct operator priority in math expressions. I know that shouldn't be the hardest thing, but brains are fun. It also ended up getting used. It was used in the OnePassword client for windows, and it's for sure used in the Shenzen IO and TIS-100 videogames. I'm sure there are many more users using that. It's stuck somewhat in between of "nobody uses it" and "it has enough traction that the community will take it forward and you can forget it even existed", and that, turns out, is not a great place to be.
The BAD: I picked C#, as that's the language I was using at the time and I had an interest in seeing it used in Unity. Big mistake. Don't get me wrong: C# is a great language and if you're planning to base your company on it, I don't see big reasons not to (I wouldn't, probably, but every language has its pros and cons). But C#, and in 2014 to boot, was a mistake for such a project. First, however multiplatform C# became, a lot of development is still Windows only (at least, if you want to target the main frameworks). And second, 2014 is precisely the year when C# started changing radically with the core / standard frameworks. The situation now is probably more stable, but in 2014/2015 it was a mess, and half of the reflection frameworks were broken to say the least.
The UGLY: I just didn't consider how much punches life can hit your face with. I changed job, twice. Changed platform from Windows to MacOS, to Linux, to MacOS again, now I program for multiple platforms in Rust most of the time, and my interest in C# is close to non-existent. Family members passed away, new kids were born, situations changed, and life hit me hard enough. Energy got focused on daily jobs, or on other side projects. Every other side project, by the way, has been met with humongous amounts of guilt, because I'm/was leaving moonsharp users (however few they might be) behind.
So where I'm now? I tried to delegate the project to other people, but I'm not effective at it (maybe they are, but in reality, I'm just absent). I tried to get back active into the project but failed a couple of times and now I fear doing it again and creating expectations. Sometimes I feel like contributing something, but I can't even get a proper dev setup running. I don't remember details well enough to not break something when fixing major bugs, nothing major but usually it goes over the amount of energy that I would like to spend. Sometimes I read some question on MoonSharp, and I try to answer, but more often I read a question and before answering I have a guilt trip because I'm answering to this question and left alone all the others and so I simply avoid this one too.
Most of all, the project is not aligned anymore to my interests, so it feels like a chore.
So, if you are reading this: think twice before making the same mistake. If you want a side project, pick one that is either small, or has a clear end to it.
I'm sure it has a lot of corner cases as a feature, but that would be super-useful as companion tool to jq.
This, incidentally, also helps fellow humans reading the code who'll see that it's all intentional and won't flip with "wtf why does it XOR in an add method?" even if just for a second.
The selection included all common S3 models, and you just had to have one S3 graphic card to be compatible, and they were already dirt cheap. It was AMAZING.
This was the real killer feature (most of the time I didn't even have one IP address because dial-up internet was expensive).
It was a HUGE upgrade.
First, 12Mhz to 40Mhz was an amazing upgrade, but that was definitely not the reason why I upgraded.
The real reason was *compatibilityé.
The 286 was compatible with close to nothing by the early 90's. Doom? Sure, runs slow on the 386sx, but on the 286? Does not run at all. And the same goes for all games and programs using one of: 1) 32 bit DOS extenders 2) EMS 3) any amount of XMS more than my 286 could handle 4) >600KB conventional memory, because there's only that much HIMEM.SYS can do 5) Windows 3.0 in 386-enhanced mode
He was denied an operation at the bank once, but was quickly able to clarify the issue and unblock it (probably he got lucky).
But he had to have himself removed from the white pages and the ring label (ring label? whatever, il citofono :D) because of violent threats.
As far as orthogonality goes, it seems to be pretty orthogonal to different kind of uses, I'm not sure why you're saying it's not.
On simplicity it's definitely not simple, but given the problems it is trying to solve it's probably as simple as it could be.
I'm genuinely interested in what aspects you think are (or were) not implemented properly.
I wrote most of the implementation of quiche's datagram extension and, well, if there's something that can be improved, I'm all for it.
(aside: I think the standard should've considered an option for datagrams to opt-out of congestion control, given that most applications which want to take control over datagram sending probably also want to take control of available bandwidth and control congestion differently - e.g. by dropping encoding bitrate instead of queuing - but it is what it is).
The 8080 had 64KB address space. I bet the rationale was to partition memory so that classic memory usage goes upwards from 0000 to FFFF and the stack goes downwards from FFFF to 0000. This removes the need to define a boundary between the two beforehand.
Of course this is totally speculation on my part, I might be super wrong.
Most operating systems and standard libraries have checks and countermeasures to make this a lot harder nowadays, but still.
The complete cases for the choices is:
Problem-1:
1) You pick goat#1, Monty opens goat#2
2) You pick goat#2, Monty opens goat#1
3) You pick car, Monty chooses a goat of his liking
Problem-2: 1) You pick goat#1, Monty opens goat#2
2) You pick goat#2, Monty opens goat#1
3) You pick car, Monty opens goat#1
4) You pick car, Monty opens goat#2
5) You pick goat#1, Monty opens car
6) You pick goat#2, Monty opens car
We know Monty didn't pick a car, that reduces it to:Problem-1:
1) You pick goat#1, Monty opens goat#2
2) You pick goat#2, Monty opens goat#1
3) You pick car, Monty chooses a goat of his liking
Problem-2: 1) You pick goat#1, Monty opens goat#2
2) You pick goat#2, Monty opens goat#1
3) You pick car, Monty opens goat#1
4) You pick car, Monty opens goat#2
Or, 1/3 for Problem-1, 2/4 (=1/2) for Problem-2It's a Conditional Probability of non independent events.
Problem-2: "You pick a door. Monty opens a door at random, which just happens to be a goat. Calculate probability of winning if staying."
Both are conditional probability P(A|B) (that is, probability of A happening, under the assumption B has happened).
- A is probability of picking the correct door at the first try (or switching if you prefer)
- B is the probability that Monty picked a door with a goat
P(A|B) is defined as: P(A|B) = P(A and B) / P(B)In both problems P(A) is 1/3.
In Problem-1, P(B) is 1 because Monty knows and it's not a random event and P(A and B) = P(A), so P(A|B) = P(A)*P(B)/P(B) = P(A) = 1/3.
In Problem-2, P(A) is 1/3, P(B) is 2/3, P(A and B) is 1/3 (if you pick a car, Monty is guaranteed to pick a goat), so P(A|B) = 1/3 / 2/3 = 1/2.
(seriously, this is a game changer for me, thanks!)
Jokes aside, and not to boast about what I did, honestly, but Lua is (in hindsight - I wish I realized before) full of gotchas which are definitely not easy to implement (just one word which still makes my stomach hurt: COROUTINES).
I honestly think there are simpler (and better) languages to target. With hindsight, experience and pain, of course.
But "it works differently every time I try" wouldn't have made a good CSS joke. Oh, wait.
...which kinda reflects "things I wish about CSS", so 10/10.