News for hackers. Stuff that matters.
Re:C (Cbang) - A system oriented programming language by nitrogen on Wednesday May 09, 2012 @11:05AM (#3948888)
Regarding the use of integers as bit arrays, it would be nice if the syntax supported referring to a subset of the bits, similarly to bitfields in structs.

Example based on the syntax from the article:

  x: int<+32>;
  x[0:6] = 42; // Set six bits starting with lsb 0 to 42
Re:C (Cbang) - A system oriented programming language by slashvar on Friday May 11, 2012 @03:55AM (#3958187)
Yes, this is in the TODO list ;)

In fact, it doesn't reach top priority since we can do without for now (we have bitfields.) The issue with slicing is more a question of design: does slicing need to be constant expression or should we authorize more expression power (and then how could we implement that and how could we check it … )

Anyway, I'm looking for a clever way to define values accessed in a none uniform ways.

Integer as bit array was the simplest idea to test (and seems useful to me.) Now the compiler has almost everything I need to implement easily that kind of syntactic sugars.