
My Delorean runs Perl - rcarmo
https://opensource.com/article/18/1/my-delorean-runs-perl
======
asaph
> "Because I don't have a lot of time to plan out the full requirements of my
> objects, it has been a great boost to productivity to just toss in an
> additional few attributes on unsuspecting objects, or quickly sort through a
> list of objects based on criteria that would require awkward reflection code
> in Java or C++."

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.

~~~
throwaway080383
Yep, in C++ you can pass in a lambda to create the comparator inline:

    
    
      std::sort(
        myvec.begin(), 
        myvec.end(), 
        [](obj& A, obj& b) {
          return A.attr < B.attr;
        }
      );

~~~
electricslpnsld
If you use std::begin and std::end instead of the member functions this will
even work with old-school C-style arrays.

~~~
emmelaich
.. and Herb Sutter recommends those free functions over the member functions
for this reason -- genericity.

------
_jal
I still fall back to perl for experimental/recreational programming. Possibly
because it is the first scripting language I really felt fluent in, but I
think just because it is so quick and flexible to write.

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.

~~~
v_lisivka
Perl is joy to write (especially with Modern::Perl qw(2016) and feature
qw(signatures)) but is hard to read. I can write lot of code in single line
with map/reduce/split/join/regexps, but without chaining of operators it is
mess, because order of operators is opposite to order of execution. It because
of traditional function or operator invocation syntax: "x(a1, y(a2, z(a3, a4),
a5), a6)", instead of modern chain of calls: "z(a3,a4).y(a2, a5).x(a1, a6)" .
The more operators I pack into single line of code with traditional syntax,
the harder it to read.

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.

~~~
singingfish
perl can be hard to read. but then again it can be easy e.g.
[https://gist.github.com/anonymous/a229b77c8ab25026633f1ab819...](https://gist.github.com/anonymous/a229b77c8ab25026633f1ab819c29a78)

~~~
v_lisivka
I can write readable page of code. I want to write readable line of code.

------
tyingq
Seems directly related to Larry Wall's (Perl founder) "Laziness, Impatience,
Hubris " idea:
[http://wiki.c2.com/?LazinessImpatienceHubris](http://wiki.c2.com/?LazinessImpatienceHubris)

------
userbinator
I'm a fan of car modding myself, but I don't think replacing the entire
instrument cluster with a single centralised system --- where one fault can
leave you with _no_ instruments instead of just one inop --- is such a good
idea. Adding a secondary display for less critical indicators would be useful,
however.

~~~
laythea
Why is a failure of the cluster readout display, during driving, a big deal?

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.

~~~
throwawayjava
_> Why is a failure of the cluster readout display, during driving, a big
deal?_

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.

~~~
lsc
You aren't wrong, but if you really are concerned about those sorts of things,
you should probably drive a late-model Toyota, not a Delorian.

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.

~~~
nrdvana
The DeLorean is actually more reliable now than it was back then because we
have 37 years of test data available on what goes bad and how to prevent it.
There's also a number of improved components available made from newer
materials.

Also it did really well in the crash tests of the 80's and current owners baby
them, so the insurance is pretty cheap.

------
throwawazqq
It is a great idea to program a dashboard to one’s taste. Most dashboards
these days are terrible and illustrative of somebody else’s UI dreams. Imagine
something more useful than what Audi or Tesla provides and not the crap
Apple/Google gives us on our phones

~~~
greglindahl
Tesla owners have been writing javascript websites to run in the web browser
on the 17" touchscreen ever since the Model S was released. You can't do much
of a car dashboard, alas, but you can do weather forecasts, TODO lists,
geofenced content like work server status while I'm driving to work, and so
on.

------
Grazester
Interesting project. The real issue with the Dolorean however is the engine
and drivetrain not the dash.

~~~
Animats
That can be fixed. Here's Stanford's all-electric, self-driving, self-drifting
DeLorean.[1] With a computer display as the dashboard.

[1]
[https://www.youtube.com/watch?v=WNIDcT0Zdj4](https://www.youtube.com/watch?v=WNIDcT0Zdj4)

~~~
avg_dev
That video is awesome, but self-driving is only true if you want to drive in
tight little circles.

------
xt00
Who else was hoping to see some Perl scripts running in a shell on the dash of
the Delorean..

------
noonespecial
That's a lot of lines for "it's my $##& project and I wanted to use perl."

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.

------
AlexCoventry
Perl 5 or 6?

~~~
xeeeeeeeeeeenu
It's clear that he's using Perl 5. XS and CPAN are concepts exclusive to Perl
5.

~~~
shakna
I don't think that is entirely true.

> 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...](https://docs.perl6.org/language/modules#Upload_your_Module_to_CPAN)

------
trco
I wonder how long it takes to boot up the system before you can drive with
this approach.

~~~
dfox
It is easy to tune Debian Wheezy such that it boots into your X application
from rotating HDD in less than 15 seconds from powerup on typical Atom ITX
board. For newer distributions with systemd you don't even need any special
tuning for the boot time to be dominated by BIOS POST.

------
elfchief
Now what I would like to know is ... is this perl code on github?

------
int0x80
> embedding C++ code into Perl

What could posibly go wrong.

No seriously, the project looks amazing.

------
Cyberdog
Let me get this straight. You have a DeLorean DMC-12, a touchstone of '80s
aesthetics and American pop culture icon, and you tear out the instrument
panel and replace it with contemporary over-engineered Linux-powered glitz?

You ruined it!

~~~
nrdvana
The DeLorean was famous exactly because it wasn't 80's aesthetics; it STILL
looks like the car of the future. But the instrument cluster? it's made of
cheesy analog gauges that bounce with the fluctuations of the system voltage.
It desperately needed an upgrade. (but I have all the original pieces and no
parts were cut in the process of the mod ;-)

~~~
Cyberdog
But that's part of the experience, is it not? Analogue gauges!

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.

~~~
nrdvana
My kernel takes 2 seconds, and the userspace takes about 4, mostly waiting for
Xorg to initialize the display (which I could probably improve using a
hardcoded xorg config, rather than autodetect). The real killer is BIOS
though- my FitPC 3 takes about 7 seconds to POST. However, I power it on when
the door opens, rather than when the key turns, and one of these days I'll get
it connected to my remote unlock button. The microcontroller is always on and
consumes almost no power. I would buy a new PC if I knew for sure that the
post time was less, but nobody ever advertises that statistic, and anything
based on BIOS/UEFI tends to be abysmally slow.

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)

------
billytetrud
Where's the flux capacitor?

------
pcunite
People who like Perl are weird.

:-)

~~~
gbacon
But productive.

------
farnsworthy
[https://en.wikipedia.org/wiki/History_of_programming_languag...](https://en.wikipedia.org/wiki/History_of_programming_languages)

Objective-C? Or maybe Ada is more contemporaneous…

