I have some questions about uint type, using nimrod 0.9.0, win32
The following code fails to compile at two places. First, in WndProc, msg is an uint, and the case do not see uint as an ordinal type. Bug? Feature? Secondly, setting wc.cbSize cannot be done without a cast, could be done but is a bit annoying. Maybe the rules of uint should be relaxed?
Possibly, windows.nim should be edited to never use uint (instead using int evrywhere windows type UINT is used??)
import windows proc WndProc(hw:HWND,msg:UINT,wParam:WPARAM, lParam:LPARAM):LRESULT {.stdcall.}= case int(msg) ###fails because not an ordinal of WM_CLOSE: discard DestroyWindow(hw) of WM_DESTROY: PostQuitMessage(0) else: return DefWindowProc(hw, msg, wParam, lParam) proc newWindow(caption:string)= var wc:WNDCLASSEX wc.cbSize = sizeof(wc) ###fails to compile, uint expected
Indeed UINT should be an alias to 'int32' for windows.nim. Bug report please.
And yes, Nimrod's uint and uint64 types are no ordinal types: currently biggestint can always hold 'low(someInt)' and 'high(someInt)'. uint (which is 64bits on a 64bit machine) and uint64 as ordinal types would break this affecting lots of code (in the compiler itself and also in the stdlib). Since I consider unsigned integers an abomination, I decided to keep the implementation simple and these types as non-ordinal.