I spent too much time trying to remember "how to do atoi() in Perl" when you don't need to do that in Perl, it makes no distinction between numbers and strings, you can just do

my $N = shift @ARGV;
$N > 0 || die("Arg must be > 0");

@vaporeon_ man I remember really enjoying Perl when I took my "programming languages paradigms" in college, maybe I should learn it again

also what is die in Perl?

Follow

@vaporeon_ oh does it kill program execution and log the given message to console?

@wallhackio By the way, if you have installed Perl on your machine (if you're still on Debian, that should be trivial, just apt-get install perl), you could do perldoc -f die to find out what the function die does!

@wallhackio "log the given message to console" is a very JavaScript-brained way of saying "print the given message to stderr"...

@vaporeon_ javascript is the only real language, everything else is an imitation

@vaporeon_ I mean, its syntax was inspired by javascript so it's still a great language :]

@wallhackio :blobcatknife:
It is JavaScript that was inspired by C, there was no JavaScript in the 1970s, but there was C

@wallhackio You should try the programming language B, it's the ancestor of C and it doesn't have datatypes :blobvaporeon:

@wallhackio Disclaimer: I don't know whether you actually can run it on a modern computer... But you can always emulate a PDP-11 with SIMH!

@vaporeon_ oh shit really? 👀

also I was joking I don't have problems with C's typing

@wallhackio Here's a web page about it: nokia.com/bell-labs/about/denn

B only has the machine word, there no distinctions between char, int, or pointers, and as far as I know, it doesn't have structs either
That's why it was superceded by C

@wallhackio I don't think it's a practical language for modern-day use

But if you want C without datatypes
You can get C without datatypes

Have fun LOL

@wallhackio Yeah
Structs were one of the big improvements that C had over B

They're even the reason why they could rewrite the UNIX kernel in C instead of assembly:

By early 1973, the essentials of modern C were complete. The language and compiler were strong enough to permit us to rewrite the Unix kernel for the PDP-11 in C during the summer of that year. (Thompson had made a brief attempt to produce a system coded in an early version of C—before structures—in 1972, but gave up the effort.)

@wallhackio @vaporeon_ functions named die that work like that seem to be a general convention; i’ve seen it manually defined to work like that in several codebases

Sign in to participate in the conversation
📟🐱 GlitchCat

A small, community‐oriented Mastodon‐compatible Fediverse (GlitchSoc) instance managed as a joint venture between the cat and KIBI families.