My language link was posted on ycombinator news yesterday (?), resulting in a spike in the views on this site. I read through the comments and a couple things stood out.
After deliberating over the matter, I’ve decided that it’d be best to write an extension for Copper that would enable file reading and writing. This would enable the language to finally be general purpose, putting it among the big boys like Python. While the current Copper VM is certainly not fast enough to compete, the ease, power, and syntax of the language make it a highly tempting alternative.
A very simple byte extension was added to Copper’s extension collection recently. It’s just a convenience class with a few features including byte flipping, bit flipping, bit setting and getting. The ByteObject class extends NumericObject, so math operations are possible. Creating a byte instance is done using strings rather than numbers or hex because the Copper VM does not support hex numbers.
mybyte = byte("00001101")
The full byte does not need to be given. Any number of bits less than 8 can be given, and these will set the lowest bits of the byte. The above code could have been written:
mybyte = byte("1101")
Functions are documented at the top of file cu_bytebasics.h.
While attempting to program the image of a mandelbrot, I unwittingly chose the easy, convenient, yet very slow way of writing my complex number class. Let’s have a look.