Tag: programming language

output(File:)

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.

Continue reading “output(File:)”

Take a Byte of Copper

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.

pub: private

A number of languages support a kind of “public”/”protected”/”private” model. The actual implementation and meaning of this model vary from programming language to programming language, but the basic idea remains the same: preventing code outside of an object from modifying certain things inside of it.
As an interpreted language, Copper doesn’t support such a model.

Continue reading “pub: private”

i_am~super

This feature was implemented a long time ago and is available on every branch of Copper

Creating classes is an interesting paradigm (should be spelled “paradym”, but nobody asked me). Many languages implement such a feature (C++, Ruby, PHP, etc.), some languages make the feature so terse it’s hard to recognize without reading docs, some languages don’t even bother with it, but you can still implement it with some work. There have been a number of arguments about whether closures and classes are essentially the same thing with different names, but I’m on the side that thinks otherwise. It’s a matter of construction, and certainly closures are far easier to create in some languages than in others. I won’t go into a discussion of class versus closure, but I will admit that the line is certainly very blurry, and Copper adds another dimension to it.

Continue reading “i_am~super”