Posts

Upcoming Guest Opinions Post!

Image
  Hello everybody, Sometime in the next few days I am planning my first guest opinions post! This format will consist of me and a couple of friends each writing a little on a question, and then a little conclusion! Maybe at some point down the line, you guys can write a paragraph too! So here's the first motion, if you will! " Is C a useful skill in 2023? " We will examine views from multiple angles of the programming spectrum. Lined up to contribute, I have myself, my web dev friend, and a more Python angled developer! What do you think of this hot question? Feel free to post your answer in the comments section below!

color gets updated!

Image
  CIELAB color space top view Hello everybody, here is the updated version of my V package color. I have added some new functionality, and today I will talk you through how that went! So, I realise that my last iteration did not have HSL, or alpha channels. So I added them in. The way I implemented alpha channels is that the RGB and HSL structs now have an optional alpha channel, which is specified to 2 decimal places and resides in an f64. Conversion with alpha values was also implemented between any alpha supporting formats, though I am yet to implement alpha conversion with CMYK. However, that was the easy part, I felt, of the changes! The next thing I did was check Wikipedia for a list of CSS colors (well, at least CSS4 colors). One that came up was CIELAB, a format covering the whole gamut of human vision. This required an intermediary format, XYZ, but I thought I would, as it seemed interesting and would surely be a boost to my library's usage. It took quite a while, but I e

Why I use the V language

Image
  Why do I use V? It is new, not proven, nor particularly popular. In this post I will explain why I use it, and why you should too! First, a quick introduction to the language. V is, quoting from the official documentation, a "statically typed compiled programming language designed for building maintainable software. It's similar to Go and its design has also been influenced by Oberon, Rust, Swift, Kotlin, and Python." . It is a modern language, and prides itself on simplicity. However, I think it achieves the balance between powerful and easy. But not every language does, in my opinion. For example, Python. The first language I learnt, you can learn the basics of Python fairly quickly, and I would imagine if I had learnt another language first I would have learnt the basics even faster. However, there are a few things I don't like about Python.  Here are two: It is interpreted. Though there exist methods to try to solve this problem, (for instance pyinstaller ), th

color - A library for color interface in V

Image
  Hello again, this afternoon I decided to write a library for color interface in V! As I stated in my previous post, I very much like V and think it has great potential.  Since in this project I knew it would be used a library, I had to make some changes to the struct and function definitions, namely making them public. Below are the definitions of the structs. pub struct RGB { pub : r int g int b int } pub struct CMYK { pub : c int m int y int k int } pub struct HEX { pub : data string } As you can see, I made the choice to store the hexadecimal values as strings, which would make it easier to work with later on. However, the inital function accepts int or strings, to allow for operability with existing code. Once done with this, I knew that we would need at least 6 functions, to switch between the following: RGB to CMYK RGB to hex CMYK to RGB CMYK to hex hex to RGB hex to CMYK And these funct

Writing LiveC - a C REPL written in V

Image
In this post, I will explain how I wrote LiveC, my latest project. I used V, one of my favourite up-and-coming languages. I like the way the syntax is easy to learn, and the principles logical, but also the fact that compilation to C enhances speed and increases portability.  I was inspired to make this project by a similar one I saw online, namely crepl . I thought it would be an interesting challenge, and I had also previously thought that a C live shell would be useful. So I set off. As with most projects I write, the first thing I did was to setup the that we would be working on. struct Function { def string source string } struct LiveC { mut : functions [] Function main_func string spaces int first string } Once I had done this, I began to write the methods that we would call on these classes. My first draft of the code, which didn't use highlighting yet, took input from the user, before checking if it was a function. If so