Other language features you'd want in D

dominik aha at aha.com
Fri Feb 22 16:09:27 PST 2008


I know its not polite to answer my own post, but one more thing - even 
though I use tango from day to day, I applaud bitfields implementation in 
std.. now make them part of the language - certanly most people don't use 
it, but those who do work with them all the time
I know its a fantasy but it would be "cool" - and here I'm just pitching an 
idea - to access bits in a variable in D array fashion for example

classic way:
ubyte x = 14;
ubyte temp = x &0x7; // to access "first" three bits

x:
00001110
temp:
00000110

"new" way of sorts (I haven't gave much thought to syntax, ofcourse - cast 
is foolish, but eh):
ubyte x = 14;
ubyte temp = cast(bitselect)x[$-3..$]; 





More information about the Digitalmars-d mailing list