Let's meet the new kid on the programming block.
V is a brand new programming language that's been making quite a few waves in the programming community.
I stumbled upon it a few months back when I read this article.
And it's also under active development (as evidenced by the recent commits in its GitHub repo).
So, I thought, why not give it a try. After all, what's the harm in being an early adopter, right?
So, let's get started!
I extracted its contents and fired up the macOS Terminal. Then, I navigated to the directory where I'd extracted the prebuilt binary and fired the following command in the Terminal:
It's supposed to display V's current version, something like below:
But instead, the following prompt popped up on the screen:
You see, macOS blocks the execution of apps that haven't been notarized (meaning, apple can't verify the origins of the app, and as a result, can't guarantee that the application isn't malicious).
So, what do we do now? Give up?
There's a workaround: We can tell macOS to make an exception for such unnotarized apps by navigating to System Preferences > Security & Privacy and click the "Allow Anyway" button. Take a peek at the gif below to get a better idea:
Now that we've told the bouncer (macOS 😀) to let the guest in, we should be able to start the party, right? (run V via the Terminal without any issue)
But no! 😯 That's not what happens. When we execute the
./v version on the Terminal again, the following screen pops up:
This is the same pop-up that we encountered a while back, but this time, macOS has provided us with the "Open" button. Let's click it and see what happens:
As soon as we click "Open", the
./v version command executes and prints its output on the Terminal.
Now that V's compiler is up & running on our local machine, we can start writing programs in V.
But wait! Don't we need a fancy IDE like VSCode, with all its elegant themes and plugins 😄 (just joking, it's my favorite IDE.)
No, not yet, at least!
V provides a REPL interface that allows you to play around with the language without having to create any files on your hard disk.
So, as the Hello World Tradition dictates, let's write our first program in V:
Press the "enter/return" key on your keyboard and let the magic begin!
Voila! It worked!
That's it, guys!
Stay tuned for more stories about V programming!