My Delorean runs Perl
opensource.com
opensource.com
In Java, sorting objects based on arbitrary criteria doesn't require reflection. Just pass in a Comparator to one of the JDK-supplied sort methods. It's not awkward. I'm not a C++ programmer but I suspect it's similar.
std::sort(
myvec.begin(),
myvec.end(),
[](obj& A, obj& b) {
return A.attr < B.attr;
}
);Here's a file with a few different ways
https://gist.github.com/anonymous/78b4f257e60d55537b36e2e4f3...
std::sort(
myvec.begin(),
myvec.end(),
[](obj& A, obj& b) {
int A_attr1= dynamic_cast<Thing1*>(&A)? dynamic_cast<Thing1*>(&A)->attr1
: dynamic_cast<Thing2*>(&A)? dynamic_cast<Thing2*>(&A)->attr1
: -1;
int B_attr1= dynamic_cast<Thing1*>(&B)? dynamic_cast<Thing1*>(&B)->attr1
: dynamic_cast<Thing2*>(&B)? dynamic_cast<Thing2*>(&B)->attr1
: -1;
return A_attr1 < B_attr1;
}
);
and then compare that to @list= sort { ($a->{attr1} // -1) <=> ($b->{attr1} // -1) } @list;These days, anything I inflict on others in this category tends to be redone in Python, but for hacking? Perl just hits a sweet spot like no other language for me.
Perl6 has "feed operator", but it is not ported to perl5 to date. Perl6 syntax is clean:
my @array = <7 8 9 0 1 2 4 3 5 6 7 8 9>;
@array ==> unique()
==> sort()
==> reverse()
==> my @final-array;
say @final-array;
but perl6 is slow, so it is not gaining any popularity.If it fails, it would be fixed soon. The driver still has the window. I'm struggling to see how an immediate failure of speed readout etc would immediately endanger the car? Assuming it performs no control function.
It's true that you probably won't die immediately. But for most people, driving a long distance without a cluster display would be extremely dangerous. Especially at night on an empty road. For me, I start relying on the readouts for speed and rpm around the four hour mark. Tired brains don't work well.
Which means you probably have to get it fixed ASAP. If that happened more than a couple of times with a car, I'd sell the car / not buy it in the fist place.
They stopped making this car in 1983; it is far beyond it's design lifetime already, and was never a particularly reliable car to begin with, from my understanding. Like most classic cars, you probably shouldn't drive it unless you enjoy maintaining it, and are okay with (and carry substantial liability insurance for) a car that is dramatically less reliable and less safe than a modern car. Like most classic cars, you probably shouldn't drive it places where you are likely to die or otherwise suffer dramatically bad consequences if it breaks down. This isn't a criticism of the Delorian specifically as much as it is a truth about early '80s automotive engineering and running vehicles beyond their service life.
Of course, as a society, we've decided that this (tradeof off cool car vs danger) is a reasonable choice to make; we don't force people to buy newer cars because they are safer. Within this context, the addition of a special instrument panel seems to me like it's not adding substantial additional danger to the system.
Also it did really well in the crash tests of the 80's and current owners baby them, so the insurance is pretty cheap.
Wow. I never rely on readouts. Always use the window :)
Door ajar? Seatbelt loose? Now we're just getting into paranoia scenarios. What if a nuclear bomb landed and there won't be enough gas to drive me away from the blast zone!
The one vehicle I have right now with ABS has intermittent ABS issues but a soft failure mode. Newer cars rely a lot more on ABS (especially in off-road modes), same goes double for motorcycles. Losing ABS/TC on a motorcycle drastically changes the envelope of safe brake application. If your muscle memory for safe brake application is (mis)trained to rely on ABS/TC at the limits of available traction, losing ABS/TC will very easily lead to a front wheel lockup or unexpectedly losing the front/rear in a lean.
Dash cluster going dark is pretty safe in comparison methinks.
Won't even mention the surplus postal jeep's antics...
In a way, it's like microservices, but completely implicit to the developers, without explicit serialization and all the way to the "individual pixels" on the screens.
Plus he can probably ssh into the dash from his phone and get the 'oil level' that way, at 88 mph, driving through the fog.
I think that since this isn't German engineering to go in millions of cars a CSS/JS/HTML solution in an actual browser launched full screen would have been the way to go.
Losing the speedometer means you need to drive a bit more defensively. And you have higher risks of getting a ticket.
Losing the fuel gauge means you need to be more careful with your fuel management and refill more often. You can also use a dip stick.
Losing the light indicators is no big deal. They are mostly redundant information.
Losing temp and warning lights may be a problem but only if something else goes wrong.
Nothing really critical. It must be fixed but it won't prevent you from getting where you want to go.
More power to 'im! I use lua for such things myself. Because I like it.
That's the beauty (and even a big part of the reason) for solo projects. You get to do it your way.
> Uploading a module to CPAN is the preferred way of distributing Perl 6 modules. [0]
Though XS was replaced with NativeCall in Perl6, so he is still using Perl, not it's new brother.
[0] https://docs.perl6.org/language/modules#Upload_your_Module_t...
> XS [is] exclusive to Perl 5.
Perl 5 modules, including XS ones, are `use`able with P6 (`use Module::Using::XS:from<Perl5>; # P6 code...`).
> CPAN [is] exclusive to Perl 5.
CPAN has been an optional store for Perl 6 modules since 2016 iirc. In the last couple months it's become more or less the preferred store.
What could posibly go wrong.
No seriously, the project looks amazing.
You ruined it!
Also, assuming you're the one that did this modification; How long does it take for your instrument panel to boot? Fast enough to see the tach needle (or replacement thereof) jump up as the engine starts and then bounce back down to normal? Being in a car where I wouldn't be able to see that happen would be… surreal.
Meanwhile the display rendering should be within ~50ms of the measurements from the microcontroller, so the tach and other measurements feel really "tight". (the tach is that curved column of horizontal bars on the left)
:-)
Objective-C? Or maybe Ada is more contemporaneous…