qorelanguage / qore

Qore Programming Language
GNU General Public License v2.0
61 stars 10 forks source link

binary inversion operator does not work with binary type #889

Open gamato opened 8 years ago

gamato commented 8 years ago

bitwise not (binary inversion) operator does not work with binary type. I think it should bit-flip binary values.

davidnich commented 8 years ago

well binary types are like BLOBs - they could be arbitrarily large - I don't think bit operations are practical on this type - certainly was not a design goal...

gamato commented 8 years ago

OK, understood. But would it not be useful if some basic and simple operations could be done on them ? .. I'm thinking of &, |, ^, ~, <<, >>, etc. Maybe not useful on real big BLOBs, but very useful to emulate certain unsigned operations on small values (e.g. 8-64 bit).

tethal commented 8 years ago

I would vote against making the binary type anything more than a block of raw bytes in memory.

gamato commented 8 years ago

Why ? ... Can you explain your reasons, please ?

gamato commented 8 years ago

Right now Qore can read/write binary from/to files or sockets or databases, there are a few functions that can work on them (e.g. gzip), but other than that there's no (sensible) way to manipulate binary data arbitrarily. That makes Qore unsuitable for certain tasks. Is it still a general purpose programming language? And how to handle tasks that need to process (create, modify) binary data? Any suggestions / workarounds ?