I guess the good news is that this level of dysfunction should take care of the other Electron issues all by itself if we just wait a little while.
228 karma · joined November 3, 2018
I guess the good news is that this level of dysfunction should take care of the other Electron issues all by itself if we just wait a little while.
What could also be taken into account is that I used to be up there preaching the static typing gospel. And then I gradually got fed up with the ceremonies, since they didn't pull their own weight and couldn't keep up.
It's all compromises. The claim is that in return for following rigid rules, they guarantee this and that. Sort of the same deal the state has pushed down our throats since forever. And for a while it seems reasonable, until you pull hard enough to notice the chains around your ankles.
Can't do it any more, I have no more fucks to give about saving the world and awesome profits.
I occasionally smoke Nicotiana Rustica, or farmers tobacco; which is plenty stronger than regular tobacco. And it's less addictive, even helps some people to quit because their bodies finally get all the nicotine they've been craving. And not surprisingly it's forbidden to sell it in most countries.
Someone fucked around with regular tobacco, that seems pretty obvious from here. It's basically designed to hook you more effectively and make you sicker by raising the nicotine levels really quick and then dropping them like a stone.
Which I assume is exactly what they're doing with the vaping liquids/salts as well. Profits, returning customers; who gives a shit about the world?
There's nothing superior about these type systems, they're simply two of the most static and rigid systems in circulation right now.
Try writing C, Lisp and Forth until it clicks. Then we can sit down and have an informed discussion about missing features.
Maybe try to not identify so hard with language choice? That way you gain the capability of processing critique without loosing your marbles.
Then I wait, and wait; until I can't stand it any more, at which point I usually know enough to substantially improve the code.
Assuming it survived that long. Refactoring code that you're going to throw away is not very constructive. And the more effort put into making code pretty, the harder it will be to let go when that's the right thing to do.
None of this works in a corporate setting, where there's never enough time or money to do anything properly. There are no awesome short term profits to be made from prototyping and keeping code in good health. Corporations also usually prefer rigid rules over competence and intuition, which means whatever cure they come up with will be worse than the disease. And as a result, corporate code is usually crap code.
The people running this site though. The whole thing is designed to make life very difficult for anyone who steps out of line. And yes, it does seem to get worse and worse from here.
Allocating registers for all local vars statically means scopes have different sizes, which in turn complicates slab allocation and/or reuse. In return for being easier to reason about (except for the main scope issue) and saving space.
I opted for a fixed number of linearly assigned registers per scope in Snigl [0]; once the limit is reached, remaining variables are stored in a table. Which means I sort of get both, since additional scopes may be added using {} (it could make sense to add a scope: keyword to Python) if that becomes an issue.
It's all compromises, all the way down.
If that doesn't fit neatly into your delusions it's really not my problem.
[0] https://gitlab.com/sifoo/snigl/blob/master/src/snigl/pool.h
I'm grateful I didn't have to live through this as a teenager, it's a shark pool.
So how long do we keep pretending that allowing this to go on is a viable way forward?
Edit: While we're here; may I ask how you break out of the dispatch loop? Do you test an end-condition on each iteration? If that's the case, the longjmp trick might be worth trying. The condition will mostly be false, so it might make sense to pay more when it happens instead. You may find the essence of it in sgl_run at the bottom of sgl.c [0].
[0] https://gitlab.com/sifoo/snigl/blob/master/src/snigl/sgl.c#L...
Sometimes the reason no one finds a better solution for a long time is that no one believes it's possible. Let's say it's 50/50, believing it's possible is still the superior alternative.
I have no idea what Python uses for regular dispatch; the linked thread just says that their computed goto solution is faster, which comes as no surprise given that was the reason they switched.
I posted the link since I learnt a lot from it, and since it echoes my own experience.
I've implemented more or less the same interpreter using computed goto and various variations on dispatch loops; and this is the fastest solution I've managed to come up with, and the nicest code to work with. Still too many parameters, my point is that I have plenty of experience pointing in that direction which is better than nothing. It's not a mystery to me. Using computed goto will involve some kind of lookup to get the relevant labels, I'm using pointers to actual instructions as jump targets. And since I'm longjmp'ing out, which means I don't need a loop condition; the loop is reduced to a single regular goto.
Like I said, better than nothing. There is no such thing as perfection in this world. I've spent quite some time [0] micro benchmarking different features to get a fair comparison.
Just ask if you need help finding your way around.
My latest project [1] simply calls into a struct via a function pointer for each instruction. With a twist. Since it returns the pointer to the next operation and uses longjmp to stop the program, which means I can get away without lookups and without a loop condition. And as an added bonus the code is much nicer to deal with and more extendable, since the set of operations isn't hardcoded any more.
Comparing language performance is tricky business, but it mostly runs faster than Python3 from my tests so far. My point is that computed goto is not the end of the story.
I'll just add that there are many different ways to write a VM; the one posted here is very low level, the one linked below reasonably high level. Using physical CPUs as inspiration is all good, but there's nothing gained from pretending in itself unless you're compiling to native code at some point.
Still, it's just too many layers of complexity for my taste. Nailing performance problems in C is a Sunday walk in the park in comparison.
Live and let live, I was just sharing my experience of going back and forth.
How is this helping us go anywhere worth going?
I was talking about std::shared_ptr, which is the closest thing to reference counting that STL offers.
Manually referencing and de-referencing exactly when needed avoids most of this. Sometimes it's perfectly safe to pass the same reference through several layers without changing the number of references.
As an added bonus YOU get do decide which references, if any, need to support multiple threads.
I first came across Turbo C++ back in 1995; it was the third language I learned, several years before I started my C journey. But I've gradually come to the point where I consider C++ to be a bad compromise, period. For low level fundamentals, C works better; and for higher level code there are plenty of more convenient options.